org.springframework.test.util.subpackage.StaticFields Java Examples

The following examples show how to use org.springframework.test.util.subpackage.StaticFields. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: ReflectionTestUtilsTests.java    From spring-analysis-note with MIT License 5 votes vote down vote up
@Test
public void setStaticFieldViaClass() throws Exception {
	setField(StaticFields.class, "publicField", "xxx");
	setField(StaticFields.class, "privateField", "yyy");

	assertEquals("public static field", "xxx", StaticFields.publicField);
	assertEquals("private static field", "yyy", StaticFields.getPrivateField());
}
 
Example #2
Source File: ReflectionTestUtilsTests.java    From spring4-understanding with Apache License 2.0 5 votes vote down vote up
@Test
public void setStaticFieldViaInstance() throws Exception {
	StaticFields staticFields = new StaticFields();
	setField(staticFields, null, "publicField", "xxx", null);
	setField(staticFields, null, "privateField", "yyy", null);

	assertEquals("public static field", "xxx", StaticFields.publicField);
	assertEquals("private static field", "yyy", StaticFields.getPrivateField());
}
 
Example #3
Source File: ReflectionTestUtilsTests.java    From spring4-understanding with Apache License 2.0 5 votes vote down vote up
@Test
public void setStaticFieldViaClassWithExplicitType() throws Exception {
	setField(StaticFields.class, "publicField", "xxx", String.class);
	setField(StaticFields.class, "privateField", "yyy", String.class);

	assertEquals("public static field", "xxx", StaticFields.publicField);
	assertEquals("private static field", "yyy", StaticFields.getPrivateField());
}
 
Example #4
Source File: ReflectionTestUtilsTests.java    From spring4-understanding with Apache License 2.0 5 votes vote down vote up
@Test
public void setStaticFieldViaClass() throws Exception {
	setField(StaticFields.class, "publicField", "xxx");
	setField(StaticFields.class, "privateField", "yyy");

	assertEquals("public static field", "xxx", StaticFields.publicField);
	assertEquals("private static field", "yyy", StaticFields.getPrivateField());
}
 
Example #5
Source File: ReflectionTestUtilsTests.java    From java-technology-stack with MIT License 5 votes vote down vote up
@Test
public void setStaticFieldViaInstance() throws Exception {
	StaticFields staticFields = new StaticFields();
	setField(staticFields, null, "publicField", "xxx", null);
	setField(staticFields, null, "privateField", "yyy", null);

	assertEquals("public static field", "xxx", StaticFields.publicField);
	assertEquals("private static field", "yyy", StaticFields.getPrivateField());
}
 
Example #6
Source File: ReflectionTestUtilsTests.java    From java-technology-stack with MIT License 5 votes vote down vote up
@Test
public void setStaticFieldViaClassWithExplicitType() throws Exception {
	setField(StaticFields.class, "publicField", "xxx", String.class);
	setField(StaticFields.class, "privateField", "yyy", String.class);

	assertEquals("public static field", "xxx", StaticFields.publicField);
	assertEquals("private static field", "yyy", StaticFields.getPrivateField());
}
 
Example #7
Source File: ReflectionTestUtilsTests.java    From java-technology-stack with MIT License 5 votes vote down vote up
@Test
public void setStaticFieldViaClass() throws Exception {
	setField(StaticFields.class, "publicField", "xxx");
	setField(StaticFields.class, "privateField", "yyy");

	assertEquals("public static field", "xxx", StaticFields.publicField);
	assertEquals("private static field", "yyy", StaticFields.getPrivateField());
}
 
Example #8
Source File: ReflectionTestUtilsTests.java    From spring-analysis-note with MIT License 5 votes vote down vote up
@Test
public void setStaticFieldViaInstance() throws Exception {
	StaticFields staticFields = new StaticFields();
	setField(staticFields, null, "publicField", "xxx", null);
	setField(staticFields, null, "privateField", "yyy", null);

	assertEquals("public static field", "xxx", StaticFields.publicField);
	assertEquals("private static field", "yyy", StaticFields.getPrivateField());
}
 
Example #9
Source File: ReflectionTestUtilsTests.java    From spring-analysis-note with MIT License 5 votes vote down vote up
@Test
public void setStaticFieldViaClassWithExplicitType() throws Exception {
	setField(StaticFields.class, "publicField", "xxx", String.class);
	setField(StaticFields.class, "privateField", "yyy", String.class);

	assertEquals("public static field", "xxx", StaticFields.publicField);
	assertEquals("private static field", "yyy", StaticFields.getPrivateField());
}
 
Example #10
Source File: ReflectionTestUtilsTests.java    From java-technology-stack with MIT License 4 votes vote down vote up
@Before
public void resetStaticFields() {
	StaticFields.reset();
}
 
Example #11
Source File: ReflectionTestUtilsTests.java    From spring-analysis-note with MIT License 4 votes vote down vote up
@Test
public void getStaticFieldViaInstance() throws Exception {
	StaticFields staticFields = new StaticFields();
	assertEquals("public static field", "public", getField(staticFields, "publicField"));
	assertEquals("private static field", "private", getField(staticFields, "privateField"));
}
 
Example #12
Source File: ReflectionTestUtilsTests.java    From spring-analysis-note with MIT License 4 votes vote down vote up
@Test
public void getStaticFieldViaClass() throws Exception {
	assertEquals("public static field", "public", getField(StaticFields.class, "publicField"));
	assertEquals("private static field", "private", getField(StaticFields.class, "privateField"));
}
 
Example #13
Source File: ReflectionTestUtilsTests.java    From java-technology-stack with MIT License 4 votes vote down vote up
@Test
public void getStaticFieldViaClass() throws Exception {
	assertEquals("public static field", "public", getField(StaticFields.class, "publicField"));
	assertEquals("private static field", "private", getField(StaticFields.class, "privateField"));
}
 
Example #14
Source File: ReflectionTestUtilsTests.java    From java-technology-stack with MIT License 4 votes vote down vote up
@Test
public void getStaticFieldViaInstance() throws Exception {
	StaticFields staticFields = new StaticFields();
	assertEquals("public static field", "public", getField(staticFields, "publicField"));
	assertEquals("private static field", "private", getField(staticFields, "privateField"));
}
 
Example #15
Source File: ReflectionTestUtilsTests.java    From spring4-understanding with Apache License 2.0 4 votes vote down vote up
@Before
public void resetStaticFields() {
	StaticFields.reset();
}
 
Example #16
Source File: ReflectionTestUtilsTests.java    From spring-analysis-note with MIT License 4 votes vote down vote up
@Before
public void resetStaticFields() {
	StaticFields.reset();
}
 
Example #17
Source File: ReflectionTestUtilsTests.java    From spring4-understanding with Apache License 2.0 4 votes vote down vote up
@Test
public void getStaticFieldViaClass() throws Exception {
	assertEquals("public static field", "public", getField(StaticFields.class, "publicField"));
	assertEquals("private static field", "private", getField(StaticFields.class, "privateField"));
}
 
Example #18
Source File: ReflectionTestUtilsTests.java    From spring4-understanding with Apache License 2.0 4 votes vote down vote up
@Test
public void getStaticFieldViaInstance() throws Exception {
	StaticFields staticFields = new StaticFields();
	assertEquals("public static field", "public", getField(staticFields, "publicField"));
	assertEquals("private static field", "private", getField(staticFields, "privateField"));
}