@Test void testUpdateNoActivationChange() { App current = mock(App.class); when(current.getId()).thenReturn("app"); when(current.isActive()).thenReturn(true); when(repository.findOneById("app")).thenReturn(current); App app = mock(App.class); when(app.getId()).thenReturn("app"); when(app.isActive()).thenReturn(true); appRepositoryDecorator.update(app); verifyNoMoreInteractions(appManagerService); verify(repository).update(app); }
@Override public void update(App app) { App current = findOneById(app.getId()); if (current != null && (current.isActive() != app.isActive())) { if (app.isActive()) { appManagerService.activateApp(app); } else { appManagerService.deactivateApp(app); } } delegate().update(app); }
AppRepositoryDecorator extends AbstractRepositoryDecorator<App> { @Override public void update(App app) { App current = findOneById(app.getId()); if (current != null && (current.isActive() != app.isActive())) { if (app.isActive()) { appManagerService.activateApp(app); } else { appManagerService.deactivateApp(app); } } delegate().update(app); } }
AppRepositoryDecorator extends AbstractRepositoryDecorator<App> { @Override public void update(App app) { App current = findOneById(app.getId()); if (current != null && (current.isActive() != app.isActive())) { if (app.isActive()) { appManagerService.activateApp(app); } else { appManagerService.deactivateApp(app); } } delegate().update(app); } AppRepositoryDecorator(
      Repository<App> delegateRepository, AppManagerService appManagerService); }
AppRepositoryDecorator extends AbstractRepositoryDecorator<App> { @Override public void update(App app) { App current = findOneById(app.getId()); if (current != null && (current.isActive() != app.isActive())) { if (app.isActive()) { appManagerService.activateApp(app); } else { appManagerService.deactivateApp(app); } } delegate().update(app); } AppRepositoryDecorator(
      Repository<App> delegateRepository, AppManagerService appManagerService); @Override void delete(App entity); @Override void deleteById(Object id); @Override void deleteAll(); @Override void update(App app); @Override void update(Stream<App> apps); }
AppRepositoryDecorator extends AbstractRepositoryDecorator<App> { @Override public void update(App app) { App current = findOneById(app.getId()); if (current != null && (current.isActive() != app.isActive())) { if (app.isActive()) { appManagerService.activateApp(app); } else { appManagerService.deactivateApp(app); } } delegate().update(app); } AppRepositoryDecorator(
      Repository<App> delegateRepository, AppManagerService appManagerService); @Override void delete(App entity); @Override void deleteById(Object id); @Override void deleteAll(); @Override void update(App app); @Override void update(Stream<App> apps);  }