java: test: use assertNotNull and assertFalse

This commit is contained in:
Ahmed Ashour
2019-05-24 10:45:09 +02:00
parent 1810702bf0
commit f9564e053d
9 changed files with 30 additions and 30 deletions
@@ -581,7 +581,7 @@ public class OpenCVTestCase extends TestCase {
message = TAG + " :: " + "could not instantiate " + cname + "! Exception: " + ex.getMessage();
}
assertTrue(message, instance!=null);
assertNotNull(message, instance);
return instance;
}
@@ -96,7 +96,7 @@ public class OpenCVTestRunner extends InstrumentationTestRunner {
}
context = getContext();
Assert.assertTrue("Context can't be 'null'", context != null);
Assert.assertNotNull("Context can't be 'null'", context);
LENA_PATH = Utils.exportResource(context, R.drawable.lena);
CHESS_PATH = Utils.exportResource(context, R.drawable.chessboard);
LBPCASCADE_FRONTALFACE_PATH = Utils.exportResource(context, R.raw.lbpcascade_frontalface);
@@ -74,7 +74,7 @@ public class UtilsTest extends OpenCVTestCase {
// RGBA
Mat imgRGBA = new Mat();
Imgproc.cvtColor(imgBGR, imgRGBA, Imgproc.COLOR_BGR2RGBA);
assertTrue(!imgRGBA.empty() && imgRGBA.channels() == 4);
assertFalse(imgRGBA.empty() && imgRGBA.channels() == 4);
bmp16.eraseColor(Color.BLACK); m16.setTo(s0);
Utils.matToBitmap(imgRGBA, bmp16); Utils.bitmapToMat(bmp16, m16);
@@ -92,7 +92,7 @@ public class UtilsTest extends OpenCVTestCase {
// RGB
Mat imgRGB = new Mat();
Imgproc.cvtColor(imgBGR, imgRGB, Imgproc.COLOR_BGR2RGB);
assertTrue(!imgRGB.empty() && imgRGB.channels() == 3);
assertFalse(imgRGB.empty() && imgRGB.channels() == 3);
bmp16.eraseColor(Color.BLACK); m16.setTo(s0);
Utils.matToBitmap(imgRGB, bmp16); Utils.bitmapToMat(bmp16, m16);
@@ -110,7 +110,7 @@ public class UtilsTest extends OpenCVTestCase {
// Gray
Mat imgGray = new Mat();
Imgproc.cvtColor(imgBGR, imgGray, Imgproc.COLOR_BGR2GRAY);
assertTrue(!imgGray.empty() && imgGray.channels() == 1);
assertFalse(imgGray.empty() && imgGray.channels() == 1);
Mat tmp = new Mat();
bmp16.eraseColor(Color.BLACK); m16.setTo(s0);