@Test
public void testAsWritable() throws Exception {

    File f0 = new ClassPathResource("/testimages/class0/0.jpg").getFile();
    NativeImageLoader imageLoader = new NativeImageLoader();
    ImageWritable img = imageLoader.asWritable(f0);
    assertEquals(32, img.getFrame().imageHeight);
    assertEquals(32, img.getFrame().imageWidth);
    assertEquals(3, img.getFrame().imageChannels);
    BufferedImage img1 = makeRandomBufferedImage(0, 0, 3);
    Mat img2 = makeRandomImage(0, 0, 4);
    int w1 = 33, h1 = 77, ch1 = 1;
    NativeImageLoader loader1 = new NativeImageLoader(h1, w1, ch1);
    INDArray array1 = loader1.asMatrix(f0);
    assertEquals(4, array1.rank());
    assertEquals(1, array1.size(0));
    assertEquals(1, array1.size(1));
    assertEquals(h1, array1.size(2));
    assertEquals(w1, array1.size(3));
}