### Question:
ApplicationInitializer { @PostConstruct public void init() { if (bootstrapProperties.isReadable()) { Properties sliProp; try { sliProp = PropertiesLoaderUtils.loadProperties(bootstrapProperties); processTemplates(sliProp); } catch (IOException e) { LOG.error("Could not load boostrap properties.", e); } } else { LOG.warn("Could not find bootstrap properties at {}.", bootstrapProperties); } }  @PostConstruct void init();  }### Answer:
@SuppressWarnings({ "unchecked", "rawtypes" }) @Test public void testAppNotExist() throws Exception { final List<Map<String, Object>> apps = new ArrayList<Map<String, Object>>(); Mockito.when(mockRepo.create(Mockito.anyString(), Mockito.anyMap())).thenAnswer(new Answer<Entity>() { @Override public Entity answer(InvocationOnMock invocation) throws Throwable { apps.add((Map<String, Object>) invocation.getArguments()[1]); return null; } }); appInit.init(); assertEquals("Two apps registered", 2, apps.size()); assertEquals("Value replaced", "https: assertEquals("Value replaced", "https: }
@SuppressWarnings({ "unchecked", "rawtypes" }) @Test public void testExistingApps() throws Exception { final List<Entity> apps = new ArrayList<Entity>(); props.put("bootstrap.app.keys", "admin"); saveProps(); Entity mockEntity = Mockito.mock(Entity.class); Mockito.when(mockRepo.findOne(Mockito.anyString(), Mockito.any(NeutralQuery.class))).thenReturn(mockEntity); Mockito.when(mockRepo.update(Mockito.anyString(), Mockito.any(Entity.class), Mockito.anyBoolean())).thenAnswer( new Answer<Boolean>() { @Override public Boolean answer(InvocationOnMock invocation) throws Throwable { apps.add((Entity) invocation.getArguments()[1]); return true; } }); appInit.init(); assertEquals("One app updated", 1, apps.size()); }