You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mina.apache.org by ap...@apache.org on 2009/03/16 12:04:02 UTC
svn commit: r754874 -
/mina/trunk/core/src/test/java/org/apache/mina/core/IoBufferTest.java
Author: apaliwal
Date: Mon Mar 16 11:04:01 2009
New Revision: 754874
URL: http://svn.apache.org/viewvc?rev=754874&view=rev
Log:
Removed PMD Report Observations:
Added messages to fail(), added assertTrue to empty catch statements, to signify success of the Test.
Submitted by: Ashish Paliwal (apaliwal.at.apache.org)
Modified:
mina/trunk/core/src/test/java/org/apache/mina/core/IoBufferTest.java
Modified: mina/trunk/core/src/test/java/org/apache/mina/core/IoBufferTest.java
URL: http://svn.apache.org/viewvc/mina/trunk/core/src/test/java/org/apache/mina/core/IoBufferTest.java?rev=754874&r1=754873&r2=754874&view=diff
==============================================================================
--- mina/trunk/core/src/test/java/org/apache/mina/core/IoBufferTest.java (original)
+++ mina/trunk/core/src/test/java/org/apache/mina/core/IoBufferTest.java Mon Mar 16 11:04:01 2009
@@ -84,9 +84,10 @@
buf.put((byte) 0);
try {
buf.put((byte) 0);
- fail();
+ fail("Buffer can't auto expand, with autoExpand property set at false");
} catch (BufferOverflowException e) {
- // ignore
+ // Expected Exception as auto expand property is false
+ assertTrue(true);
}
buf.setAutoExpand(true);
@@ -98,9 +99,10 @@
buf.setAutoExpand(false);
try {
buf.put(3, (byte) 0);
- fail();
+ fail("Buffer can't auto expand, with autoExpand property set at false");
} catch (IndexOutOfBoundsException e) {
- // ignore
+ // Expected Exception as auto expand property is false
+ assertTrue(true);
}
buf.setAutoExpand(true);
@@ -306,7 +308,8 @@
buf.getString(1, decoder);
fail();
} catch (IllegalArgumentException e) {
- // ignore
+ // Expected an Exception, signifies test success
+ assertTrue(true);
}
// Test getting strings from an empty buffer.
@@ -458,7 +461,8 @@
buf.putPrefixedString("123456789012345", encoder);
fail();
} catch (BufferOverflowException e) {
- // OK
+ // Expected an Exception, signifies test success
+ assertTrue(true);
}
// With autoExpand
@@ -705,16 +709,18 @@
try {
original.setAutoExpand(true);
- fail();
+ fail("Derived buffers and their parent can't be expanded");
} catch (IllegalStateException e) {
- // OK
+ // Expected an Exception, signifies test success
+ assertTrue(true);
}
try {
duplicate.setAutoExpand(true);
- fail();
+ fail("Derived buffers and their parent can't be expanded");
} catch (IllegalStateException e) {
- // OK
+ // Expected an Exception, signifies test success
+ assertTrue(true);
}
}
@@ -759,9 +765,10 @@
duplicate = original.asReadOnlyBuffer();
duplicate.putString("A very very very very looooooong string",
Charset.forName("ISO-8859-1").newEncoder());
- fail();
+ fail("ReadOnly buffer's can't be expanded");
} catch (ReadOnlyBufferException e) {
- // OK
+ // Expected an Exception, signifies test success
+ assertTrue(true);
}
}
@@ -1016,28 +1023,32 @@
buf.putEnumSet(EnumSet.of(TestEnum.E9));
fail("Should have thrown IllegalArgumentException");
} catch (IllegalArgumentException e) {
- // pass
+ // Expected an Exception, signifies test success
+ assertTrue(true);
}
try {
buf.putEnumSetShort(EnumSet.of(TestEnum.E17));
fail("Should have thrown IllegalArgumentException");
} catch (IllegalArgumentException e) {
- // pass
+ // Expected an Exception, signifies test success
+ assertTrue(true);
}
try {
buf.putEnumSetInt(EnumSet.of(TestEnum.E33));
fail("Should have thrown IllegalArgumentException");
} catch (IllegalArgumentException e) {
- // pass
+ // Expected an Exception, signifies test success
+ assertTrue(true);
}
try {
buf.putEnumSetLong(EnumSet.of(TooBigEnum.E65));
fail("Should have thrown IllegalArgumentException");
} catch (IllegalArgumentException e) {
- // pass
+ // Expected an Exception, signifies test success
+ assertTrue(true);
}
}