@Test public void processorReturnsNatureEnrichedWithCacheProperties() throws Exception { CacheProperty[] cacheProperties = new CacheProperty[1]; when(_cacheProperty.key()).thenReturn("type"); when(_cacheProperty.value()).thenReturn("none"); cacheProperties[0] = _cacheProperty; when(_annotation.value()).thenReturn(cacheProperties); _processor.processAnnotation(_classNature, _annotation, CacheAnnotatedClass.class); Properties actualProperties = _classNature.getCacheProperties(); assertEquals("none", actualProperties.getProperty("type")); }
@Test public void processorReturnsTrueForCacheAnnotatedClass() throws Exception { CacheProperty[] cacheProperties = new CacheProperty[1]; when(_cacheProperty.key()).thenReturn("type"); when(_cacheProperty.value()).thenReturn("none"); cacheProperties[0] = _cacheProperty; when(_annotation.value()).thenReturn(cacheProperties); boolean result = _processor.processAnnotation(_classNature, _annotation, CacheAnnotatedClass.class); assertTrue(result); }
@Test public void processorReturnsFalseForOtherwiseAnnotatedClass() throws Exception { boolean result = _processor.processAnnotation(_classNature, _annotation, OtherwiseAnnotatedClass.class); assertFalse(result); }
@Test public void processorIsForCacheAnnotation() throws Exception { assertEquals(Cache.class, _processor.forAnnotationClass()); }