Polish: assertion arguments should be passed in the correct order,

use assertNull instead of assertEquals(null, value),
declare delta as double value in assertEquals
This commit is contained in:
igor-suhorukov
2018-02-10 15:41:55 +03:00
committed by Juergen Hoeller
parent 39201adca4
commit 0ee505b73e
36 changed files with 142 additions and 142 deletions

View File

@@ -37,9 +37,9 @@ public class ConstantsTests {
assertEquals(A.class.getName(), c.getClassName());
assertEquals(9, c.getSize());
assertEquals(c.asNumber("DOG").intValue(), A.DOG);
assertEquals(c.asNumber("dog").intValue(), A.DOG);
assertEquals(c.asNumber("cat").intValue(), A.CAT);
assertEquals(A.DOG, c.asNumber("DOG").intValue());
assertEquals(A.DOG, c.asNumber("dog").intValue());
assertEquals(A.CAT, c.asNumber("cat").intValue());
try {
c.asNumber("bogus");
@@ -152,20 +152,20 @@ public class ConstantsTests {
public void toCode() {
Constants c = new Constants(A.class);
assertEquals(c.toCode(new Integer(0), ""), "DOG");
assertEquals(c.toCode(new Integer(0), "D"), "DOG");
assertEquals(c.toCode(new Integer(0), "DO"), "DOG");
assertEquals(c.toCode(new Integer(0), "DoG"), "DOG");
assertEquals(c.toCode(new Integer(0), null), "DOG");
assertEquals(c.toCode(new Integer(66), ""), "CAT");
assertEquals(c.toCode(new Integer(66), "C"), "CAT");
assertEquals(c.toCode(new Integer(66), "ca"), "CAT");
assertEquals(c.toCode(new Integer(66), "cAt"), "CAT");
assertEquals(c.toCode(new Integer(66), null), "CAT");
assertEquals(c.toCode("", ""), "S1");
assertEquals(c.toCode("", "s"), "S1");
assertEquals(c.toCode("", "s1"), "S1");
assertEquals(c.toCode("", null), "S1");
assertEquals("DOG", c.toCode(new Integer(0), ""));
assertEquals("DOG", c.toCode(new Integer(0), "D"));
assertEquals("DOG", c.toCode(new Integer(0), "DO"));
assertEquals("DOG", c.toCode(new Integer(0), "DoG"));
assertEquals("DOG", c.toCode(new Integer(0), null));
assertEquals("CAT", c.toCode(new Integer(66), ""));
assertEquals("CAT", c.toCode(new Integer(66), "C"));
assertEquals("CAT", c.toCode(new Integer(66), "ca"));
assertEquals("CAT", c.toCode(new Integer(66), "cAt"));
assertEquals("CAT", c.toCode(new Integer(66), null));
assertEquals("S1", c.toCode("", ""));
assertEquals("S1", c.toCode("", "s"));
assertEquals("S1", c.toCode("", "s1"));
assertEquals("S1", c.toCode("", null));
try {
c.toCode("bogus", "bogus");
fail("Should have thrown ConstantException");
@@ -179,8 +179,8 @@ public class ConstantsTests {
catch (Constants.ConstantException expected) {
}
assertEquals(c.toCodeForProperty(new Integer(1), "myProperty"), "MY_PROPERTY_NO");
assertEquals(c.toCodeForProperty(new Integer(2), "myProperty"), "MY_PROPERTY_YES");
assertEquals("MY_PROPERTY_NO", c.toCodeForProperty(new Integer(1), "myProperty"));
assertEquals("MY_PROPERTY_YES", c.toCodeForProperty(new Integer(2), "myProperty"));
try {
c.toCodeForProperty("bogus", "bogus");
fail("Should have thrown ConstantException");
@@ -188,20 +188,20 @@ public class ConstantsTests {
catch (Constants.ConstantException expected) {
}
assertEquals(c.toCodeForSuffix(new Integer(0), ""), "DOG");
assertEquals(c.toCodeForSuffix(new Integer(0), "G"), "DOG");
assertEquals(c.toCodeForSuffix(new Integer(0), "OG"), "DOG");
assertEquals(c.toCodeForSuffix(new Integer(0), "DoG"), "DOG");
assertEquals(c.toCodeForSuffix(new Integer(0), null), "DOG");
assertEquals(c.toCodeForSuffix(new Integer(66), ""), "CAT");
assertEquals(c.toCodeForSuffix(new Integer(66), "T"), "CAT");
assertEquals(c.toCodeForSuffix(new Integer(66), "at"), "CAT");
assertEquals(c.toCodeForSuffix(new Integer(66), "cAt"), "CAT");
assertEquals(c.toCodeForSuffix(new Integer(66), null), "CAT");
assertEquals(c.toCodeForSuffix("", ""), "S1");
assertEquals(c.toCodeForSuffix("", "1"), "S1");
assertEquals(c.toCodeForSuffix("", "s1"), "S1");
assertEquals(c.toCodeForSuffix("", null), "S1");
assertEquals("DOG", c.toCodeForSuffix(new Integer(0), ""));
assertEquals("DOG", c.toCodeForSuffix(new Integer(0), "G"));
assertEquals("DOG", c.toCodeForSuffix(new Integer(0), "OG"));
assertEquals("DOG", c.toCodeForSuffix(new Integer(0), "DoG"));
assertEquals("DOG", c.toCodeForSuffix(new Integer(0), null));
assertEquals("CAT", c.toCodeForSuffix(new Integer(66), ""));
assertEquals("CAT", c.toCodeForSuffix(new Integer(66), "T"));
assertEquals("CAT", c.toCodeForSuffix(new Integer(66), "at"));
assertEquals("CAT", c.toCodeForSuffix(new Integer(66), "cAt"));
assertEquals("CAT", c.toCodeForSuffix(new Integer(66), null));
assertEquals("S1", c.toCodeForSuffix("", ""));
assertEquals("S1", c.toCodeForSuffix("", "1"));
assertEquals("S1", c.toCodeForSuffix("", "s1"));
assertEquals("S1", c.toCodeForSuffix("", null));
try {
c.toCodeForSuffix("bogus", "bogus");
fail("Should have thrown ConstantException");

View File

@@ -96,7 +96,7 @@ public class MutablePropertySourcesTests {
assertThat(sources.size(), equalTo(6));
assertThat(sources.contains("a"), is(false));
assertEquals(sources.remove("a"), null);
assertNull(sources.remove("a"));
assertThat(sources.size(), equalTo(6));
String bogusPS = "bogus";

View File

@@ -365,7 +365,7 @@ public class AnnotationMetadataTests {
assertArrayEquals(new String[] { Void.class.getName() }, (String[]) optionalArray[0].get("classArray"));
assertArrayEquals(new String[] { Void.class.getName() }, optionalArray[0].getStringArray("classArray"));
assertEquals(metadata.getAnnotationAttributes(DirectAnnotation.class.getName()).get("value"), "direct");
assertEquals("direct", metadata.getAnnotationAttributes(DirectAnnotation.class.getName()).get("value"));
allMeta = metadata.getAllAnnotationAttributes(DirectAnnotation.class.getName()).get("value");
assertThat(new HashSet<>(allMeta), is(equalTo(new HashSet<Object>(Arrays.asList("direct", "meta")))));
}

View File

@@ -167,7 +167,7 @@ public class FastByteArrayOutputStreamTests {
this.os.write(this.helloBytes);
InputStream inputStream = this.os.getInputStream();
assertEquals(inputStream.read(), this.helloBytes[0]);
assertEquals(inputStream.skip(1), 1);
assertEquals(1, inputStream.skip(1));
assertEquals(inputStream.read(), this.helloBytes[2]);
assertEquals(this.helloBytes.length - 3, inputStream.available());
}