SimpleApplicationManager implements ApplicationManager { @Override public Optional<Application> getApplication(String applicationId) { if (!applicationExists(applicationId)) { return Optional.empty(); } return Optional.ofNullable(applications.get(applicationId).getApplication()); }  @Reference(type = '*', dynamic = true) void addApplication(ApplicationWrapper applicationWrapper); void removeApplication(ApplicationWrapper applicationWrapper); @Override boolean applicationExists(String applicationId); @Override Optional<Application> getApplication(String applicationId);  }
@Test public void getApplicationTest() throws Exception { Optional<Application> result = manager.getApplication(ID); assertTrue(result.isPresent()); assertEquals(application, result.get()); }
@Test public void getApplicationThatDoesNotExistTest() throws Exception { Optional<Application> result = manager.getApplication("error"); assertFalse(result.isPresent()); }