@Test public void testBuild() throws Exception { when(testSuite.getState()).thenReturn(TestSuiteState.OK); String perfData = "sample_performance_data"; when(performanceDataBuilder.build()).thenReturn(Collections.singletonList(perfData)); String output = "sample_output"; when(outputBuilder.build()).thenReturn(output); Icinga2Request result = testling.build(); assertEquals(result.getCheck_source(), "check_sakuli"); assertEquals(result.getExit_status(), 0); assertEquals(result.getPerformance_data().size(), 1); assertEquals(result.getPerformance_data().iterator().next(), perfData); assertEquals(result.getPlugin_output(), output); }
@Override public Icinga2Request build() { Icinga2RequestBuilder requestBuilder = new Icinga2RequestBuilder() .withCheckSource("check_sakuli") .withPluginOutput(outputBuilder.build()) .withExitStatus(testSuite.getState().getNagiosErrorCode()); return addPerformanceData(requestBuilder).build(); }
Icinga2CheckResultBuilder implements Builder<Icinga2Request> { @Override public Icinga2Request build() { Icinga2RequestBuilder requestBuilder = new Icinga2RequestBuilder() .withCheckSource("check_sakuli") .withPluginOutput(outputBuilder.build()) .withExitStatus(testSuite.getState().getNagiosErrorCode()); return addPerformanceData(requestBuilder).build(); } }
Icinga2CheckResultBuilder implements Builder<Icinga2Request> { @Override public Icinga2Request build() { Icinga2RequestBuilder requestBuilder = new Icinga2RequestBuilder() .withCheckSource("check_sakuli") .withPluginOutput(outputBuilder.build()) .withExitStatus(testSuite.getState().getNagiosErrorCode()); return addPerformanceData(requestBuilder).build(); }  }
Icinga2CheckResultBuilder implements Builder<Icinga2Request> { @Override public Icinga2Request build() { Icinga2RequestBuilder requestBuilder = new Icinga2RequestBuilder() .withCheckSource("check_sakuli") .withPluginOutput(outputBuilder.build()) .withExitStatus(testSuite.getState().getNagiosErrorCode()); return addPerformanceData(requestBuilder).build(); }  @Override Icinga2Request build(); }
Icinga2CheckResultBuilder implements Builder<Icinga2Request> { @Override public Icinga2Request build() { Icinga2RequestBuilder requestBuilder = new Icinga2RequestBuilder() .withCheckSource("check_sakuli") .withPluginOutput(outputBuilder.build()) .withExitStatus(testSuite.getState().getNagiosErrorCode()); return addPerformanceData(requestBuilder).build(); }  @Override Icinga2Request build();  }