commons-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From s...@apache.org
Subject svn commit: r922385 - in /commons/proper/sanselan/trunk/src/test/java/org/apache/sanselan: common/byteSources/ByteSourceImageTest.java formats/bmp/BmpRoundtripTest.java
Date Fri, 12 Mar 2010 18:42:41 GMT
Author: sebb
Date: Fri Mar 12 18:42:40 2010
New Revision: 922385

URL: http://svn.apache.org/viewvc?rev=922385&view=rev
Log:
assertTrue(x != null) => assertNotNull(x)
- simpler, gives better diagnostic, reduces possible NPE warnings

Modified:
    commons/proper/sanselan/trunk/src/test/java/org/apache/sanselan/common/byteSources/ByteSourceImageTest.java
    commons/proper/sanselan/trunk/src/test/java/org/apache/sanselan/formats/bmp/BmpRoundtripTest.java

Modified: commons/proper/sanselan/trunk/src/test/java/org/apache/sanselan/common/byteSources/ByteSourceImageTest.java
URL: http://svn.apache.org/viewvc/commons/proper/sanselan/trunk/src/test/java/org/apache/sanselan/common/byteSources/ByteSourceImageTest.java?rev=922385&r1=922384&r2=922385&view=diff
==============================================================================
--- commons/proper/sanselan/trunk/src/test/java/org/apache/sanselan/common/byteSources/ByteSourceImageTest.java
(original)
+++ commons/proper/sanselan/trunk/src/test/java/org/apache/sanselan/common/byteSources/ByteSourceImageTest.java
Fri Mar 12 18:42:40 2010
@@ -50,10 +50,10 @@ public class ByteSourceImageTest extends
 
 			File imageFile = (File) imageFiles.get(i);
 			Debug.debug("imageFile", imageFile);
-			assertTrue(imageFile != null);
+			assertNotNull(imageFile);
 
 			byte imageFileBytes[] = IOUtils.getFileBytes(imageFile);
-			assertTrue(imageFileBytes != null);
+			assertNotNull(imageFileBytes);
 			assertTrue(imageFileBytes.length == imageFile.length());
 
 			if (imageFile.getName().toLowerCase().endsWith(".ico")
@@ -95,7 +95,7 @@ public class ByteSourceImageTest extends
 			throws IOException, ImageReadException
 	{
 		BufferedImage imageFile = Sanselan.getBufferedImage(file);
-		assertTrue(imageFile != null);
+		assertNotNull(imageFile);
 		assertTrue(imageFile.getWidth() > 0);
 		assertTrue(imageFile.getHeight() > 0);
 		int imageFileWidth = imageFile.getWidth();
@@ -103,7 +103,7 @@ public class ByteSourceImageTest extends
 		imageFile = null;
 
 		BufferedImage imageBytes = Sanselan.getBufferedImage(bytes);
-		assertTrue(imageBytes != null);
+		assertNotNull(imageBytes);
 		assertTrue(imageFileWidth == imageBytes.getWidth());
 		assertTrue(imageFileHeight == imageBytes.getHeight());
 	}
@@ -112,12 +112,12 @@ public class ByteSourceImageTest extends
 			throws IOException, ImageReadException
 	{
 		Dimension imageSizeFile = Sanselan.getImageSize(imageFile);
-		assertTrue(imageSizeFile != null);
+		assertNotNull(imageSizeFile);
 		assertTrue(imageSizeFile.width > 0);
 		assertTrue(imageSizeFile.height > 0);
 
 		Dimension imageSizeBytes = Sanselan.getImageSize(imageFileBytes);
-		assertTrue(imageSizeBytes != null);
+		assertNotNull(imageSizeBytes);
 		assertTrue(imageSizeFile.width == imageSizeBytes.width);
 		assertTrue(imageSizeFile.height == imageSizeBytes.height);
 	}
@@ -127,12 +127,12 @@ public class ByteSourceImageTest extends
 	{
 		// check guessFormat()
 		ImageFormat imageFormatFile = Sanselan.guessFormat(imageFile);
-		assertTrue(imageFormatFile != null);
+		assertNotNull(imageFormatFile);
 		assertTrue(imageFormatFile != ImageFormat.IMAGE_FORMAT_UNKNOWN);
 		// Debug.debug("imageFormatFile", imageFormatFile);
 
 		ImageFormat imageFormatBytes = Sanselan.guessFormat(imageFileBytes);
-		assertTrue(imageFormatBytes != null);
+		assertNotNull(imageFormatBytes);
 		assertTrue(imageFormatBytes != ImageFormat.IMAGE_FORMAT_UNKNOWN);
 		// Debug.debug("imageFormatBytes", imageFormatBytes);
 
@@ -173,8 +173,8 @@ public class ByteSourceImageTest extends
 		ImageInfo imageInfoBytes = Sanselan
 				.getImageInfo(imageFileBytes, params);
 
-		assertTrue(imageInfoFile != null);
-		assertTrue(imageInfoBytes != null);
+		assertNotNull(imageInfoFile);
+		assertNotNull(imageInfoBytes);
 
 		Method methods[] = ImageInfo.class.getMethods();
 		for (int i = 0; i < methods.length; i++)
@@ -200,15 +200,15 @@ public class ByteSourceImageTest extends
 		// match.
 		assertTrue(imageInfoFile.getBitsPerPixel() > 0);
 
-		assertTrue(imageInfoFile.getFormat() != null);
+		assertNotNull(imageInfoFile.getFormat());
 		assertTrue(imageInfoFile.getFormat() != ImageFormat.IMAGE_FORMAT_UNKNOWN);
 
-		assertTrue(imageInfoFile.getFormatName() != null);
+		assertNotNull(imageInfoFile.getFormatName());
 
 		assertTrue(imageInfoFile.getWidth() > 0);
 		assertTrue(imageInfoFile.getHeight() > 0);
 
-		assertTrue(imageInfoFile.getMimeType() != null);
+		assertNotNull(imageInfoFile.getMimeType());
 
 		// TODO: not all adapters count images yet.
 		// assertTrue(imageInfoFile.getNumberOfImages() > 0);

Modified: commons/proper/sanselan/trunk/src/test/java/org/apache/sanselan/formats/bmp/BmpRoundtripTest.java
URL: http://svn.apache.org/viewvc/commons/proper/sanselan/trunk/src/test/java/org/apache/sanselan/formats/bmp/BmpRoundtripTest.java?rev=922385&r1=922384&r2=922385&view=diff
==============================================================================
--- commons/proper/sanselan/trunk/src/test/java/org/apache/sanselan/formats/bmp/BmpRoundtripTest.java
(original)
+++ commons/proper/sanselan/trunk/src/test/java/org/apache/sanselan/formats/bmp/BmpRoundtripTest.java
Fri Mar 12 18:42:40 2010
@@ -166,7 +166,7 @@ public class BmpRoundtripTest extends Bm
 
 		BufferedImage dstImage = Sanselan.getBufferedImage(bytes);
 
-		assertTrue(null != dstImage);
+		assertNotNull(dstImage);
 		assertTrue(srcImage.getWidth() == dstImage.getWidth());
 		assertTrue(srcImage.getHeight() == dstImage.getHeight());
 
@@ -176,8 +176,8 @@ public class BmpRoundtripTest extends Bm
 
 	private void compare(int[][] a, int[][] b)
 	{
-		assertTrue(null != a);
-		assertTrue(null != b);
+		assertNotNull(a);
+		assertNotNull(b);
 		assertTrue(a.length == b.length);
 
 		for (int y = 0; y < a.length; y++)



Mime
View raw message