Add tests for simple reflection methods

This commit is contained in:
Mark Vainomaa 2016-12-16 17:15:58 +02:00
parent 44ed555bf3
commit 3a303ed20b
2 changed files with 18 additions and 0 deletions

View File

@ -0,0 +1,5 @@
package eu.mikroskeem.utils.test.reflect;
public class SimpleReflectionTestClass {
private String FOOBAR = "nope";
}

View File

@ -62,4 +62,17 @@ public class TestReflect {
String value = (String)Reflect.readField(bazfed, null);
Assert.assertEquals("no yeah man :(", value);
}
@Test
public void testSimpleReadField(){
SimpleReflectionTestClass testClass = new SimpleReflectionTestClass();
Assert.assertEquals("nope", Reflect.simpleReadField(testClass, "FOOBAR"));
}
@Test
public void testSimpleWriteField(){
SimpleReflectionTestClass testClass = new SimpleReflectionTestClass();
Reflect.simpleWriteField(testClass, "FOOBAR", "yeah");
Assert.assertEquals("yeah", Reflect.simpleReadField(testClass, "FOOBAR"));
}
}