Do unit tests right
This commit is contained in:
parent
0d6b255187
commit
3b3e6e1bcf
@ -10,8 +10,8 @@ import java.lang.reflect.Method;
|
||||
public class TestReflect {
|
||||
@Test
|
||||
public void testGetClass(){
|
||||
Assert.assertEquals(Reflect.getClass("java.lang.String"), String.class);
|
||||
Assert.assertNotEquals(Reflect.getClass("java.lang.Integer"), String.class);
|
||||
Assert.assertEquals(String.class, Reflect.getClass("java.lang.String"));
|
||||
Assert.assertNotEquals(String.class, Reflect.getClass("java.lang.Integer"));
|
||||
}
|
||||
|
||||
@Test
|
||||
@ -34,7 +34,7 @@ public class TestReflect {
|
||||
Class reflectClass = Reflect.getClass("eu.mikroskeem.utils.reflect.Reflect");
|
||||
Method method = Reflect.getMethod(reflectClass, "getClass", String.class);
|
||||
Class<?> resultClazz = (Class)Reflect.invokeMethod(method, null, "java.lang.String");
|
||||
Assert.assertEquals(resultClazz, String.class);
|
||||
Assert.assertEquals(String.class, resultClazz);
|
||||
}
|
||||
|
||||
@Test
|
||||
@ -51,7 +51,7 @@ public class TestReflect {
|
||||
Class reflectTestClass = Reflect.getClass("eu.mikroskeem.utils.test.reflect.ReflectionTestClass");
|
||||
Field foobarField = Reflect.getField(reflectTestClass, "FOOBAR");
|
||||
String value = (String)Reflect.readField(foobarField, null);
|
||||
Assert.assertEquals(value, "nope");
|
||||
Assert.assertEquals("nope", value);
|
||||
}
|
||||
|
||||
@Test
|
||||
@ -60,6 +60,6 @@ public class TestReflect {
|
||||
Field bazfed = Reflect.getField(reflectTestClass, "BAZFED");
|
||||
Reflect.writeField(bazfed, null, "no yeah man :(");
|
||||
String value = (String)Reflect.readField(bazfed, null);
|
||||
Assert.assertEquals(value, "no yeah man :(");
|
||||
Assert.assertEquals("no yeah man :(", value);
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user