garydgregory commented on code in PR #1328:
URL: https://github.com/apache/commons-lang/pull/1328#discussion_r1871403397
##########
src/test/java/org/apache/commons/lang3/builder/ToStringBuilderTest.java:
##########
@@ -229,21 +230,33 @@ public void assertReflectionArray(final String expected,
final Object actual) {
*/
@Test
public void test_setUpToClass_invalid() {
- final Integer val = Integer.valueOf(5);
+ final HirAFixture val = new HirAFixture();
final ReflectionToStringBuilder test = new
ReflectionToStringBuilder(val);
assertThrows(IllegalArgumentException.class, () ->
test.setUpToClass(String.class));
test.toString();
}
+ private static class HirAFixture extends HirBFixture {
+ int x = 1;
+ }
+
+ private static class HirBFixture extends HirCFixture {
+ int y = 2;
+ }
+
+ private static class HirCFixture {
Review Comment:
What does "Hir" mean?
##########
src/test/java/org/apache/commons/lang3/builder/ToStringBuilderTest.java:
##########
@@ -229,21 +230,33 @@ public void assertReflectionArray(final String expected,
final Object actual) {
*/
@Test
public void test_setUpToClass_invalid() {
- final Integer val = Integer.valueOf(5);
+ final HirAFixture val = new HirAFixture();
final ReflectionToStringBuilder test = new
ReflectionToStringBuilder(val);
assertThrows(IllegalArgumentException.class, () ->
test.setUpToClass(String.class));
test.toString();
}
+ private static class HirAFixture extends HirBFixture {
+ int x = 1;
+ }
+
+ private static class HirBFixture extends HirCFixture {
+ int y = 2;
+ }
+
+ private static class HirCFixture {
+ int z = 3;
+ }
+
/**
* Tests ReflectionToStringBuilder setUpToClass().
*/
@Test
public void test_setUpToClass_valid() {
- final Integer val = Integer.valueOf(5);
+ final HirAFixture val = new HirAFixture();
final ReflectionToStringBuilder test = new
ReflectionToStringBuilder(val);
- test.setUpToClass(Number.class);
Review Comment:
I think we should leave simpler test fixtures in place. Then, the PR can add
more complex objects. We want to keep testing simple things IMO, this makes it
easier to learn how the code works I think. Maybe this new feature should be
tested in a new test class.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]