Search in sources :

Example 6 with NoOpCache

use of cn.taketoday.cache.support.NoOpCache in project today-framework by TAKETODAY.

the class LoggingCacheErrorHandlerTests method handlePutCacheErrorLogsAppropriateMessage.

@Test
void handlePutCacheErrorLogsAppropriateMessage() {
    Logger logger = mock(Logger.class);
    LoggingCacheErrorHandler handler = new LoggingCacheErrorHandler(logger, false);
    handler.handleCachePutError(new RuntimeException(), new NoOpCache("NOOP"), "key", new Object());
    verify(logger).warn("Cache 'NOOP' failed to put entry with key 'key'");
}
Also used : NoOpCache(cn.taketoday.cache.support.NoOpCache) Logger(cn.taketoday.logging.Logger) Test(org.junit.jupiter.api.Test)

Example 7 with NoOpCache

use of cn.taketoday.cache.support.NoOpCache in project today-framework by TAKETODAY.

the class LoggingCacheErrorHandlerTests method handleEvictCacheErrorLogsAppropriateMessage.

@Test
void handleEvictCacheErrorLogsAppropriateMessage() {
    Logger logger = mock(Logger.class);
    LoggingCacheErrorHandler handler = new LoggingCacheErrorHandler(logger, false);
    handler.handleCacheEvictError(new RuntimeException(), new NoOpCache("NOOP"), "key");
    verify(logger).warn("Cache 'NOOP' failed to evict entry with key 'key'");
}
Also used : NoOpCache(cn.taketoday.cache.support.NoOpCache) Logger(cn.taketoday.logging.Logger) Test(org.junit.jupiter.api.Test)

Example 8 with NoOpCache

use of cn.taketoday.cache.support.NoOpCache in project today-framework by TAKETODAY.

the class LoggingCacheErrorHandlerTests method handleGetCacheErrorLogsAppropriateMessage.

@Test
void handleGetCacheErrorLogsAppropriateMessage() {
    Logger logger = mock(Logger.class);
    LoggingCacheErrorHandler handler = new LoggingCacheErrorHandler(logger, false);
    handler.handleCacheGetError(new RuntimeException(), new NoOpCache("NOOP"), "key");
    verify(logger).warn("Cache 'NOOP' failed to get entry with key 'key'");
}
Also used : NoOpCache(cn.taketoday.cache.support.NoOpCache) Logger(cn.taketoday.logging.Logger) Test(org.junit.jupiter.api.Test)

Example 9 with NoOpCache

use of cn.taketoday.cache.support.NoOpCache in project today-infrastructure by TAKETODAY.

the class LoggingCacheErrorHandlerTests method handleGetCacheErrorLogsAppropriateMessage.

@Test
void handleGetCacheErrorLogsAppropriateMessage() {
    Logger logger = mock(Logger.class);
    LoggingCacheErrorHandler handler = new LoggingCacheErrorHandler(logger, false);
    handler.handleCacheGetError(new RuntimeException(), new NoOpCache("NOOP"), "key");
    verify(logger).warn("Cache 'NOOP' failed to get entry with key 'key'");
}
Also used : NoOpCache(cn.taketoday.cache.support.NoOpCache) Logger(cn.taketoday.logging.Logger) Test(org.junit.jupiter.api.Test)

Example 10 with NoOpCache

use of cn.taketoday.cache.support.NoOpCache in project today-infrastructure by TAKETODAY.

the class LoggingCacheErrorHandlerTests method handlePutCacheErrorLogsAppropriateMessage.

@Test
void handlePutCacheErrorLogsAppropriateMessage() {
    Logger logger = mock(Logger.class);
    LoggingCacheErrorHandler handler = new LoggingCacheErrorHandler(logger, false);
    handler.handleCachePutError(new RuntimeException(), new NoOpCache("NOOP"), "key", new Object());
    verify(logger).warn("Cache 'NOOP' failed to put entry with key 'key'");
}
Also used : NoOpCache(cn.taketoday.cache.support.NoOpCache) Logger(cn.taketoday.logging.Logger) Test(org.junit.jupiter.api.Test)

Aggregations

NoOpCache (cn.taketoday.cache.support.NoOpCache)10 Logger (cn.taketoday.logging.Logger)10 Test (org.junit.jupiter.api.Test)10