maybe this is a bit simple, but i am just learning
I have this code:
public RediseImpl(RedissonClient client) {
keys = client.getSetCache("keys");
}
@Override
public boolean exists(String key) {
boolean contains = keys.contains(key);
return contains;
}
and i want to mock what happens if the contains method is true so i have the following code:
def "When given key doesn't exists, returns false" () {
given:
client.getSetCache(_ as String).contains(_ as String) >> true
when:
def res = RediseImpl.exists("id")
then:
res
}
I debug the method, but the contains always give a FALSE result. How can i mock it?
Aucun commentaire:
Enregistrer un commentaire