YoloProcessor extends NeuralNetUtils implements NeuralNetInterface2 { @Override public NeuralNetResults processImage(byte[] image) throws ImageProcessingException { log.debug("Deprecated method, should no longer be used."); return processImage(null, image); }  @Override void setupImageProcessing(Map<String, ?> neuralNetConfig, String sourceName, String modelDirectory, String authToken, String server); @Override NeuralNetResults processImage(byte[] image); @Override NeuralNetResults processImage(byte[] image,  Map<String, ?> request); @Override NeuralNetResults processImage(Map<String, ?> processingParams, byte[] image); @Override NeuralNetResults processImage(Map<String, ?> processingParams, byte[] image, Map<String, ?> request); @Override void close();  }
@Test public void testInvalidData() { byte[] invalidImage = {123, 012, 45, -3, -102}; try { ypJson.processImage(invalidImage); fail("Should throw Exception when not a jpeg"); } catch (ImageProcessingException e) { assertTrue("Failure should be caused by invalid image type. Error actually was: " + e.getMessage() , e.getMessage().startsWith(YoloProcessor.class.getCanonicalName() + ".invalidImage")); } try { ypJson.processImage(invalidImage); fail("Should throw Exception when not a jpeg"); } catch (ImageProcessingException e) { assertTrue("Failure should be caused by invalid image type. Error actually was: " + e.getMessage() , e.getMessage().startsWith(YoloProcessor.class.getCanonicalName() + ".invalidImage")); } }