@Test public void failEmptyArrayList() { TransmissionPolicyManager tpm = new TransmissionPolicyManager(true); TransmissionDispatcher mockedDispatcher = Mockito.mock(TransmissionDispatcher.class); TransmissionHandlerArgs args = new TransmissionHandlerArgs(); args.setResponseCode(206); args.setTransmission(new Transmission(fourItems, "application/x-json-stream", "gzip")); args.setTransmissionDispatcher(mockedDispatcher); PartialSuccessHandler eh = new PartialSuccessHandler(tpm); boolean result = eh.sendNewTransmissionFromStrings(args, new ArrayList<String>()); Assert.assertFalse(result); }
boolean sendNewTransmissionFromStrings(TransmissionHandlerArgs args, List<String> newTransmission) { if (!newTransmission.isEmpty()) { GzipTelemetrySerializer serializer = new GzipTelemetrySerializer(); Optional<Transmission> newT = serializer.serializeFromStrings(newTransmission); args.getTransmissionDispatcher().dispatch(newT.get()); return true; } return false; }
PartialSuccessHandler implements TransmissionHandler { boolean sendNewTransmissionFromStrings(TransmissionHandlerArgs args, List<String> newTransmission) { if (!newTransmission.isEmpty()) { GzipTelemetrySerializer serializer = new GzipTelemetrySerializer(); Optional<Transmission> newT = serializer.serializeFromStrings(newTransmission); args.getTransmissionDispatcher().dispatch(newT.get()); return true; } return false; } }
PartialSuccessHandler implements TransmissionHandler { boolean sendNewTransmissionFromStrings(TransmissionHandlerArgs args, List<String> newTransmission) { if (!newTransmission.isEmpty()) { GzipTelemetrySerializer serializer = new GzipTelemetrySerializer(); Optional<Transmission> newT = serializer.serializeFromStrings(newTransmission); args.getTransmissionDispatcher().dispatch(newT.get()); return true; } return false; } PartialSuccessHandler(TransmissionPolicyManager policy); }
PartialSuccessHandler implements TransmissionHandler { boolean sendNewTransmissionFromStrings(TransmissionHandlerArgs args, List<String> newTransmission) { if (!newTransmission.isEmpty()) { GzipTelemetrySerializer serializer = new GzipTelemetrySerializer(); Optional<Transmission> newT = serializer.serializeFromStrings(newTransmission); args.getTransmissionDispatcher().dispatch(newT.get()); return true; } return false; } PartialSuccessHandler(TransmissionPolicyManager policy); @Override void onTransmissionSent(TransmissionHandlerArgs args); }
PartialSuccessHandler implements TransmissionHandler { boolean sendNewTransmissionFromStrings(TransmissionHandlerArgs args, List<String> newTransmission) { if (!newTransmission.isEmpty()) { GzipTelemetrySerializer serializer = new GzipTelemetrySerializer(); Optional<Transmission> newT = serializer.serializeFromStrings(newTransmission); args.getTransmissionDispatcher().dispatch(newT.get()); return true; } return false; } PartialSuccessHandler(TransmissionPolicyManager policy); @Override void onTransmissionSent(TransmissionHandlerArgs args);  }