@Test public void testBuildTransferException() throws Exception { GearmanJobResult result = mock(GearmanJobResult.class); when(result.getExceptions()).thenReturn("exceptions".getBytes()); when(result.getWarnings()).thenReturn("warnings".getBytes()); SakuliForwarderRuntimeException sakuliForwarderException = NagiosExceptionBuilder.buildTransferException("localhost", 4370, result); assertEquals(sakuliForwarderException.getMessage(), "something went wrong during the transfer of the results to the gearman forwarder 'localhost:'4370':\n" + "EXCEPTIONS:\n" + "exceptions\n" + "WARNINGS:\n" + "warnings\n"); }
public static SakuliForwarderRuntimeException buildTransferException(String host, int port, GearmanJobResult result) { return new SakuliForwarderRuntimeException( String.format("something went wrong during the transfer of the results to the gearman forwarder '%s:'%s':\n%s", host, port, buildExceptionForGearmanResult(result) )); }
NagiosExceptionBuilder { public static SakuliForwarderRuntimeException buildTransferException(String host, int port, GearmanJobResult result) { return new SakuliForwarderRuntimeException( String.format("something went wrong during the transfer of the results to the gearman forwarder '%s:'%s':\n%s", host, port, buildExceptionForGearmanResult(result) )); } }
NagiosExceptionBuilder { public static SakuliForwarderRuntimeException buildTransferException(String host, int port, GearmanJobResult result) { return new SakuliForwarderRuntimeException( String.format("something went wrong during the transfer of the results to the gearman forwarder '%s:'%s':\n%s", host, port, buildExceptionForGearmanResult(result) )); }  }
NagiosExceptionBuilder { public static SakuliForwarderRuntimeException buildTransferException(String host, int port, GearmanJobResult result) { return new SakuliForwarderRuntimeException( String.format("something went wrong during the transfer of the results to the gearman forwarder '%s:'%s':\n%s", host, port, buildExceptionForGearmanResult(result) )); }  static SakuliForwarderRuntimeException buildUnexpectedErrorException(Exception e, String host, int port); static SakuliForwarderRuntimeException buildTransferException(String host, int port, GearmanJobResult result); }
NagiosExceptionBuilder { public static SakuliForwarderRuntimeException buildTransferException(String host, int port, GearmanJobResult result) { return new SakuliForwarderRuntimeException( String.format("something went wrong during the transfer of the results to the gearman forwarder '%s:'%s':\n%s", host, port, buildExceptionForGearmanResult(result) )); }  static SakuliForwarderRuntimeException buildUnexpectedErrorException(Exception e, String host, int port); static SakuliForwarderRuntimeException buildTransferException(String host, int port, GearmanJobResult result);  }