You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@commons.apache.org by se...@apache.org on 2015/08/11 12:48:18 UTC
[lang] Split up and simplify tests
Repository: commons-lang
Updated Branches:
refs/heads/master 6849dfc8a -> 68acbc803
Split up and simplify tests
Project: http://git-wip-us.apache.org/repos/asf/commons-lang/repo
Commit: http://git-wip-us.apache.org/repos/asf/commons-lang/commit/68acbc80
Tree: http://git-wip-us.apache.org/repos/asf/commons-lang/tree/68acbc80
Diff: http://git-wip-us.apache.org/repos/asf/commons-lang/diff/68acbc80
Branch: refs/heads/master
Commit: 68acbc803e416a38616bc25505cb88dde81af5ca
Parents: 6849dfc
Author: Sebb <se...@apache.org>
Authored: Tue Aug 11 11:48:14 2015 +0100
Committer: Sebb <se...@apache.org>
Committed: Tue Aug 11 11:48:14 2015 +0100
----------------------------------------------------------------------
.../commons/lang3/CharSequenceUtilsTest.java | 25 ++++++++------------
1 file changed, 10 insertions(+), 15 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/commons-lang/blob/68acbc80/src/test/java/org/apache/commons/lang3/CharSequenceUtilsTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/lang3/CharSequenceUtilsTest.java b/src/test/java/org/apache/commons/lang3/CharSequenceUtilsTest.java
index 8779aa7..176ad72 100644
--- a/src/test/java/org/apache/commons/lang3/CharSequenceUtilsTest.java
+++ b/src/test/java/org/apache/commons/lang3/CharSequenceUtilsTest.java
@@ -61,21 +61,16 @@ public class CharSequenceUtilsTest {
Assert.assertEquals("12", CharSequenceUtils.subSequence("012", 1));
Assert.assertEquals("2", CharSequenceUtils.subSequence("012", 2));
Assert.assertEquals(StringUtils.EMPTY, CharSequenceUtils.subSequence("012", 3));
- //
- // Exception expected
- //
- try {
- Assert.assertEquals(null, CharSequenceUtils.subSequence(StringUtils.EMPTY, -1));
- Assert.fail("Expected " + IndexOutOfBoundsException.class.getName());
- } catch (final IndexOutOfBoundsException e) {
- // Expected
- }
- try {
- Assert.assertEquals(null, CharSequenceUtils.subSequence(StringUtils.EMPTY, 1));
- Assert.fail("Expected " + IndexOutOfBoundsException.class.getName());
- } catch (final IndexOutOfBoundsException e) {
- // Expected
- }
}
+ @Test(expected=IndexOutOfBoundsException.class)
+ public void testSubSequenceNegativeStart() {
+ Assert.assertEquals(null, CharSequenceUtils.subSequence(StringUtils.EMPTY, -1));
+ }
+
+ @Test(expected=IndexOutOfBoundsException.class)
+ public void testSubSequenceTooLong() {
+ Assert.assertEquals(null, CharSequenceUtils.subSequence(StringUtils.EMPTY, 1));
+ }
+
}