use of org.springframework.tests.sample.objects.TestObject in project spring-framework by spring-projects.
the class ConventionsTests method set.
@Test
void set() {
assertThat(Conventions.getVariableName(Collections.singleton(new TestObject()))).as("Incorrect plural Set form").isEqualTo("testObjectList");
assertThat(Conventions.getVariableNameForParameter(getMethodParameter(Set.class))).as("Incorrect plural Set form").isEqualTo("testObjectList");
assertThat(Conventions.getVariableNameForReturnType(getMethodForReturnType(Set.class))).as("Incorrect plural Set form").isEqualTo("testObjectList");
}
use of org.springframework.tests.sample.objects.TestObject in project spring-framework by spring-projects.
the class ConventionsTests method list.
@Test
void list() {
assertThat(Conventions.getVariableName(Collections.singletonList(new TestObject()))).as("Incorrect plural List form").isEqualTo("testObjectList");
assertThat(Conventions.getVariableNameForParameter(getMethodParameter(List.class))).as("Incorrect plural List form").isEqualTo("testObjectList");
assertThat(Conventions.getVariableNameForReturnType(getMethodForReturnType(List.class))).as("Incorrect plural List form").isEqualTo("testObjectList");
}
use of org.springframework.tests.sample.objects.TestObject in project spring-framework by spring-projects.
the class ConventionsTests method array.
@Test
void array() {
Object actual = Conventions.getVariableName(new TestObject[0]);
assertThat(actual).as("Incorrect plural array form").isEqualTo("testObjectList");
}
use of org.springframework.tests.sample.objects.TestObject in project spring-framework by spring-projects.
the class ReflectionUtilsTests method copySrcToDestinationOfIncorrectClass.
@Test
void copySrcToDestinationOfIncorrectClass() {
TestObject src = new TestObject();
String dest = new String();
assertThatIllegalArgumentException().isThrownBy(() -> ReflectionUtils.shallowCopyFieldState(src, dest));
}
use of org.springframework.tests.sample.objects.TestObject in project spring-framework by spring-projects.
the class ReflectionUtilsTests method validCopyToSubType.
@Test
void validCopyToSubType() {
TestObject src = new TestObject();
TestObjectSubclassWithNewField dest = new TestObjectSubclassWithNewField();
dest.magic = 11;
testValidCopy(src, dest);
// Should have left this one alone
assertThat(dest.magic).isEqualTo(11);
}
Aggregations