Conversation
|
@TheRealHaui You need to run mvn spotless:apply to correctly format the source code. |
|
@gnodet, |
| private Plugin pluginOne; | ||
| private Plugin pluginTwo; | ||
|
|
||
| @BeforeEach |
There was a problem hiding this comment.
could just initialize the fields
There was a problem hiding this comment.
Which then would lead every test method having
private Plugin pluginOne = new Plugin();
private Plugin pluginTwo = new Plugin();
at the beginning repeatedly.
Don't you think that using the (at)BeforeEach approach is better?
There was a problem hiding this comment.
No, that is not how JUnit works. Just initialize the fields. A new test object is used for every test.
There was a problem hiding this comment.
I knew of course because of the way JUnit works that it specifically instantiates objects.
However, wasn't aware of that - test adapted and pushed.
impl/maven-xml/src/test/java/org/apache/maven/internal/xml/XmlNodeBuilderTest.java
Outdated
Show resolved
Hide resolved
| private Plugin pluginOne; | ||
| private Plugin pluginTwo; | ||
|
|
||
| @BeforeEach |
There was a problem hiding this comment.
No, that is not how JUnit works. Just initialize the fields. A new test object is used for every test.
| XmlNode node1 = XmlService.read(r); | ||
| XmlNode node2 = XmlService.read(r); | ||
| assertEquals(node1, node2); | ||
|
|
There was a problem hiding this comment.
This should be a separate test method
Added new Unit Tests