You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@commons.apache.org by gg...@apache.org on 2013/01/22 08:09:49 UTC
svn commit: r1436770 [14/16] - in /commons/proper/lang/trunk/src:
main/java/org/apache/commons/lang3/
main/java/org/apache/commons/lang3/builder/
main/java/org/apache/commons/lang3/concurrent/
main/java/org/apache/commons/lang3/event/ main/java/org/apa...
Modified: commons/proper/lang/trunk/src/test/java/org/apache/commons/lang3/text/StrSubstitutorTest.java
URL: http://svn.apache.org/viewvc/commons/proper/lang/trunk/src/test/java/org/apache/commons/lang3/text/StrSubstitutorTest.java?rev=1436770&r1=1436769&r2=1436770&view=diff
==============================================================================
--- commons/proper/lang/trunk/src/test/java/org/apache/commons/lang3/text/StrSubstitutorTest.java (original)
+++ commons/proper/lang/trunk/src/test/java/org/apache/commons/lang3/text/StrSubstitutorTest.java Tue Jan 22 07:09:45 2013
@@ -94,7 +94,7 @@ public class StrSubstitutorTest {
*/
@Test
public void testReplaceChangedMap() {
- StrSubstitutor sub = new StrSubstitutor(values);
+ final StrSubstitutor sub = new StrSubstitutor(values);
values.put("target", "moon");
assertEquals("The quick brown fox jumps over the moon.", sub.replace("The ${animal} jumps over the ${target}."));
}
@@ -114,7 +114,7 @@ public class StrSubstitutorTest {
public void testReplaceAdjacentAtStart() {
values.put("code", "GBP");
values.put("amount", "12.50");
- StrSubstitutor sub = new StrSubstitutor(values);
+ final StrSubstitutor sub = new StrSubstitutor(values);
assertEquals("GBP12.50 charged", sub.replace("${code}${amount} charged"));
}
@@ -125,7 +125,7 @@ public class StrSubstitutorTest {
public void testReplaceAdjacentAtEnd() {
values.put("code", "GBP");
values.put("amount", "12.50");
- StrSubstitutor sub = new StrSubstitutor(values);
+ final StrSubstitutor sub = new StrSubstitutor(values);
assertEquals("Amount is GBP12.50", sub.replace("Amount is ${code}${amount}"));
}
@@ -225,7 +225,7 @@ public class StrSubstitutorTest {
*/
@Test
public void testCyclicReplacement() {
- Map<String, String> map = new HashMap<String, String>();
+ final Map<String, String> map = new HashMap<String, String>();
map.put("animal", "${critter}");
map.put("target", "${pet}");
map.put("pet", "${petCharacteristic} dog");
@@ -234,11 +234,11 @@ public class StrSubstitutorTest {
map.put("critterSpeed", "quick");
map.put("critterColor", "brown");
map.put("critterType", "${animal}");
- StrSubstitutor sub = new StrSubstitutor(map);
+ final StrSubstitutor sub = new StrSubstitutor(map);
try {
sub.replace("The ${animal} jumps over the ${target}.");
fail("Cyclic replacement was not detected!");
- } catch (IllegalStateException ex) {
+ } catch (final IllegalStateException ex) {
// expected
}
}
@@ -272,7 +272,7 @@ public class StrSubstitutorTest {
*/
@Test
public void testReplacePartialString_noReplace() {
- StrSubstitutor sub = new StrSubstitutor();
+ final StrSubstitutor sub = new StrSubstitutor();
assertEquals("${animal} jumps", sub.replace("The ${animal} jumps over the ${target}.", 4, 15));
}
@@ -284,7 +284,7 @@ public class StrSubstitutorTest {
values.put("animal.1", "fox");
values.put("animal.2", "mouse");
values.put("species", "2");
- StrSubstitutor sub = new StrSubstitutor(values);
+ final StrSubstitutor sub = new StrSubstitutor(values);
sub.setEnableSubstitutionInVariables(true);
assertEquals(
"Wrong result (1)",
@@ -305,7 +305,7 @@ public class StrSubstitutorTest {
values.put("animal.1", "fox");
values.put("animal.2", "mouse");
values.put("species", "2");
- StrSubstitutor sub = new StrSubstitutor(values);
+ final StrSubstitutor sub = new StrSubstitutor(values);
assertEquals(
"Wrong result",
"The ${animal.${species}} jumps over the lazy dog.",
@@ -322,7 +322,7 @@ public class StrSubstitutorTest {
values.put("color", "white");
values.put("species.white", "1");
values.put("species.brown", "2");
- StrSubstitutor sub = new StrSubstitutor(values);
+ final StrSubstitutor sub = new StrSubstitutor(values);
sub.setEnableSubstitutionInVariables(true);
assertEquals(
"Wrong result",
@@ -337,9 +337,9 @@ public class StrSubstitutorTest {
@Test
public void testResolveVariable() {
final StrBuilder builder = new StrBuilder("Hi ${name}!");
- Map<String, String> map = new HashMap<String, String>();
+ final Map<String, String> map = new HashMap<String, String>();
map.put("name", "commons");
- StrSubstitutor sub = new StrSubstitutor(map) {
+ final StrSubstitutor sub = new StrSubstitutor(map) {
@Override
protected String resolveVariable(final String variableName, final StrBuilder buf, final int startPos, final int endPos) {
assertEquals("name", variableName);
@@ -359,7 +359,7 @@ public class StrSubstitutorTest {
*/
@Test
public void testConstructorNoArgs() {
- StrSubstitutor sub = new StrSubstitutor();
+ final StrSubstitutor sub = new StrSubstitutor();
assertEquals("Hi ${name}", sub.replace("Hi ${name}"));
}
@@ -368,9 +368,9 @@ public class StrSubstitutorTest {
*/
@Test
public void testConstructorMapPrefixSuffix() {
- Map<String, String> map = new HashMap<String, String>();
+ final Map<String, String> map = new HashMap<String, String>();
map.put("name", "commons");
- StrSubstitutor sub = new StrSubstitutor(map, "<", ">");
+ final StrSubstitutor sub = new StrSubstitutor(map, "<", ">");
assertEquals("Hi < commons", sub.replace("Hi $< <name>"));
}
@@ -379,9 +379,9 @@ public class StrSubstitutorTest {
*/
@Test
public void testConstructorMapFull() {
- Map<String, String> map = new HashMap<String, String>();
+ final Map<String, String> map = new HashMap<String, String>();
map.put("name", "commons");
- StrSubstitutor sub = new StrSubstitutor(map, "<", ">", '!');
+ final StrSubstitutor sub = new StrSubstitutor(map, "<", ">", '!');
assertEquals("Hi < commons", sub.replace("Hi !< <name>"));
}
@@ -391,7 +391,7 @@ public class StrSubstitutorTest {
*/
@Test
public void testGetSetEscape() {
- StrSubstitutor sub = new StrSubstitutor();
+ final StrSubstitutor sub = new StrSubstitutor();
assertEquals('$', sub.getEscapeChar());
sub.setEscapeChar('<');
assertEquals('<', sub.getEscapeChar());
@@ -402,7 +402,7 @@ public class StrSubstitutorTest {
*/
@Test
public void testGetSetPrefix() {
- StrSubstitutor sub = new StrSubstitutor();
+ final StrSubstitutor sub = new StrSubstitutor();
assertTrue(sub.getVariablePrefixMatcher() instanceof StrMatcher.StringMatcher);
sub.setVariablePrefix('<');
assertTrue(sub.getVariablePrefixMatcher() instanceof StrMatcher.CharMatcher);
@@ -412,18 +412,18 @@ public class StrSubstitutorTest {
try {
sub.setVariablePrefix((String) null);
fail();
- } catch (IllegalArgumentException ex) {
+ } catch (final IllegalArgumentException ex) {
// expected
}
assertTrue(sub.getVariablePrefixMatcher() instanceof StrMatcher.StringMatcher);
- StrMatcher matcher = StrMatcher.commaMatcher();
+ final StrMatcher matcher = StrMatcher.commaMatcher();
sub.setVariablePrefixMatcher(matcher);
assertSame(matcher, sub.getVariablePrefixMatcher());
try {
sub.setVariablePrefixMatcher((StrMatcher) null);
fail();
- } catch (IllegalArgumentException ex) {
+ } catch (final IllegalArgumentException ex) {
// expected
}
assertSame(matcher, sub.getVariablePrefixMatcher());
@@ -434,7 +434,7 @@ public class StrSubstitutorTest {
*/
@Test
public void testGetSetSuffix() {
- StrSubstitutor sub = new StrSubstitutor();
+ final StrSubstitutor sub = new StrSubstitutor();
assertTrue(sub.getVariableSuffixMatcher() instanceof StrMatcher.StringMatcher);
sub.setVariableSuffix('<');
assertTrue(sub.getVariableSuffixMatcher() instanceof StrMatcher.CharMatcher);
@@ -444,18 +444,18 @@ public class StrSubstitutorTest {
try {
sub.setVariableSuffix((String) null);
fail();
- } catch (IllegalArgumentException ex) {
+ } catch (final IllegalArgumentException ex) {
// expected
}
assertTrue(sub.getVariableSuffixMatcher() instanceof StrMatcher.StringMatcher);
- StrMatcher matcher = StrMatcher.commaMatcher();
+ final StrMatcher matcher = StrMatcher.commaMatcher();
sub.setVariableSuffixMatcher(matcher);
assertSame(matcher, sub.getVariableSuffixMatcher());
try {
sub.setVariableSuffixMatcher((StrMatcher) null);
fail();
- } catch (IllegalArgumentException ex) {
+ } catch (final IllegalArgumentException ex) {
// expected
}
assertSame(matcher, sub.getVariableSuffixMatcher());
@@ -467,7 +467,7 @@ public class StrSubstitutorTest {
*/
@Test
public void testStaticReplace() {
- Map<String, String> map = new HashMap<String, String>();
+ final Map<String, String> map = new HashMap<String, String>();
map.put("name", "commons");
assertEquals("Hi commons!", StrSubstitutor.replace("Hi ${name}!", map));
}
@@ -477,7 +477,7 @@ public class StrSubstitutorTest {
*/
@Test
public void testStaticReplacePrefixSuffix() {
- Map<String, String> map = new HashMap<String, String>();
+ final Map<String, String> map = new HashMap<String, String>();
map.put("name", "commons");
assertEquals("Hi commons!", StrSubstitutor.replace("Hi <name>!", map, "<", ">"));
}
@@ -487,7 +487,7 @@ public class StrSubstitutorTest {
*/
@Test
public void testStaticReplaceSystemProperties() {
- StrBuilder buf = new StrBuilder();
+ final StrBuilder buf = new StrBuilder();
buf.append("Hi ").append(System.getProperty("user.name"));
buf.append(", you are working with ");
buf.append(System.getProperty("os.name"));
@@ -503,18 +503,18 @@ public class StrSubstitutorTest {
*/
@Test
public void testSubstituteDefaultProperties(){
- String org = "${doesnotwork}";
+ final String org = "${doesnotwork}";
System.setProperty("doesnotwork", "It works!");
// create a new Properties object with the System.getProperties as default
- Properties props = new Properties(System.getProperties());
+ final Properties props = new Properties(System.getProperties());
assertEquals("It works!", StrSubstitutor.replace(org, props));
}
@Test
public void testSamePrefixAndSuffix() {
- Map<String, String> map = new HashMap<String, String>();
+ final Map<String, String> map = new HashMap<String, String>();
map.put("greeting", "Hello");
map.put(" there ", "XXX");
map.put("name", "commons");
@@ -524,8 +524,8 @@ public class StrSubstitutorTest {
//-----------------------------------------------------------------------
private void doTestReplace(final String expectedResult, final String replaceTemplate, final boolean substring) {
- String expectedShortResult = expectedResult.substring(1, expectedResult.length() - 1);
- StrSubstitutor sub = new StrSubstitutor(values);
+ final String expectedShortResult = expectedResult.substring(1, expectedResult.length() - 1);
+ final StrSubstitutor sub = new StrSubstitutor(values);
// replace using String
assertEquals(expectedResult, sub.replace(replaceTemplate));
@@ -534,7 +534,7 @@ public class StrSubstitutorTest {
}
// replace using char[]
- char[] chars = replaceTemplate.toCharArray();
+ final char[] chars = replaceTemplate.toCharArray();
assertEquals(expectedResult, sub.replace(chars));
if (substring) {
assertEquals(expectedShortResult, sub.replace(chars, 1, chars.length - 2));
@@ -555,7 +555,7 @@ public class StrSubstitutorTest {
}
// replace using object
- MutableObject<String> obj = new MutableObject<String>(replaceTemplate); // toString returns template
+ final MutableObject<String> obj = new MutableObject<String>(replaceTemplate); // toString returns template
assertEquals(expectedResult, sub.replace(obj));
// replace in StringBuffer
@@ -580,7 +580,7 @@ public class StrSubstitutorTest {
}
private void doTestNoReplace(final String replaceTemplate) {
- StrSubstitutor sub = new StrSubstitutor(values);
+ final StrSubstitutor sub = new StrSubstitutor(values);
if (replaceTemplate == null) {
assertEquals(null, sub.replace((String) null));
@@ -598,7 +598,7 @@ public class StrSubstitutorTest {
assertFalse(sub.replaceIn((StrBuilder) null, 0, 100));
} else {
assertEquals(replaceTemplate, sub.replace(replaceTemplate));
- StrBuilder bld = new StrBuilder(replaceTemplate);
+ final StrBuilder bld = new StrBuilder(replaceTemplate);
assertFalse(sub.replaceIn(bld));
assertEquals(replaceTemplate, bld.toString());
}
Modified: commons/proper/lang/trunk/src/test/java/org/apache/commons/lang3/text/StrTokenizerTest.java
URL: http://svn.apache.org/viewvc/commons/proper/lang/trunk/src/test/java/org/apache/commons/lang3/text/StrTokenizerTest.java?rev=1436770&r1=1436769&r2=1436770&view=diff
==============================================================================
--- commons/proper/lang/trunk/src/test/java/org/apache/commons/lang3/text/StrTokenizerTest.java (original)
+++ commons/proper/lang/trunk/src/test/java/org/apache/commons/lang3/text/StrTokenizerTest.java Tue Jan 22 07:09:45 2013
@@ -46,15 +46,15 @@ public class StrTokenizerTest {
@Test
public void test1() {
- String input = "a;b;c;\"d;\"\"e\";f; ; ; ";
- StrTokenizer tok = new StrTokenizer(input);
+ final String input = "a;b;c;\"d;\"\"e\";f; ; ; ";
+ final StrTokenizer tok = new StrTokenizer(input);
tok.setDelimiterChar(';');
tok.setQuoteChar('"');
tok.setIgnoredMatcher(StrMatcher.trimMatcher());
tok.setIgnoreEmptyTokens(false);
- String tokens[] = tok.getTokenArray();
+ final String tokens[] = tok.getTokenArray();
- String expected[] = new String[]{"a", "b", "c", "d;\"e", "f", "", "", "",};
+ final String expected[] = new String[]{"a", "b", "c", "d;\"e", "f", "", "", "",};
assertEquals(ArrayUtils.toString(tokens), expected.length, tokens.length);
for (int i = 0; i < expected.length; i++) {
@@ -67,15 +67,15 @@ public class StrTokenizerTest {
@Test
public void test2() {
- String input = "a;b;c ;\"d;\"\"e\";f; ; ;";
- StrTokenizer tok = new StrTokenizer(input);
+ final String input = "a;b;c ;\"d;\"\"e\";f; ; ;";
+ final StrTokenizer tok = new StrTokenizer(input);
tok.setDelimiterChar(';');
tok.setQuoteChar('"');
tok.setIgnoredMatcher(StrMatcher.noneMatcher());
tok.setIgnoreEmptyTokens(false);
- String tokens[] = tok.getTokenArray();
+ final String tokens[] = tok.getTokenArray();
- String expected[] = new String[]{"a", "b", "c ", "d;\"e", "f", " ", " ", "",};
+ final String expected[] = new String[]{"a", "b", "c ", "d;\"e", "f", " ", " ", "",};
assertEquals(ArrayUtils.toString(tokens), expected.length, tokens.length);
for (int i = 0; i < expected.length; i++) {
@@ -88,15 +88,15 @@ public class StrTokenizerTest {
@Test
public void test3() {
- String input = "a;b; c;\"d;\"\"e\";f; ; ;";
- StrTokenizer tok = new StrTokenizer(input);
+ final String input = "a;b; c;\"d;\"\"e\";f; ; ;";
+ final StrTokenizer tok = new StrTokenizer(input);
tok.setDelimiterChar(';');
tok.setQuoteChar('"');
tok.setIgnoredMatcher(StrMatcher.noneMatcher());
tok.setIgnoreEmptyTokens(false);
- String tokens[] = tok.getTokenArray();
+ final String tokens[] = tok.getTokenArray();
- String expected[] = new String[]{"a", "b", " c", "d;\"e", "f", " ", " ", "",};
+ final String expected[] = new String[]{"a", "b", " c", "d;\"e", "f", " ", " ", "",};
assertEquals(ArrayUtils.toString(tokens), expected.length, tokens.length);
for (int i = 0; i < expected.length; i++) {
@@ -109,15 +109,15 @@ public class StrTokenizerTest {
@Test
public void test4() {
- String input = "a;b; c;\"d;\"\"e\";f; ; ;";
- StrTokenizer tok = new StrTokenizer(input);
+ final String input = "a;b; c;\"d;\"\"e\";f; ; ;";
+ final StrTokenizer tok = new StrTokenizer(input);
tok.setDelimiterChar(';');
tok.setQuoteChar('"');
tok.setIgnoredMatcher(StrMatcher.trimMatcher());
tok.setIgnoreEmptyTokens(true);
- String tokens[] = tok.getTokenArray();
+ final String tokens[] = tok.getTokenArray();
- String expected[] = new String[]{"a", "b", "c", "d;\"e", "f",};
+ final String expected[] = new String[]{"a", "b", "c", "d;\"e", "f",};
assertEquals(ArrayUtils.toString(tokens), expected.length, tokens.length);
for (int i = 0; i < expected.length; i++) {
@@ -130,16 +130,16 @@ public class StrTokenizerTest {
@Test
public void test5() {
- String input = "a;b; c;\"d;\"\"e\";f; ; ;";
- StrTokenizer tok = new StrTokenizer(input);
+ final String input = "a;b; c;\"d;\"\"e\";f; ; ;";
+ final StrTokenizer tok = new StrTokenizer(input);
tok.setDelimiterChar(';');
tok.setQuoteChar('"');
tok.setIgnoredMatcher(StrMatcher.trimMatcher());
tok.setIgnoreEmptyTokens(false);
tok.setEmptyTokenAsNull(true);
- String tokens[] = tok.getTokenArray();
+ final String tokens[] = tok.getTokenArray();
- String expected[] = new String[]{"a", "b", "c", "d;\"e", "f", null, null, null,};
+ final String expected[] = new String[]{"a", "b", "c", "d;\"e", "f", null, null, null,};
assertEquals(ArrayUtils.toString(tokens), expected.length, tokens.length);
for (int i = 0; i < expected.length; i++) {
@@ -152,16 +152,16 @@ public class StrTokenizerTest {
@Test
public void test6() {
- String input = "a;b; c;\"d;\"\"e\";f; ; ;";
- StrTokenizer tok = new StrTokenizer(input);
+ final String input = "a;b; c;\"d;\"\"e\";f; ; ;";
+ final StrTokenizer tok = new StrTokenizer(input);
tok.setDelimiterChar(';');
tok.setQuoteChar('"');
tok.setIgnoredMatcher(StrMatcher.trimMatcher());
tok.setIgnoreEmptyTokens(false);
// tok.setTreatingEmptyAsNull(true);
- String tokens[] = tok.getTokenArray();
+ final String tokens[] = tok.getTokenArray();
- String expected[] = new String[]{"a", "b", " c", "d;\"e", "f", null, null, null,};
+ final String expected[] = new String[]{"a", "b", " c", "d;\"e", "f", null, null, null,};
int nextCount = 0;
while (tok.hasNext()) {
@@ -188,15 +188,15 @@ public class StrTokenizerTest {
@Test
public void test7() {
- String input = "a b c \"d e\" f ";
- StrTokenizer tok = new StrTokenizer(input);
+ final String input = "a b c \"d e\" f ";
+ final StrTokenizer tok = new StrTokenizer(input);
tok.setDelimiterMatcher(StrMatcher.spaceMatcher());
tok.setQuoteMatcher(StrMatcher.doubleQuoteMatcher());
tok.setIgnoredMatcher(StrMatcher.noneMatcher());
tok.setIgnoreEmptyTokens(false);
- String tokens[] = tok.getTokenArray();
+ final String tokens[] = tok.getTokenArray();
- String expected[] = new String[]{"a", "", "", "b", "c", "d e", "f", "",};
+ final String expected[] = new String[]{"a", "", "", "b", "c", "d e", "f", "",};
assertEquals(ArrayUtils.toString(tokens), expected.length, tokens.length);
for (int i = 0; i < expected.length; i++) {
@@ -209,15 +209,15 @@ public class StrTokenizerTest {
@Test
public void test8() {
- String input = "a b c \"d e\" f ";
- StrTokenizer tok = new StrTokenizer(input);
+ final String input = "a b c \"d e\" f ";
+ final StrTokenizer tok = new StrTokenizer(input);
tok.setDelimiterMatcher(StrMatcher.spaceMatcher());
tok.setQuoteMatcher(StrMatcher.doubleQuoteMatcher());
tok.setIgnoredMatcher(StrMatcher.noneMatcher());
tok.setIgnoreEmptyTokens(true);
- String tokens[] = tok.getTokenArray();
+ final String tokens[] = tok.getTokenArray();
- String expected[] = new String[]{"a", "b", "c", "d e", "f",};
+ final String expected[] = new String[]{"a", "b", "c", "d e", "f",};
assertEquals(ArrayUtils.toString(tokens), expected.length, tokens.length);
for (int i = 0; i < expected.length; i++) {
@@ -229,8 +229,8 @@ public class StrTokenizerTest {
@Test
public void testBasic1() {
- String input = "a b c";
- StrTokenizer tok = new StrTokenizer(input);
+ final String input = "a b c";
+ final StrTokenizer tok = new StrTokenizer(input);
assertEquals("a", tok.next());
assertEquals("b", tok.next());
assertEquals("c", tok.next());
@@ -239,8 +239,8 @@ public class StrTokenizerTest {
@Test
public void testBasic2() {
- String input = "a \nb\fc";
- StrTokenizer tok = new StrTokenizer(input);
+ final String input = "a \nb\fc";
+ final StrTokenizer tok = new StrTokenizer(input);
assertEquals("a", tok.next());
assertEquals("b", tok.next());
assertEquals("c", tok.next());
@@ -249,8 +249,8 @@ public class StrTokenizerTest {
@Test
public void testBasic3() {
- String input = "a \nb\u0001\fc";
- StrTokenizer tok = new StrTokenizer(input);
+ final String input = "a \nb\u0001\fc";
+ final StrTokenizer tok = new StrTokenizer(input);
assertEquals("a", tok.next());
assertEquals("b\u0001", tok.next());
assertEquals("c", tok.next());
@@ -259,8 +259,8 @@ public class StrTokenizerTest {
@Test
public void testBasic4() {
- String input = "a \"b\" c";
- StrTokenizer tok = new StrTokenizer(input);
+ final String input = "a \"b\" c";
+ final StrTokenizer tok = new StrTokenizer(input);
assertEquals("a", tok.next());
assertEquals("\"b\"", tok.next());
assertEquals("c", tok.next());
@@ -269,8 +269,8 @@ public class StrTokenizerTest {
@Test
public void testBasic5() {
- String input = "a:b':c";
- StrTokenizer tok = new StrTokenizer(input, ':', '\'');
+ final String input = "a:b':c";
+ final StrTokenizer tok = new StrTokenizer(input, ':', '\'');
assertEquals("a", tok.next());
assertEquals("b'", tok.next());
assertEquals("c", tok.next());
@@ -279,8 +279,8 @@ public class StrTokenizerTest {
@Test
public void testBasicDelim1() {
- String input = "a:b:c";
- StrTokenizer tok = new StrTokenizer(input, ':');
+ final String input = "a:b:c";
+ final StrTokenizer tok = new StrTokenizer(input, ':');
assertEquals("a", tok.next());
assertEquals("b", tok.next());
assertEquals("c", tok.next());
@@ -289,16 +289,16 @@ public class StrTokenizerTest {
@Test
public void testBasicDelim2() {
- String input = "a:b:c";
- StrTokenizer tok = new StrTokenizer(input, ',');
+ final String input = "a:b:c";
+ final StrTokenizer tok = new StrTokenizer(input, ',');
assertEquals("a:b:c", tok.next());
assertFalse(tok.hasNext());
}
@Test
public void testBasicEmpty1() {
- String input = "a b c";
- StrTokenizer tok = new StrTokenizer(input);
+ final String input = "a b c";
+ final StrTokenizer tok = new StrTokenizer(input);
tok.setIgnoreEmptyTokens(false);
assertEquals("a", tok.next());
assertEquals("", tok.next());
@@ -309,8 +309,8 @@ public class StrTokenizerTest {
@Test
public void testBasicEmpty2() {
- String input = "a b c";
- StrTokenizer tok = new StrTokenizer(input);
+ final String input = "a b c";
+ final StrTokenizer tok = new StrTokenizer(input);
tok.setIgnoreEmptyTokens(false);
tok.setEmptyTokenAsNull(true);
assertEquals("a", tok.next());
@@ -322,8 +322,8 @@ public class StrTokenizerTest {
@Test
public void testBasicQuoted1() {
- String input = "a 'b' c";
- StrTokenizer tok = new StrTokenizer(input, ' ', '\'');
+ final String input = "a 'b' c";
+ final StrTokenizer tok = new StrTokenizer(input, ' ', '\'');
assertEquals("a", tok.next());
assertEquals("b", tok.next());
assertEquals("c", tok.next());
@@ -332,8 +332,8 @@ public class StrTokenizerTest {
@Test
public void testBasicQuoted2() {
- String input = "a:'b':";
- StrTokenizer tok = new StrTokenizer(input, ':', '\'');
+ final String input = "a:'b':";
+ final StrTokenizer tok = new StrTokenizer(input, ':', '\'');
tok.setIgnoreEmptyTokens(false);
tok.setEmptyTokenAsNull(true);
assertEquals("a", tok.next());
@@ -344,8 +344,8 @@ public class StrTokenizerTest {
@Test
public void testBasicQuoted3() {
- String input = "a:'b''c'";
- StrTokenizer tok = new StrTokenizer(input, ':', '\'');
+ final String input = "a:'b''c'";
+ final StrTokenizer tok = new StrTokenizer(input, ':', '\'');
tok.setIgnoreEmptyTokens(false);
tok.setEmptyTokenAsNull(true);
assertEquals("a", tok.next());
@@ -355,8 +355,8 @@ public class StrTokenizerTest {
@Test
public void testBasicQuoted4() {
- String input = "a: 'b' 'c' :d";
- StrTokenizer tok = new StrTokenizer(input, ':', '\'');
+ final String input = "a: 'b' 'c' :d";
+ final StrTokenizer tok = new StrTokenizer(input, ':', '\'');
tok.setTrimmerMatcher(StrMatcher.trimMatcher());
tok.setIgnoreEmptyTokens(false);
tok.setEmptyTokenAsNull(true);
@@ -368,8 +368,8 @@ public class StrTokenizerTest {
@Test
public void testBasicQuoted5() {
- String input = "a: 'b'x'c' :d";
- StrTokenizer tok = new StrTokenizer(input, ':', '\'');
+ final String input = "a: 'b'x'c' :d";
+ final StrTokenizer tok = new StrTokenizer(input, ':', '\'');
tok.setTrimmerMatcher(StrMatcher.trimMatcher());
tok.setIgnoreEmptyTokens(false);
tok.setEmptyTokenAsNull(true);
@@ -381,8 +381,8 @@ public class StrTokenizerTest {
@Test
public void testBasicQuoted6() {
- String input = "a:'b'\"c':d";
- StrTokenizer tok = new StrTokenizer(input, ':');
+ final String input = "a:'b'\"c':d";
+ final StrTokenizer tok = new StrTokenizer(input, ':');
tok.setQuoteMatcher(StrMatcher.quoteMatcher());
assertEquals("a", tok.next());
assertEquals("b\"c:d", tok.next());
@@ -391,8 +391,8 @@ public class StrTokenizerTest {
@Test
public void testBasicQuoted7() {
- String input = "a:\"There's a reason here\":b";
- StrTokenizer tok = new StrTokenizer(input, ':');
+ final String input = "a:\"There's a reason here\":b";
+ final StrTokenizer tok = new StrTokenizer(input, ':');
tok.setQuoteMatcher(StrMatcher.quoteMatcher());
assertEquals("a", tok.next());
assertEquals("There's a reason here", tok.next());
@@ -402,8 +402,8 @@ public class StrTokenizerTest {
@Test
public void testBasicQuotedTrimmed1() {
- String input = "a: 'b' :";
- StrTokenizer tok = new StrTokenizer(input, ':', '\'');
+ final String input = "a: 'b' :";
+ final StrTokenizer tok = new StrTokenizer(input, ':', '\'');
tok.setTrimmerMatcher(StrMatcher.trimMatcher());
tok.setIgnoreEmptyTokens(false);
tok.setEmptyTokenAsNull(true);
@@ -415,8 +415,8 @@ public class StrTokenizerTest {
@Test
public void testBasicTrimmed1() {
- String input = "a: b : ";
- StrTokenizer tok = new StrTokenizer(input, ':');
+ final String input = "a: b : ";
+ final StrTokenizer tok = new StrTokenizer(input, ':');
tok.setTrimmerMatcher(StrMatcher.trimMatcher());
tok.setIgnoreEmptyTokens(false);
tok.setEmptyTokenAsNull(true);
@@ -428,8 +428,8 @@ public class StrTokenizerTest {
@Test
public void testBasicTrimmed2() {
- String input = "a: b :";
- StrTokenizer tok = new StrTokenizer(input, ':');
+ final String input = "a: b :";
+ final StrTokenizer tok = new StrTokenizer(input, ':');
tok.setTrimmerMatcher(StrMatcher.stringMatcher(" "));
tok.setIgnoreEmptyTokens(false);
tok.setEmptyTokenAsNull(true);
@@ -441,8 +441,8 @@ public class StrTokenizerTest {
@Test
public void testBasicIgnoreTrimmed1() {
- String input = "a: bIGNOREc : ";
- StrTokenizer tok = new StrTokenizer(input, ':');
+ final String input = "a: bIGNOREc : ";
+ final StrTokenizer tok = new StrTokenizer(input, ':');
tok.setIgnoredMatcher(StrMatcher.stringMatcher("IGNORE"));
tok.setTrimmerMatcher(StrMatcher.trimMatcher());
tok.setIgnoreEmptyTokens(false);
@@ -455,8 +455,8 @@ public class StrTokenizerTest {
@Test
public void testBasicIgnoreTrimmed2() {
- String input = "IGNOREaIGNORE: IGNORE bIGNOREc IGNORE : IGNORE ";
- StrTokenizer tok = new StrTokenizer(input, ':');
+ final String input = "IGNOREaIGNORE: IGNORE bIGNOREc IGNORE : IGNORE ";
+ final StrTokenizer tok = new StrTokenizer(input, ':');
tok.setIgnoredMatcher(StrMatcher.stringMatcher("IGNORE"));
tok.setTrimmerMatcher(StrMatcher.trimMatcher());
tok.setIgnoreEmptyTokens(false);
@@ -469,8 +469,8 @@ public class StrTokenizerTest {
@Test
public void testBasicIgnoreTrimmed3() {
- String input = "IGNOREaIGNORE: IGNORE bIGNOREc IGNORE : IGNORE ";
- StrTokenizer tok = new StrTokenizer(input, ':');
+ final String input = "IGNOREaIGNORE: IGNORE bIGNOREc IGNORE : IGNORE ";
+ final StrTokenizer tok = new StrTokenizer(input, ':');
tok.setIgnoredMatcher(StrMatcher.stringMatcher("IGNORE"));
tok.setIgnoreEmptyTokens(false);
tok.setEmptyTokenAsNull(true);
@@ -482,8 +482,8 @@ public class StrTokenizerTest {
@Test
public void testBasicIgnoreTrimmed4() {
- String input = "IGNOREaIGNORE: IGNORE 'bIGNOREc'IGNORE'd' IGNORE : IGNORE ";
- StrTokenizer tok = new StrTokenizer(input, ':', '\'');
+ final String input = "IGNOREaIGNORE: IGNORE 'bIGNOREc'IGNORE'd' IGNORE : IGNORE ";
+ final StrTokenizer tok = new StrTokenizer(input, ':', '\'');
tok.setIgnoredMatcher(StrMatcher.stringMatcher("IGNORE"));
tok.setTrimmerMatcher(StrMatcher.trimMatcher());
tok.setIgnoreEmptyTokens(false);
@@ -497,10 +497,10 @@ public class StrTokenizerTest {
//-----------------------------------------------------------------------
@Test
public void testListArray() {
- String input = "a b c";
- StrTokenizer tok = new StrTokenizer(input);
- String[] array = tok.getTokenArray();
- List<?> list = tok.getTokenList();
+ final String input = "a b c";
+ final StrTokenizer tok = new StrTokenizer(input);
+ final String[] array = tok.getTokenArray();
+ final List<?> list = tok.getTokenList();
assertEquals(Arrays.asList(array), list);
assertEquals(3, list.size());
@@ -539,12 +539,12 @@ public class StrTokenizerTest {
try {
tokenizer.next();
fail();
- } catch (NoSuchElementException ex) {}
+ } catch (final NoSuchElementException ex) {}
}
@Test
public void testGetContent() {
- String input = "a b c \"d e\" f ";
+ final String input = "a b c \"d e\" f ";
StrTokenizer tok = new StrTokenizer(input);
assertEquals(input, tok.getContent());
@@ -558,7 +558,7 @@ public class StrTokenizerTest {
//-----------------------------------------------------------------------
@Test
public void testChaining() {
- StrTokenizer tok = new StrTokenizer();
+ final StrTokenizer tok = new StrTokenizer();
assertEquals(tok, tok.reset());
assertEquals(tok, tok.reset(""));
assertEquals(tok, tok.reset(new char[0]));
@@ -580,7 +580,7 @@ public class StrTokenizerTest {
*/
@Test
public void testCloneNotSupportedException() {
- Object notCloned = new StrTokenizer() {
+ final Object notCloned = new StrTokenizer() {
@Override
Object cloneReset() throws CloneNotSupportedException {
throw new CloneNotSupportedException("test");
@@ -591,13 +591,13 @@ public class StrTokenizerTest {
@Test
public void testCloneNull() {
- StrTokenizer tokenizer = new StrTokenizer((char[]) null);
+ final StrTokenizer tokenizer = new StrTokenizer((char[]) null);
// Start sanity check
assertEquals(null, tokenizer.nextToken());
tokenizer.reset();
assertEquals(null, tokenizer.nextToken());
// End sanity check
- StrTokenizer clonedTokenizer = (StrTokenizer) tokenizer.clone();
+ final StrTokenizer clonedTokenizer = (StrTokenizer) tokenizer.clone();
tokenizer.reset();
assertEquals(null, tokenizer.nextToken());
assertEquals(null, clonedTokenizer.nextToken());
@@ -605,14 +605,14 @@ public class StrTokenizerTest {
@Test
public void testCloneReset() {
- char[] input = new char[]{'a'};
- StrTokenizer tokenizer = new StrTokenizer(input);
+ final char[] input = new char[]{'a'};
+ final StrTokenizer tokenizer = new StrTokenizer(input);
// Start sanity check
assertEquals("a", tokenizer.nextToken());
tokenizer.reset(input);
assertEquals("a", tokenizer.nextToken());
// End sanity check
- StrTokenizer clonedTokenizer = (StrTokenizer) tokenizer.clone();
+ final StrTokenizer clonedTokenizer = (StrTokenizer) tokenizer.clone();
input[0] = 'b';
tokenizer.reset(input);
assertEquals("b", tokenizer.nextToken());
@@ -718,7 +718,7 @@ public class StrTokenizerTest {
//-----------------------------------------------------------------------
@Test
public void testReset() {
- StrTokenizer tok = new StrTokenizer("a b c");
+ final StrTokenizer tok = new StrTokenizer("a b c");
assertEquals("a", tok.next());
assertEquals("b", tok.next());
assertEquals("c", tok.next());
@@ -734,7 +734,7 @@ public class StrTokenizerTest {
//-----------------------------------------------------------------------
@Test
public void testReset_String() {
- StrTokenizer tok = new StrTokenizer("x x x");
+ final StrTokenizer tok = new StrTokenizer("x x x");
tok.reset("d e");
assertEquals("d", tok.next());
assertEquals("e", tok.next());
@@ -747,9 +747,9 @@ public class StrTokenizerTest {
//-----------------------------------------------------------------------
@Test
public void testReset_charArray() {
- StrTokenizer tok = new StrTokenizer("x x x");
+ final StrTokenizer tok = new StrTokenizer("x x x");
- char[] array = new char[] {'a', 'b', 'c'};
+ final char[] array = new char[] {'a', 'b', 'c'};
tok.reset(array);
assertEquals("abc", tok.next());
assertFalse(tok.hasNext());
@@ -798,27 +798,27 @@ public class StrTokenizerTest {
@Test
public void testIteration() {
- StrTokenizer tkn = new StrTokenizer("a b c");
+ final StrTokenizer tkn = new StrTokenizer("a b c");
assertFalse(tkn.hasPrevious());
try {
tkn.previous();
fail();
- } catch (NoSuchElementException ex) {}
+ } catch (final NoSuchElementException ex) {}
assertTrue(tkn.hasNext());
assertEquals("a", tkn.next());
try {
tkn.remove();
fail();
- } catch (UnsupportedOperationException ex) {}
+ } catch (final UnsupportedOperationException ex) {}
try {
tkn.set("x");
fail();
- } catch (UnsupportedOperationException ex) {}
+ } catch (final UnsupportedOperationException ex) {}
try {
tkn.add("y");
fail();
- } catch (UnsupportedOperationException ex) {}
+ } catch (final UnsupportedOperationException ex) {}
assertTrue(tkn.hasPrevious());
assertTrue(tkn.hasNext());
@@ -833,7 +833,7 @@ public class StrTokenizerTest {
try {
tkn.next();
fail();
- } catch (NoSuchElementException ex) {}
+ } catch (final NoSuchElementException ex) {}
assertTrue(tkn.hasPrevious());
assertFalse(tkn.hasNext());
}
@@ -841,7 +841,7 @@ public class StrTokenizerTest {
//-----------------------------------------------------------------------
@Test
public void testTokenizeSubclassInputChange() {
- StrTokenizer tkn = new StrTokenizer("a b c d e") {
+ final StrTokenizer tkn = new StrTokenizer("a b c d e") {
@Override
protected List<String> tokenize(final char[] chars, final int offset, final int count) {
return super.tokenize("w x y z".toCharArray(), 2, 5);
@@ -854,10 +854,10 @@ public class StrTokenizerTest {
//-----------------------------------------------------------------------
@Test
public void testTokenizeSubclassOutputChange() {
- StrTokenizer tkn = new StrTokenizer("a b c") {
+ final StrTokenizer tkn = new StrTokenizer("a b c") {
@Override
protected List<String> tokenize(final char[] chars, final int offset, final int count) {
- List<String> list = super.tokenize(chars, offset, count);
+ final List<String> list = super.tokenize(chars, offset, count);
Collections.reverse(list);
return list;
}
@@ -870,7 +870,7 @@ public class StrTokenizerTest {
//-----------------------------------------------------------------------
@Test
public void testToString() {
- StrTokenizer tkn = new StrTokenizer("a b c d e");
+ final StrTokenizer tkn = new StrTokenizer("a b c d e");
assertEquals("StrTokenizer[not tokenized yet]", tkn.toString());
tkn.next();
assertEquals("StrTokenizer[a, b, c, d, e]", tkn.toString());
Modified: commons/proper/lang/trunk/src/test/java/org/apache/commons/lang3/text/WordUtilsTest.java
URL: http://svn.apache.org/viewvc/commons/proper/lang/trunk/src/test/java/org/apache/commons/lang3/text/WordUtilsTest.java?rev=1436770&r1=1436769&r2=1436770&view=diff
==============================================================================
--- commons/proper/lang/trunk/src/test/java/org/apache/commons/lang3/text/WordUtilsTest.java (original)
+++ commons/proper/lang/trunk/src/test/java/org/apache/commons/lang3/text/WordUtilsTest.java Tue Jan 22 07:09:45 2013
@@ -37,7 +37,7 @@ public class WordUtilsTest {
@Test
public void testConstructor() {
assertNotNull(new WordUtils());
- Constructor<?>[] cons = WordUtils.class.getDeclaredConstructors();
+ final Constructor<?>[] cons = WordUtils.class.getDeclaredConstructors();
assertEquals(1, cons.length);
assertTrue(Modifier.isPublic(cons[0].getModifiers()));
assertTrue(Modifier.isPublic(WordUtils.class.getModifiers()));
@@ -54,7 +54,7 @@ public class WordUtilsTest {
assertEquals("", WordUtils.wrap("", -1));
// normal
- String systemNewLine = System.getProperty("line.separator");
+ final String systemNewLine = System.getProperty("line.separator");
String input = "Here is one line of text that is going to be wrapped after 20 columns.";
String expected = "Here is one line of" + systemNewLine + "text that is going"
+ systemNewLine + "to be wrapped after" + systemNewLine + "20 columns.";
@@ -110,7 +110,7 @@ public class WordUtilsTest {
assertEquals(expected, WordUtils.wrap(input, -1, "\n", false));
// system newline char
- String systemNewLine = System.getProperty("line.separator");
+ final String systemNewLine = System.getProperty("line.separator");
input = "Here is one line of text that is going to be wrapped after 20 columns.";
expected = "Here is one line of" + systemNewLine + "text that is going" + systemNewLine
+ "to be wrapped after" + systemNewLine + "20 columns.";
@@ -360,8 +360,8 @@ public class WordUtilsTest {
assertEquals("I AM here 123", WordUtils.swapCase("i am HERE 123") );
assertEquals("i am here 123", WordUtils.swapCase("I AM HERE 123") );
- String test = "This String contains a TitleCase character: \u01C8";
- String expect = "tHIS sTRING CONTAINS A tITLEcASE CHARACTER: \u01C9";
+ final String test = "This String contains a TitleCase character: \u01C8";
+ final String expect = "tHIS sTRING CONTAINS A tITLEcASE CHARACTER: \u01C9";
assertEquals(expect, WordUtils.swapCase(test));
}
Modified: commons/proper/lang/trunk/src/test/java/org/apache/commons/lang3/text/translate/EntityArraysTest.java
URL: http://svn.apache.org/viewvc/commons/proper/lang/trunk/src/test/java/org/apache/commons/lang3/text/translate/EntityArraysTest.java?rev=1436770&r1=1436769&r2=1436770&view=diff
==============================================================================
--- commons/proper/lang/trunk/src/test/java/org/apache/commons/lang3/text/translate/EntityArraysTest.java (original)
+++ commons/proper/lang/trunk/src/test/java/org/apache/commons/lang3/text/translate/EntityArraysTest.java Tue Jan 22 07:09:45 2013
@@ -38,9 +38,9 @@ public class EntityArraysTest {
// LANG-659 - check arrays for duplicate entries
@Test
public void testHTML40_EXTENDED_ESCAPE(){
- Set<String> col0 = new HashSet<String>();
- Set<String> col1 = new HashSet<String>();
- String [][] sa = EntityArrays.HTML40_EXTENDED_ESCAPE();
+ final Set<String> col0 = new HashSet<String>();
+ final Set<String> col1 = new HashSet<String>();
+ final String [][] sa = EntityArrays.HTML40_EXTENDED_ESCAPE();
for(int i =0; i <sa.length; i++){
assertTrue("Already added entry 0: "+i+" "+sa[i][0],col0.add(sa[i][0]));
assertTrue("Already added entry 1: "+i+" "+sa[i][1],col1.add(sa[i][1]));
@@ -50,13 +50,13 @@ public class EntityArraysTest {
// LANG-658 - check arrays for duplicate entries
@Test
public void testISO8859_1_ESCAPE(){
- Set<String> col0 = new HashSet<String>();
- Set<String> col1 = new HashSet<String>();
- String [][] sa = EntityArrays.ISO8859_1_ESCAPE();
+ final Set<String> col0 = new HashSet<String>();
+ final Set<String> col1 = new HashSet<String>();
+ final String [][] sa = EntityArrays.ISO8859_1_ESCAPE();
boolean success = true;
for(int i =0; i <sa.length; i++){
- boolean add0 = col0.add(sa[i][0]);
- boolean add1 = col1.add(sa[i][1]);
+ final boolean add0 = col0.add(sa[i][0]);
+ final boolean add1 = col1.add(sa[i][1]);
if (!add0) {
success = false;
System.out.println("Already added entry 0: "+i+" "+sa[i][0]+" "+sa[i][1]);
Modified: commons/proper/lang/trunk/src/test/java/org/apache/commons/lang3/text/translate/LookupTranslatorTest.java
URL: http://svn.apache.org/viewvc/commons/proper/lang/trunk/src/test/java/org/apache/commons/lang3/text/translate/LookupTranslatorTest.java?rev=1436770&r1=1436769&r2=1436770&view=diff
==============================================================================
--- commons/proper/lang/trunk/src/test/java/org/apache/commons/lang3/text/translate/LookupTranslatorTest.java (original)
+++ commons/proper/lang/trunk/src/test/java/org/apache/commons/lang3/text/translate/LookupTranslatorTest.java Tue Jan 22 07:09:45 2013
@@ -32,9 +32,9 @@ public class LookupTranslatorTest {
@Test
public void testBasicLookup() throws IOException {
- LookupTranslator lt = new LookupTranslator(new CharSequence[][] { { "one", "two" } });
- StringWriter out = new StringWriter();
- int result = lt.translate("one", 0, out);
+ final LookupTranslator lt = new LookupTranslator(new CharSequence[][] { { "one", "two" } });
+ final StringWriter out = new StringWriter();
+ final int result = lt.translate("one", 0, out);
assertEquals("Incorrect codepoint consumption", 3, result);
assertEquals("Incorrect value", "two", out.toString());
}
Modified: commons/proper/lang/trunk/src/test/java/org/apache/commons/lang3/text/translate/NumericEntityEscaperTest.java
URL: http://svn.apache.org/viewvc/commons/proper/lang/trunk/src/test/java/org/apache/commons/lang3/text/translate/NumericEntityEscaperTest.java?rev=1436770&r1=1436769&r2=1436770&view=diff
==============================================================================
--- commons/proper/lang/trunk/src/test/java/org/apache/commons/lang3/text/translate/NumericEntityEscaperTest.java (original)
+++ commons/proper/lang/trunk/src/test/java/org/apache/commons/lang3/text/translate/NumericEntityEscaperTest.java Tue Jan 22 07:09:45 2013
@@ -29,39 +29,39 @@ public class NumericEntityEscaperTest {
@Test
public void testBelow() {
- NumericEntityEscaper nee = NumericEntityEscaper.below('F');
+ final NumericEntityEscaper nee = NumericEntityEscaper.below('F');
- String input = "ADFGZ";
- String result = nee.translate(input);
+ final String input = "ADFGZ";
+ final String result = nee.translate(input);
assertEquals("Failed to escape numeric entities via the below method", "ADFGZ", result);
}
@Test
public void testBetween() {
- NumericEntityEscaper nee = NumericEntityEscaper.between('F', 'L');
+ final NumericEntityEscaper nee = NumericEntityEscaper.between('F', 'L');
- String input = "ADFGZ";
- String result = nee.translate(input);
+ final String input = "ADFGZ";
+ final String result = nee.translate(input);
assertEquals("Failed to escape numeric entities via the between method", "ADFGZ", result);
}
@Test
public void testAbove() {
- NumericEntityEscaper nee = NumericEntityEscaper.above('F');
+ final NumericEntityEscaper nee = NumericEntityEscaper.above('F');
- String input = "ADFGZ";
- String result = nee.translate(input);
+ final String input = "ADFGZ";
+ final String result = nee.translate(input);
assertEquals("Failed to escape numeric entities via the above method", "ADFGZ", result);
}
// See LANG-617
@Test
public void testSupplementary() {
- NumericEntityEscaper nee = new NumericEntityEscaper();
- String input = "\uD803\uDC22";
- String expected = "𐰢";
+ final NumericEntityEscaper nee = new NumericEntityEscaper();
+ final String input = "\uD803\uDC22";
+ final String expected = "𐰢";
- String result = nee.translate(input);
+ final String result = nee.translate(input);
assertEquals("Failed to escape numeric entities supplementary characters", expected, result);
}
Modified: commons/proper/lang/trunk/src/test/java/org/apache/commons/lang3/text/translate/NumericEntityUnescaperTest.java
URL: http://svn.apache.org/viewvc/commons/proper/lang/trunk/src/test/java/org/apache/commons/lang3/text/translate/NumericEntityUnescaperTest.java?rev=1436770&r1=1436769&r2=1436770&view=diff
==============================================================================
--- commons/proper/lang/trunk/src/test/java/org/apache/commons/lang3/text/translate/NumericEntityUnescaperTest.java (original)
+++ commons/proper/lang/trunk/src/test/java/org/apache/commons/lang3/text/translate/NumericEntityUnescaperTest.java Tue Jan 22 07:09:45 2013
@@ -30,17 +30,17 @@ public class NumericEntityUnescaperTest
@Test
public void testSupplementaryUnescaping() {
- NumericEntityUnescaper neu = new NumericEntityUnescaper();
- String input = "𐰢";
- String expected = "\uD803\uDC22";
+ final NumericEntityUnescaper neu = new NumericEntityUnescaper();
+ final String input = "𐰢";
+ final String expected = "\uD803\uDC22";
- String result = neu.translate(input);
+ final String result = neu.translate(input);
assertEquals("Failed to unescape numeric entities supplementary characters", expected, result);
}
@Test
public void testOutOfBounds() {
- NumericEntityUnescaper neu = new NumericEntityUnescaper();
+ final NumericEntityUnescaper neu = new NumericEntityUnescaper();
assertEquals("Failed to ignore when last character is &", "Test &", neu.translate("Test &"));
assertEquals("Failed to ignore when last character is &", "Test &#", neu.translate("Test &#"));
@@ -73,7 +73,7 @@ public class NumericEntityUnescaperTest
try {
result = neu.translate(input);
fail("IllegalArgumentException expected");
- } catch(IllegalArgumentException iae) {
+ } catch(final IllegalArgumentException iae) {
// expected
}
}
Modified: commons/proper/lang/trunk/src/test/java/org/apache/commons/lang3/text/translate/OctalUnescaperTest.java
URL: http://svn.apache.org/viewvc/commons/proper/lang/trunk/src/test/java/org/apache/commons/lang3/text/translate/OctalUnescaperTest.java?rev=1436770&r1=1436769&r2=1436770&view=diff
==============================================================================
--- commons/proper/lang/trunk/src/test/java/org/apache/commons/lang3/text/translate/OctalUnescaperTest.java (original)
+++ commons/proper/lang/trunk/src/test/java/org/apache/commons/lang3/text/translate/OctalUnescaperTest.java Tue Jan 22 07:09:45 2013
@@ -28,7 +28,7 @@ public class OctalUnescaperTest {
@Test
public void testBetween() {
- OctalUnescaper oue = new OctalUnescaper(); //.between("1", "377");
+ final OctalUnescaper oue = new OctalUnescaper(); //.between("1", "377");
String input = "\\45";
String result = oue.translate(input);
Modified: commons/proper/lang/trunk/src/test/java/org/apache/commons/lang3/text/translate/UnicodeEscaperTest.java
URL: http://svn.apache.org/viewvc/commons/proper/lang/trunk/src/test/java/org/apache/commons/lang3/text/translate/UnicodeEscaperTest.java?rev=1436770&r1=1436769&r2=1436770&view=diff
==============================================================================
--- commons/proper/lang/trunk/src/test/java/org/apache/commons/lang3/text/translate/UnicodeEscaperTest.java (original)
+++ commons/proper/lang/trunk/src/test/java/org/apache/commons/lang3/text/translate/UnicodeEscaperTest.java Tue Jan 22 07:09:45 2013
@@ -29,28 +29,28 @@ public class UnicodeEscaperTest {
@Test
public void testBelow() {
- UnicodeEscaper ue = UnicodeEscaper.below('F');
+ final UnicodeEscaper ue = UnicodeEscaper.below('F');
- String input = "ADFGZ";
- String result = ue.translate(input);
+ final String input = "ADFGZ";
+ final String result = ue.translate(input);
assertEquals("Failed to escape Unicode characters via the below method", "\\u0041\\u0044FGZ", result);
}
@Test
public void testBetween() {
- UnicodeEscaper ue = UnicodeEscaper.between('F', 'L');
+ final UnicodeEscaper ue = UnicodeEscaper.between('F', 'L');
- String input = "ADFGZ";
- String result = ue.translate(input);
+ final String input = "ADFGZ";
+ final String result = ue.translate(input);
assertEquals("Failed to escape Unicode characters via the between method", "AD\\u0046\\u0047Z", result);
}
@Test
public void testAbove() {
- UnicodeEscaper ue = UnicodeEscaper.above('F');
+ final UnicodeEscaper ue = UnicodeEscaper.above('F');
- String input = "ADFGZ";
- String result = ue.translate(input);
+ final String input = "ADFGZ";
+ final String result = ue.translate(input);
assertEquals("Failed to escape Unicode characters via the above method", "ADF\\u0047\\u005A", result);
}
}
Modified: commons/proper/lang/trunk/src/test/java/org/apache/commons/lang3/text/translate/UnicodeUnescaperTest.java
URL: http://svn.apache.org/viewvc/commons/proper/lang/trunk/src/test/java/org/apache/commons/lang3/text/translate/UnicodeUnescaperTest.java?rev=1436770&r1=1436769&r2=1436770&view=diff
==============================================================================
--- commons/proper/lang/trunk/src/test/java/org/apache/commons/lang3/text/translate/UnicodeUnescaperTest.java (original)
+++ commons/proper/lang/trunk/src/test/java/org/apache/commons/lang3/text/translate/UnicodeUnescaperTest.java Tue Jan 22 07:09:45 2013
@@ -31,30 +31,30 @@ public class UnicodeUnescaperTest {
// Requested in LANG-507
@Test
public void testUPlus() {
- UnicodeUnescaper uu = new UnicodeUnescaper();
+ final UnicodeUnescaper uu = new UnicodeUnescaper();
- String input = "\\u+0047";
+ final String input = "\\u+0047";
assertEquals("Failed to unescape Unicode characters with 'u+' notation", "G", uu.translate(input));
}
@Test
public void testUuuuu() {
- UnicodeUnescaper uu = new UnicodeUnescaper();
+ final UnicodeUnescaper uu = new UnicodeUnescaper();
- String input = "\\uuuuuuuu0047";
- String result = uu.translate(input);
+ final String input = "\\uuuuuuuu0047";
+ final String result = uu.translate(input);
assertEquals("Failed to unescape Unicode characters with many 'u' characters", "G", result);
}
@Test
public void testLessThanFour() {
- UnicodeUnescaper uu = new UnicodeUnescaper();
+ final UnicodeUnescaper uu = new UnicodeUnescaper();
- String input = "\\0047\\u006";
+ final String input = "\\0047\\u006";
try {
uu.translate(input);
fail("A lack of digits in a Unicode escape sequence failed to throw an exception");
- } catch(IllegalArgumentException iae) {
+ } catch(final IllegalArgumentException iae) {
// expected
}
}
Modified: commons/proper/lang/trunk/src/test/java/org/apache/commons/lang3/time/DateFormatUtilsTest.java
URL: http://svn.apache.org/viewvc/commons/proper/lang/trunk/src/test/java/org/apache/commons/lang3/time/DateFormatUtilsTest.java?rev=1436770&r1=1436769&r2=1436770&view=diff
==============================================================================
--- commons/proper/lang/trunk/src/test/java/org/apache/commons/lang3/time/DateFormatUtilsTest.java (original)
+++ commons/proper/lang/trunk/src/test/java/org/apache/commons/lang3/time/DateFormatUtilsTest.java Tue Jan 22 07:09:45 2013
@@ -34,7 +34,7 @@ public class DateFormatUtilsTest {
@Test
public void testConstructor() {
assertNotNull(new DateFormatUtils());
- Constructor<?>[] cons = DateFormatUtils.class.getDeclaredConstructors();
+ final Constructor<?>[] cons = DateFormatUtils.class.getDeclaredConstructors();
assertEquals(1, cons.length);
assertTrue(Modifier.isPublic(cons[0].getModifiers()));
assertTrue(Modifier.isPublic(DateFormatUtils.class.getModifiers()));
@@ -44,14 +44,14 @@ public class DateFormatUtilsTest {
//-----------------------------------------------------------------------
@Test
public void testFormat() {
- Calendar c = Calendar.getInstance(TimeZone.getTimeZone("UTC"));
+ final Calendar c = Calendar.getInstance(TimeZone.getTimeZone("UTC"));
c.set(2005,0,1,12,0,0);
c.setTimeZone(TimeZone.getDefault());
- StringBuilder buffer = new StringBuilder ();
- int year = c.get(Calendar.YEAR);
- int month = c.get(Calendar.MONTH) + 1;
- int day = c.get(Calendar.DAY_OF_MONTH);
- int hour = c.get(Calendar.HOUR_OF_DAY);
+ final StringBuilder buffer = new StringBuilder ();
+ final int year = c.get(Calendar.YEAR);
+ final int month = c.get(Calendar.MONTH) + 1;
+ final int day = c.get(Calendar.DAY_OF_MONTH);
+ final int hour = c.get(Calendar.HOUR_OF_DAY);
buffer.append (year);
buffer.append(month);
buffer.append(day);
@@ -68,14 +68,14 @@ public class DateFormatUtilsTest {
//-----------------------------------------------------------------------
@Test
public void testFormatCalendar() {
- Calendar c = Calendar.getInstance(TimeZone.getTimeZone("UTC"));
+ final Calendar c = Calendar.getInstance(TimeZone.getTimeZone("UTC"));
c.set(2005,0,1,12,0,0);
c.setTimeZone(TimeZone.getDefault());
- StringBuilder buffer = new StringBuilder ();
- int year = c.get(Calendar.YEAR);
- int month = c.get(Calendar.MONTH) + 1;
- int day = c.get(Calendar.DAY_OF_MONTH);
- int hour = c.get(Calendar.HOUR_OF_DAY);
+ final StringBuilder buffer = new StringBuilder ();
+ final int year = c.get(Calendar.YEAR);
+ final int month = c.get(Calendar.MONTH) + 1;
+ final int day = c.get(Calendar.DAY_OF_MONTH);
+ final int hour = c.get(Calendar.HOUR_OF_DAY);
buffer.append (year);
buffer.append(month);
buffer.append(day);
@@ -91,7 +91,7 @@ public class DateFormatUtilsTest {
@Test
public void testFormatUTC() {
- Calendar c = Calendar.getInstance(TimeZone.getTimeZone("UTC"));
+ final Calendar c = Calendar.getInstance(TimeZone.getTimeZone("UTC"));
c.set(2005,0,1,12,0,0);
assertEquals ("2005-01-01T12:00:00", DateFormatUtils.formatUTC(c.getTime(), DateFormatUtils.ISO_DATETIME_FORMAT.getPattern()));
@@ -104,8 +104,8 @@ public class DateFormatUtilsTest {
@Test
public void testDateTimeISO(){
- TimeZone timeZone = TimeZone.getTimeZone("GMT-3");
- Calendar cal = Calendar.getInstance(timeZone);
+ final TimeZone timeZone = TimeZone.getTimeZone("GMT-3");
+ final Calendar cal = Calendar.getInstance(timeZone);
cal.set(2002,1,23,9,11,12);
String text = DateFormatUtils.format(cal.getTime(),
DateFormatUtils.ISO_DATETIME_FORMAT.getPattern(), timeZone);
@@ -128,8 +128,8 @@ public class DateFormatUtilsTest {
@Test
public void testDateISO(){
- TimeZone timeZone = TimeZone.getTimeZone("GMT-3");
- Calendar cal = Calendar.getInstance(timeZone);
+ final TimeZone timeZone = TimeZone.getTimeZone("GMT-3");
+ final Calendar cal = Calendar.getInstance(timeZone);
cal.set(2002,1,23,10,11,12);
String text = DateFormatUtils.format(cal.getTime(),
DateFormatUtils.ISO_DATE_FORMAT.getPattern(), timeZone);
@@ -152,8 +152,8 @@ public class DateFormatUtilsTest {
@Test
public void testTimeISO(){
- TimeZone timeZone = TimeZone.getTimeZone("GMT-3");
- Calendar cal = Calendar.getInstance(timeZone);
+ final TimeZone timeZone = TimeZone.getTimeZone("GMT-3");
+ final Calendar cal = Calendar.getInstance(timeZone);
cal.set(2002,1,23,10,11,12);
String text = DateFormatUtils.format(cal.getTime(),
DateFormatUtils.ISO_TIME_FORMAT.getPattern(), timeZone);
@@ -176,8 +176,8 @@ public class DateFormatUtilsTest {
@Test
public void testTimeNoTISO(){
- TimeZone timeZone = TimeZone.getTimeZone("GMT-3");
- Calendar cal = Calendar.getInstance(timeZone);
+ final TimeZone timeZone = TimeZone.getTimeZone("GMT-3");
+ final Calendar cal = Calendar.getInstance(timeZone);
cal.set(2002,1,23,10,11,12);
String text = DateFormatUtils.format(cal.getTime(),
DateFormatUtils.ISO_TIME_NO_T_FORMAT.getPattern(), timeZone);
@@ -200,8 +200,8 @@ public class DateFormatUtilsTest {
@Test
public void testSMTP(){
- TimeZone timeZone = TimeZone.getTimeZone("GMT-3");
- Calendar cal = Calendar.getInstance(timeZone);
+ final TimeZone timeZone = TimeZone.getTimeZone("GMT-3");
+ final Calendar cal = Calendar.getInstance(timeZone);
cal.set(2003,5,8,10,11,12);
String text = DateFormatUtils.format(cal.getTime(),
DateFormatUtils.SMTP_DATETIME_FORMAT.getPattern(), timeZone,
Modified: commons/proper/lang/trunk/src/test/java/org/apache/commons/lang3/time/DateUtilsFragmentTest.java
URL: http://svn.apache.org/viewvc/commons/proper/lang/trunk/src/test/java/org/apache/commons/lang3/time/DateUtilsFragmentTest.java?rev=1436770&r1=1436769&r2=1436770&view=diff
==============================================================================
--- commons/proper/lang/trunk/src/test/java/org/apache/commons/lang3/time/DateUtilsFragmentTest.java (original)
+++ commons/proper/lang/trunk/src/test/java/org/apache/commons/lang3/time/DateUtilsFragmentTest.java Tue Jan 22 07:09:45 2013
@@ -48,27 +48,27 @@ public class DateUtilsFragmentTest {
try {
DateUtils.getFragmentInMilliseconds((Date) null, Calendar.MILLISECOND);
fail();
- } catch(IllegalArgumentException iae) {}
+ } catch(final IllegalArgumentException iae) {}
try {
DateUtils.getFragmentInSeconds((Date) null, Calendar.MILLISECOND);
fail();
- } catch(IllegalArgumentException iae) {}
+ } catch(final IllegalArgumentException iae) {}
try {
DateUtils.getFragmentInMinutes((Date) null, Calendar.MILLISECOND);
fail();
- } catch(IllegalArgumentException iae) {}
+ } catch(final IllegalArgumentException iae) {}
try {
DateUtils.getFragmentInHours((Date) null, Calendar.MILLISECOND);
fail();
- } catch(IllegalArgumentException iae) {}
+ } catch(final IllegalArgumentException iae) {}
try {
DateUtils.getFragmentInDays((Date) null, Calendar.MILLISECOND);
fail();
- } catch(IllegalArgumentException iae) {}
+ } catch(final IllegalArgumentException iae) {}
}
@Test
@@ -76,27 +76,27 @@ public class DateUtilsFragmentTest {
try {
DateUtils.getFragmentInMilliseconds((Calendar) null, Calendar.MILLISECOND);
fail();
- } catch(IllegalArgumentException iae) {}
+ } catch(final IllegalArgumentException iae) {}
try {
DateUtils.getFragmentInSeconds((Calendar) null, Calendar.MILLISECOND);
fail();
- } catch(IllegalArgumentException iae) {}
+ } catch(final IllegalArgumentException iae) {}
try {
DateUtils.getFragmentInMinutes((Calendar) null, Calendar.MILLISECOND);
fail();
- } catch(IllegalArgumentException iae) {}
+ } catch(final IllegalArgumentException iae) {}
try {
DateUtils.getFragmentInHours((Calendar) null, Calendar.MILLISECOND);
fail();
- } catch(IllegalArgumentException iae) {}
+ } catch(final IllegalArgumentException iae) {}
try {
DateUtils.getFragmentInDays((Calendar) null, Calendar.MILLISECOND);
fail();
- } catch(IllegalArgumentException iae) {}
+ } catch(final IllegalArgumentException iae) {}
}
@Test
@@ -104,27 +104,27 @@ public class DateUtilsFragmentTest {
try {
DateUtils.getFragmentInMilliseconds(aDate, 0);
fail();
- } catch(IllegalArgumentException iae) {}
+ } catch(final IllegalArgumentException iae) {}
try {
DateUtils.getFragmentInSeconds(aDate, 0);
fail();
- } catch(IllegalArgumentException iae) {}
+ } catch(final IllegalArgumentException iae) {}
try {
DateUtils.getFragmentInMinutes(aDate, 0);
fail();
- } catch(IllegalArgumentException iae) {}
+ } catch(final IllegalArgumentException iae) {}
try {
DateUtils.getFragmentInHours(aDate, 0);
fail();
- } catch(IllegalArgumentException iae) {}
+ } catch(final IllegalArgumentException iae) {}
try {
DateUtils.getFragmentInDays(aDate, 0);
fail();
- } catch(IllegalArgumentException iae) {}
+ } catch(final IllegalArgumentException iae) {}
}
@Test
@@ -132,27 +132,27 @@ public class DateUtilsFragmentTest {
try {
DateUtils.getFragmentInMilliseconds(aCalendar, 0);
fail();
- } catch(IllegalArgumentException iae) {}
+ } catch(final IllegalArgumentException iae) {}
try {
DateUtils.getFragmentInSeconds(aCalendar, 0);
fail();
- } catch(IllegalArgumentException iae) {}
+ } catch(final IllegalArgumentException iae) {}
try {
DateUtils.getFragmentInMinutes(aCalendar, 0);
fail();
- } catch(IllegalArgumentException iae) {}
+ } catch(final IllegalArgumentException iae) {}
try {
DateUtils.getFragmentInHours(aCalendar, 0);
fail();
- } catch(IllegalArgumentException iae) {}
+ } catch(final IllegalArgumentException iae) {}
try {
DateUtils.getFragmentInDays(aCalendar, 0);
fail();
- } catch(IllegalArgumentException iae) {}
+ } catch(final IllegalArgumentException iae) {}
}
@Test
@@ -239,13 +239,13 @@ public class DateUtilsFragmentTest {
@Test
public void testMillisecondsOfSecondWithDate() {
- long testResult = DateUtils.getFragmentInMilliseconds(aDate, Calendar.SECOND);
+ final long testResult = DateUtils.getFragmentInMilliseconds(aDate, Calendar.SECOND);
assertEquals(millis, testResult);
}
@Test
public void testMillisecondsOfSecondWithCalendar() {
- long testResult = DateUtils.getFragmentInMilliseconds(aCalendar, Calendar.SECOND);
+ final long testResult = DateUtils.getFragmentInMilliseconds(aCalendar, Calendar.SECOND);
assertEquals(millis, testResult);
assertEquals(aCalendar.get(Calendar.MILLISECOND), testResult);
}
@@ -254,25 +254,25 @@ public class DateUtilsFragmentTest {
@Test
public void testMillisecondsOfMinuteWithDate() {
- long testResult = DateUtils.getFragmentInMilliseconds(aDate, Calendar.MINUTE);
+ final long testResult = DateUtils.getFragmentInMilliseconds(aDate, Calendar.MINUTE);
assertEquals(millis + (seconds * DateUtils.MILLIS_PER_SECOND), testResult);
}
@Test
public void testMillisecondsOfMinuteWithCalender() {
- long testResult = DateUtils.getFragmentInMilliseconds(aCalendar, Calendar.MINUTE);
+ final long testResult = DateUtils.getFragmentInMilliseconds(aCalendar, Calendar.MINUTE);
assertEquals(millis + (seconds * DateUtils.MILLIS_PER_SECOND), testResult);
}
@Test
public void testSecondsofMinuteWithDate() {
- long testResult = DateUtils.getFragmentInSeconds(aDate, Calendar.MINUTE);
+ final long testResult = DateUtils.getFragmentInSeconds(aDate, Calendar.MINUTE);
assertEquals(seconds, testResult);
}
@Test
public void testSecondsofMinuteWithCalendar() {
- long testResult = DateUtils.getFragmentInSeconds(aCalendar, Calendar.MINUTE);
+ final long testResult = DateUtils.getFragmentInSeconds(aCalendar, Calendar.MINUTE);
assertEquals(seconds, testResult);
assertEquals(aCalendar.get(Calendar.SECOND), testResult);
}
@@ -281,19 +281,19 @@ public class DateUtilsFragmentTest {
@Test
public void testMillisecondsOfHourWithDate() {
- long testResult = DateUtils.getFragmentInMilliseconds(aDate, Calendar.HOUR_OF_DAY);
+ final long testResult = DateUtils.getFragmentInMilliseconds(aDate, Calendar.HOUR_OF_DAY);
assertEquals(millis + (seconds * DateUtils.MILLIS_PER_SECOND) + (minutes * DateUtils.MILLIS_PER_MINUTE), testResult);
}
@Test
public void testMillisecondsOfHourWithCalendar() {
- long testResult = DateUtils.getFragmentInMilliseconds(aCalendar, Calendar.HOUR_OF_DAY);
+ final long testResult = DateUtils.getFragmentInMilliseconds(aCalendar, Calendar.HOUR_OF_DAY);
assertEquals(millis + (seconds * DateUtils.MILLIS_PER_SECOND) + (minutes * DateUtils.MILLIS_PER_MINUTE), testResult);
}
@Test
public void testSecondsofHourWithDate() {
- long testResult = DateUtils.getFragmentInSeconds(aDate, Calendar.HOUR_OF_DAY);
+ final long testResult = DateUtils.getFragmentInSeconds(aDate, Calendar.HOUR_OF_DAY);
assertEquals(
seconds
+ (minutes
@@ -303,7 +303,7 @@ public class DateUtilsFragmentTest {
@Test
public void testSecondsofHourWithCalendar() {
- long testResult = DateUtils.getFragmentInSeconds(aCalendar, Calendar.HOUR_OF_DAY);
+ final long testResult = DateUtils.getFragmentInSeconds(aCalendar, Calendar.HOUR_OF_DAY);
assertEquals(
seconds
+ (minutes
@@ -313,13 +313,13 @@ public class DateUtilsFragmentTest {
@Test
public void testMinutesOfHourWithDate() {
- long testResult = DateUtils.getFragmentInMinutes(aDate, Calendar.HOUR_OF_DAY);
+ final long testResult = DateUtils.getFragmentInMinutes(aDate, Calendar.HOUR_OF_DAY);
assertEquals(minutes, testResult);
}
@Test
public void testMinutesOfHourWithCalendar() {
- long testResult = DateUtils.getFragmentInMinutes(aCalendar, Calendar.HOUR_OF_DAY);
+ final long testResult = DateUtils.getFragmentInMinutes(aCalendar, Calendar.HOUR_OF_DAY);
assertEquals(minutes, testResult);
}
@@ -327,7 +327,7 @@ public class DateUtilsFragmentTest {
@Test
public void testMillisecondsOfDayWithDate() {
long testresult = DateUtils.getFragmentInMilliseconds(aDate, Calendar.DATE);
- long expectedValue = millis + (seconds * DateUtils.MILLIS_PER_SECOND) + (minutes * DateUtils.MILLIS_PER_MINUTE) + (hours * DateUtils.MILLIS_PER_HOUR);
+ final long expectedValue = millis + (seconds * DateUtils.MILLIS_PER_SECOND) + (minutes * DateUtils.MILLIS_PER_MINUTE) + (hours * DateUtils.MILLIS_PER_HOUR);
assertEquals(expectedValue, testresult);
testresult = DateUtils.getFragmentInMilliseconds(aDate, Calendar.DAY_OF_YEAR);
assertEquals(expectedValue, testresult);
@@ -336,7 +336,7 @@ public class DateUtilsFragmentTest {
@Test
public void testMillisecondsOfDayWithCalendar() {
long testresult = DateUtils.getFragmentInMilliseconds(aCalendar, Calendar.DATE);
- long expectedValue = millis + (seconds * DateUtils.MILLIS_PER_SECOND) + (minutes * DateUtils.MILLIS_PER_MINUTE) + (hours * DateUtils.MILLIS_PER_HOUR);
+ final long expectedValue = millis + (seconds * DateUtils.MILLIS_PER_SECOND) + (minutes * DateUtils.MILLIS_PER_MINUTE) + (hours * DateUtils.MILLIS_PER_HOUR);
assertEquals(expectedValue, testresult);
testresult = DateUtils.getFragmentInMilliseconds(aCalendar, Calendar.DAY_OF_YEAR);
assertEquals(expectedValue, testresult);
@@ -345,7 +345,7 @@ public class DateUtilsFragmentTest {
@Test
public void testSecondsOfDayWithDate() {
long testresult = DateUtils.getFragmentInSeconds(aDate, Calendar.DATE);
- long expectedValue = seconds + ((minutes * DateUtils.MILLIS_PER_MINUTE) + (hours * DateUtils.MILLIS_PER_HOUR))/ DateUtils.MILLIS_PER_SECOND;
+ final long expectedValue = seconds + ((minutes * DateUtils.MILLIS_PER_MINUTE) + (hours * DateUtils.MILLIS_PER_HOUR))/ DateUtils.MILLIS_PER_SECOND;
assertEquals(expectedValue, testresult);
testresult = DateUtils.getFragmentInSeconds(aDate, Calendar.DAY_OF_YEAR);
assertEquals(expectedValue, testresult);
@@ -354,7 +354,7 @@ public class DateUtilsFragmentTest {
@Test
public void testSecondsOfDayWithCalendar() {
long testresult = DateUtils.getFragmentInSeconds(aCalendar, Calendar.DATE);
- long expectedValue = seconds + ((minutes * DateUtils.MILLIS_PER_MINUTE) + (hours * DateUtils.MILLIS_PER_HOUR))/ DateUtils.MILLIS_PER_SECOND;
+ final long expectedValue = seconds + ((minutes * DateUtils.MILLIS_PER_MINUTE) + (hours * DateUtils.MILLIS_PER_HOUR))/ DateUtils.MILLIS_PER_SECOND;
assertEquals(expectedValue, testresult);
testresult = DateUtils.getFragmentInSeconds(aCalendar, Calendar.DAY_OF_YEAR);
assertEquals(expectedValue, testresult);
@@ -363,7 +363,7 @@ public class DateUtilsFragmentTest {
@Test
public void testMinutesOfDayWithDate() {
long testResult = DateUtils.getFragmentInMinutes(aDate, Calendar.DATE);
- long expectedValue = minutes + ((hours * DateUtils.MILLIS_PER_HOUR))/ DateUtils.MILLIS_PER_MINUTE;
+ final long expectedValue = minutes + ((hours * DateUtils.MILLIS_PER_HOUR))/ DateUtils.MILLIS_PER_MINUTE;
assertEquals(expectedValue,testResult);
testResult = DateUtils.getFragmentInMinutes(aDate, Calendar.DAY_OF_YEAR);
assertEquals(expectedValue,testResult);
@@ -372,7 +372,7 @@ public class DateUtilsFragmentTest {
@Test
public void testMinutesOfDayWithCalendar() {
long testResult = DateUtils.getFragmentInMinutes(aCalendar, Calendar.DATE);
- long expectedValue = minutes + ((hours * DateUtils.MILLIS_PER_HOUR))/ DateUtils.MILLIS_PER_MINUTE;
+ final long expectedValue = minutes + ((hours * DateUtils.MILLIS_PER_HOUR))/ DateUtils.MILLIS_PER_MINUTE;
assertEquals(expectedValue, testResult);
testResult = DateUtils.getFragmentInMinutes(aCalendar, Calendar.DAY_OF_YEAR);
assertEquals(expectedValue, testResult);
@@ -381,7 +381,7 @@ public class DateUtilsFragmentTest {
@Test
public void testHoursOfDayWithDate() {
long testResult = DateUtils.getFragmentInHours(aDate, Calendar.DATE);
- long expectedValue = hours;
+ final long expectedValue = hours;
assertEquals(expectedValue,testResult);
testResult = DateUtils.getFragmentInHours(aDate, Calendar.DAY_OF_YEAR);
assertEquals(expectedValue,testResult);
@@ -390,7 +390,7 @@ public class DateUtilsFragmentTest {
@Test
public void testHoursOfDayWithCalendar() {
long testResult = DateUtils.getFragmentInHours(aCalendar, Calendar.DATE);
- long expectedValue = hours;
+ final long expectedValue = hours;
assertEquals(expectedValue, testResult);
testResult = DateUtils.getFragmentInHours(aCalendar, Calendar.DAY_OF_YEAR);
assertEquals(expectedValue, testResult);
@@ -400,7 +400,7 @@ public class DateUtilsFragmentTest {
//Calendar.MONTH as useful fragment
@Test
public void testMillisecondsOfMonthWithDate() {
- long testResult = DateUtils.getFragmentInMilliseconds(aDate, Calendar.MONTH);
+ final long testResult = DateUtils.getFragmentInMilliseconds(aDate, Calendar.MONTH);
assertEquals(millis + (seconds * DateUtils.MILLIS_PER_SECOND) + (minutes * DateUtils.MILLIS_PER_MINUTE)
+ (hours * DateUtils.MILLIS_PER_HOUR) + (days * DateUtils.MILLIS_PER_DAY),
testResult);
@@ -408,7 +408,7 @@ public class DateUtilsFragmentTest {
@Test
public void testMillisecondsOfMonthWithCalendar() {
- long testResult = DateUtils.getFragmentInMilliseconds(aCalendar, Calendar.MONTH);
+ final long testResult = DateUtils.getFragmentInMilliseconds(aCalendar, Calendar.MONTH);
assertEquals(millis + (seconds * DateUtils.MILLIS_PER_SECOND) + (minutes * DateUtils.MILLIS_PER_MINUTE)
+ (hours * DateUtils.MILLIS_PER_HOUR) + (days * DateUtils.MILLIS_PER_DAY),
testResult);
@@ -416,7 +416,7 @@ testResult);
@Test
public void testSecondsOfMonthWithDate() {
- long testResult = DateUtils.getFragmentInSeconds(aDate, Calendar.MONTH);
+ final long testResult = DateUtils.getFragmentInSeconds(aDate, Calendar.MONTH);
assertEquals(
seconds
+ ((minutes * DateUtils.MILLIS_PER_MINUTE)
@@ -427,7 +427,7 @@ testResult);
@Test
public void testSecondsOfMonthWithCalendar() {
- long testResult = DateUtils.getFragmentInSeconds(aCalendar, Calendar.MONTH);
+ final long testResult = DateUtils.getFragmentInSeconds(aCalendar, Calendar.MONTH);
assertEquals(
seconds
+ ((minutes * DateUtils.MILLIS_PER_MINUTE)
@@ -438,7 +438,7 @@ testResult);
@Test
public void testMinutesOfMonthWithDate() {
- long testResult = DateUtils.getFragmentInMinutes(aDate, Calendar.MONTH);
+ final long testResult = DateUtils.getFragmentInMinutes(aDate, Calendar.MONTH);
assertEquals(minutes
+ ((hours * DateUtils.MILLIS_PER_HOUR) + (days * DateUtils.MILLIS_PER_DAY))
/ DateUtils.MILLIS_PER_MINUTE,
@@ -447,7 +447,7 @@ testResult);
@Test
public void testMinutesOfMonthWithCalendar() {
- long testResult = DateUtils.getFragmentInMinutes(aCalendar, Calendar.MONTH);
+ final long testResult = DateUtils.getFragmentInMinutes(aCalendar, Calendar.MONTH);
assertEquals( minutes +((hours * DateUtils.MILLIS_PER_HOUR) + (days * DateUtils.MILLIS_PER_DAY))
/ DateUtils.MILLIS_PER_MINUTE,
testResult);
@@ -455,7 +455,7 @@ testResult);
@Test
public void testHoursOfMonthWithDate() {
- long testResult = DateUtils.getFragmentInHours(aDate, Calendar.MONTH);
+ final long testResult = DateUtils.getFragmentInHours(aDate, Calendar.MONTH);
assertEquals(hours + ((days * DateUtils.MILLIS_PER_DAY))
/ DateUtils.MILLIS_PER_HOUR,
testResult);
@@ -463,7 +463,7 @@ testResult);
@Test
public void testHoursOfMonthWithCalendar() {
- long testResult = DateUtils.getFragmentInHours(aCalendar, Calendar.MONTH);
+ final long testResult = DateUtils.getFragmentInHours(aCalendar, Calendar.MONTH);
assertEquals( hours +((days * DateUtils.MILLIS_PER_DAY))
/ DateUtils.MILLIS_PER_HOUR,
testResult);
@@ -472,8 +472,8 @@ testResult);
//Calendar.YEAR as useful fragment
@Test
public void testMillisecondsOfYearWithDate() {
- long testResult = DateUtils.getFragmentInMilliseconds(aDate, Calendar.YEAR);
- Calendar cal = Calendar.getInstance();
+ final long testResult = DateUtils.getFragmentInMilliseconds(aDate, Calendar.YEAR);
+ final Calendar cal = Calendar.getInstance();
cal.setTime(aDate);
assertEquals(millis + (seconds * DateUtils.MILLIS_PER_SECOND) + (minutes * DateUtils.MILLIS_PER_MINUTE)
+ (hours * DateUtils.MILLIS_PER_HOUR) + (cal.get(Calendar.DAY_OF_YEAR) * DateUtils.MILLIS_PER_DAY),
@@ -482,7 +482,7 @@ testResult);
@Test
public void testMillisecondsOfYearWithCalendar() {
- long testResult = DateUtils.getFragmentInMilliseconds(aCalendar, Calendar.YEAR);
+ final long testResult = DateUtils.getFragmentInMilliseconds(aCalendar, Calendar.YEAR);
assertEquals(millis + (seconds * DateUtils.MILLIS_PER_SECOND) + (minutes * DateUtils.MILLIS_PER_MINUTE)
+ (hours * DateUtils.MILLIS_PER_HOUR) + (aCalendar.get(Calendar.DAY_OF_YEAR) * DateUtils.MILLIS_PER_DAY),
testResult);
@@ -490,8 +490,8 @@ testResult);
@Test
public void testSecondsOfYearWithDate() {
- long testResult = DateUtils.getFragmentInSeconds(aDate, Calendar.YEAR);
- Calendar cal = Calendar.getInstance();
+ final long testResult = DateUtils.getFragmentInSeconds(aDate, Calendar.YEAR);
+ final Calendar cal = Calendar.getInstance();
cal.setTime(aDate);
assertEquals(
seconds
@@ -503,7 +503,7 @@ testResult);
@Test
public void testSecondsOfYearWithCalendar() {
- long testResult = DateUtils.getFragmentInSeconds(aCalendar, Calendar.YEAR);
+ final long testResult = DateUtils.getFragmentInSeconds(aCalendar, Calendar.YEAR);
assertEquals(
seconds
+ ((minutes * DateUtils.MILLIS_PER_MINUTE)
@@ -514,8 +514,8 @@ testResult);
@Test
public void testMinutesOfYearWithDate() {
- long testResult = DateUtils.getFragmentInMinutes(aDate, Calendar.YEAR);
- Calendar cal = Calendar.getInstance();
+ final long testResult = DateUtils.getFragmentInMinutes(aDate, Calendar.YEAR);
+ final Calendar cal = Calendar.getInstance();
cal.setTime(aDate);
assertEquals(minutes
+ ((hours * DateUtils.MILLIS_PER_HOUR) + (cal.get(Calendar.DAY_OF_YEAR) * DateUtils.MILLIS_PER_DAY))
@@ -525,7 +525,7 @@ testResult);
@Test
public void testMinutesOfYearWithCalendar() {
- long testResult = DateUtils.getFragmentInMinutes(aCalendar, Calendar.YEAR);
+ final long testResult = DateUtils.getFragmentInMinutes(aCalendar, Calendar.YEAR);
assertEquals( minutes +((hours * DateUtils.MILLIS_PER_HOUR) + (aCalendar.get(Calendar.DAY_OF_YEAR) * DateUtils.MILLIS_PER_DAY))
/ DateUtils.MILLIS_PER_MINUTE,
testResult);
@@ -533,8 +533,8 @@ testResult);
@Test
public void testHoursOfYearWithDate() {
- long testResult = DateUtils.getFragmentInHours(aDate, Calendar.YEAR);
- Calendar cal = Calendar.getInstance();
+ final long testResult = DateUtils.getFragmentInHours(aDate, Calendar.YEAR);
+ final Calendar cal = Calendar.getInstance();
cal.setTime(aDate);
assertEquals(hours + ((cal.get(Calendar.DAY_OF_YEAR) * DateUtils.MILLIS_PER_DAY))
/ DateUtils.MILLIS_PER_HOUR,
@@ -543,7 +543,7 @@ testResult);
@Test
public void testHoursOfYearWithCalendar() {
- long testResult = DateUtils.getFragmentInHours(aCalendar, Calendar.YEAR);
+ final long testResult = DateUtils.getFragmentInHours(aCalendar, Calendar.YEAR);
assertEquals( hours +((aCalendar.get(Calendar.DAY_OF_YEAR) * DateUtils.MILLIS_PER_DAY))
/ DateUtils.MILLIS_PER_HOUR,
testResult);