|
@@ -0,0 +1,26 @@
|
|
1
|
+package com.reactnativenavigation.utils;
|
|
2
|
+
|
|
3
|
+import com.reactnativenavigation.BaseTest;
|
|
4
|
+
|
|
5
|
+import org.junit.Test;
|
|
6
|
+
|
|
7
|
+import static org.assertj.core.api.Java6Assertions.assertThat;
|
|
8
|
+
|
|
9
|
+public class ReflectionUtilsTest extends BaseTest {
|
|
10
|
+
|
|
11
|
+ static class Foo {
|
|
12
|
+ private String bar = "old value";
|
|
13
|
+ }
|
|
14
|
+
|
|
15
|
+ @Test
|
|
16
|
+ public void setField() throws Exception {
|
|
17
|
+ Foo target = new Foo();
|
|
18
|
+ ReflectionUtils.setField(target, "bar", "a new value");
|
|
19
|
+ assertThat(target.bar).isEqualTo("a new value");
|
|
20
|
+ }
|
|
21
|
+
|
|
22
|
+ @Test
|
|
23
|
+ public void getDeclaredField() throws Exception {
|
|
24
|
+ assertThat(ReflectionUtils.getDeclaredField(new Foo(), "bar")).isEqualTo("old value");
|
|
25
|
+ }
|
|
26
|
+}
|