mardi 15 décembre 2020

Cache SpringBoot can not test

I have spring boot application with cache WITHOUT db(jpa, repository etc). Have

@Cacheable(cacheNames = "val", key = "#a1.toString() + #a2.toString()")
public LocalDateTime put(UUID a1, UUID a2, LocalDateTime time) {
    return createdAt;
}

@Cacheable(cacheNames = "val", key = "#a1.toString() + #a2.toString()")
public LocalDateTime get(UUID a1, UUID a2) {
    return LocalDateTime.MIN;
}

And I can not test this(( I tried to use Autowired CacheManager in test. But it does not help. In all cases returned method value(LocalDateTime.MIN) instead of cached value. Please help.

Aucun commentaire:

Enregistrer un commentaire