Skip to content

Commit

Permalink
Split one test into two in MarkupTextTest (#10226)
Browse files Browse the repository at this point in the history
* Update MarkupTextTest.java

Improves the readability of the test. Splitting assertions into separate tests improves clarity and ensures each test verifies a single scenario or state. This enhances readability, maintainability, and debugging efficiency.

* Update core/src/test/java/hudson/MarkupTextTest.java

Co-authored-by: Kris Stern <krisstern@outlook.com>

---------

Co-authored-by: Kris Stern <krisstern@outlook.com>
  • Loading branch information
Rian-Ismael and krisstern authored Feb 8, 2025
1 parent e61ecca commit 72d2b7b
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions core/src/test/java/hudson/MarkupTextTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -81,13 +81,16 @@ public void literalTextSurround() {
* Start/end tag nesting should be correct regardless of the order tags are added.
*/
@Test
public void adjacent() {
public void addMarkupInOrder() {
MarkupText text = new MarkupText("abcdef");
text.addMarkup(0, 3, "$", "$");
text.addMarkup(3, 6, "#", "#");
assertEquals("$abc$#def#", text.toString(false));
}

text = new MarkupText("abcdef");
@Test
public void addMarkupInReversedOrder() {
MarkupText text = new MarkupText("abcdef");
text.addMarkup(3, 6, "#", "#");
text.addMarkup(0, 3, "$", "$");
assertEquals("$abc$#def#", text.toString(false));
Expand Down

0 comments on commit 72d2b7b

Please sign in to comment.