@Test public void shouldUpdateApplication() { when(applicationsApiMock.getByName(APPLICATION_NAME)).thenReturn(Optional.of(APPLICATION)); ApplicationSettings expectedSettings = ApplicationSettings.builder() .appApdexThreshold(APP_APDEX_THRESHOLD) .endUserApdexThreshold(USER_APDEX_THRESHOLD) .enableRealUserMonitoring(ENABLE_REAL_USER_MONITORING) .build(); Application expectedApplicationUpdate = Application.builder() .name(APPLICATION_NAME) .settings(expectedSettings) .build(); testee.sync(CONFIGURATION); verify(applicationsApiMock).update(APPLICATION.getId(), expectedApplicationUpdate); }
void sync(@NonNull ApplicationConfiguration config) { LOG.info("Synchronizing application {}...", config.getApplicationName()); Application application = api.getApplicationsApi().getByName(config.getApplicationName()).orElseThrow( () -> new NewRelicSyncException(format("Application %s does not exist", config.getApplicationName()))); ApplicationSettings settings = ApplicationSettings.builder() .appApdexThreshold(config.getAppApdexThreshold()) .endUserApdexThreshold(config.getEndUserApdexThreshold()) .enableRealUserMonitoring(config.isEnableRealUserMonitoring()) .build(); Application applicationUpdate = Application.builder() .name(config.getApplicationName()) .settings(settings) .build(); api.getApplicationsApi().update(application.getId(), applicationUpdate); LOG.info("Application {} synchronized", config.getApplicationName()); }
ApplicationConfigurator { void sync(@NonNull ApplicationConfiguration config) { LOG.info("Synchronizing application {}...", config.getApplicationName()); Application application = api.getApplicationsApi().getByName(config.getApplicationName()).orElseThrow( () -> new NewRelicSyncException(format("Application %s does not exist", config.getApplicationName()))); ApplicationSettings settings = ApplicationSettings.builder() .appApdexThreshold(config.getAppApdexThreshold()) .endUserApdexThreshold(config.getEndUserApdexThreshold()) .enableRealUserMonitoring(config.isEnableRealUserMonitoring()) .build(); Application applicationUpdate = Application.builder() .name(config.getApplicationName()) .settings(settings) .build(); api.getApplicationsApi().update(application.getId(), applicationUpdate); LOG.info("Application {} synchronized", config.getApplicationName()); } }
ApplicationConfigurator { void sync(@NonNull ApplicationConfiguration config) { LOG.info("Synchronizing application {}...", config.getApplicationName()); Application application = api.getApplicationsApi().getByName(config.getApplicationName()).orElseThrow( () -> new NewRelicSyncException(format("Application %s does not exist", config.getApplicationName()))); ApplicationSettings settings = ApplicationSettings.builder() .appApdexThreshold(config.getAppApdexThreshold()) .endUserApdexThreshold(config.getEndUserApdexThreshold()) .enableRealUserMonitoring(config.isEnableRealUserMonitoring()) .build(); Application applicationUpdate = Application.builder() .name(config.getApplicationName()) .settings(settings) .build(); api.getApplicationsApi().update(application.getId(), applicationUpdate); LOG.info("Application {} synchronized", config.getApplicationName()); } ApplicationConfigurator(@NonNull NewRelicApi api); }
ApplicationConfigurator { void sync(@NonNull ApplicationConfiguration config) { LOG.info("Synchronizing application {}...", config.getApplicationName()); Application application = api.getApplicationsApi().getByName(config.getApplicationName()).orElseThrow( () -> new NewRelicSyncException(format("Application %s does not exist", config.getApplicationName()))); ApplicationSettings settings = ApplicationSettings.builder() .appApdexThreshold(config.getAppApdexThreshold()) .endUserApdexThreshold(config.getEndUserApdexThreshold()) .enableRealUserMonitoring(config.isEnableRealUserMonitoring()) .build(); Application applicationUpdate = Application.builder() .name(config.getApplicationName()) .settings(settings) .build(); api.getApplicationsApi().update(application.getId(), applicationUpdate); LOG.info("Application {} synchronized", config.getApplicationName()); } ApplicationConfigurator(@NonNull NewRelicApi api);  }
ApplicationConfigurator { void sync(@NonNull ApplicationConfiguration config) { LOG.info("Synchronizing application {}...", config.getApplicationName()); Application application = api.getApplicationsApi().getByName(config.getApplicationName()).orElseThrow( () -> new NewRelicSyncException(format("Application %s does not exist", config.getApplicationName()))); ApplicationSettings settings = ApplicationSettings.builder() .appApdexThreshold(config.getAppApdexThreshold()) .endUserApdexThreshold(config.getEndUserApdexThreshold()) .enableRealUserMonitoring(config.isEnableRealUserMonitoring()) .build(); Application applicationUpdate = Application.builder() .name(config.getApplicationName()) .settings(settings) .build(); api.getApplicationsApi().update(application.getId(), applicationUpdate); LOG.info("Application {} synchronized", config.getApplicationName()); } ApplicationConfigurator(@NonNull NewRelicApi api);   }