### Question:
StrutsTilesAnnotationProcessor { public TilesDefinition findAnnotation(Object action, String tileName) { Class<?> clazz = action.getClass(); TilesDefinition tilesDefinition = clazz.getAnnotation(TilesDefinition.class); TilesDefinitions tilesDefinitions = clazz.getAnnotation(TilesDefinitions.class); if (tilesDefinition == null && tilesDefinitions != null) { if (!StringUtils.isEmpty(tileName)) { for (TilesDefinition i : tilesDefinitions.value()) { if (i.name().equals(tileName)) { tilesDefinition = i; break; } } } else { if (tilesDefinitions.value().length > 0) { tilesDefinition = tilesDefinitions.value()[0]; } } } return tilesDefinition; }  TilesDefinition findAnnotation(Object action, String tileName); Definition buildTilesDefinition(String tileName, TilesDefinition tilesDefinition);  }### Answer:
@Test public void findAnnotationSingleAction() { StrutsTilesAnnotationProcessor annotationProcessor = new StrutsTilesAnnotationProcessor(); TilesDefinition tilesDefinition = annotationProcessor.findAnnotation(new TilesTestActionSingleAnnotation(), null); Assert.assertNotNull(tilesDefinition); Assert.assertEquals("definition-name", tilesDefinition.name()); }
@Test public void findAnnotationMultipleActionNameNull() { StrutsTilesAnnotationProcessor annotationProcessor = new StrutsTilesAnnotationProcessor(); TilesDefinition tilesDefinition = annotationProcessor.findAnnotation(new TilesTestActionMultipleAnnotations(), null); Assert.assertNotNull(tilesDefinition); Assert.assertEquals("def1", tilesDefinition.name()); }
@Test public void findAnnotationMultipleActionNameGiven() { StrutsTilesAnnotationProcessor annotationProcessor = new StrutsTilesAnnotationProcessor(); TilesDefinition tilesDefinition = annotationProcessor.findAnnotation(new TilesTestActionMultipleAnnotations(), "def2"); Assert.assertNotNull(tilesDefinition); Assert.assertEquals("def2", tilesDefinition.name()); }
@Test public void findAnnotationMultipleActionNotFound() { StrutsTilesAnnotationProcessor annotationProcessor = new StrutsTilesAnnotationProcessor(); TilesDefinition tilesDefinition = annotationProcessor.findAnnotation(new TilesTestActionMultipleAnnotations(), "def3"); Assert.assertNull(tilesDefinition); }