Skip to content

Commit

Permalink
[WICKET-7069] Refactor assertTrue(equals()) using assertEquals (#601
Browse files Browse the repository at this point in the history
)

* Refactor assertTrue(equals()) using assertEquals

* Refactor throws Exception using assertThrows

* Revert "Refactor throws Exception using assertThrows"

This reverts commit d667baf.

* Fix assertEquals parameters as (expected, actual)

* Fix test case failures by converting tokens into strings
  • Loading branch information
Taher-Ghaleb authored Aug 24, 2023
1 parent 0969663 commit 3928c38
Showing 1 changed file with 9 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -67,31 +67,31 @@ void tagParsing() throws Exception
final ComponentTag aOpen = (ComponentTag)markupStream.next();

log.info("", aOpen);
assertTrue(aOpen.getName().equals("a"));
assertEquals("a", aOpen.getName());
assertEquals("foo.html", aOpen.getAttributes().getString("href"));

markupStream.next();

final ComponentTag boldOpen = (ComponentTag)markupStream.next();

log.info("", boldOpen);
assertTrue(boldOpen.getName().equals("b"));
assertEquals("b", boldOpen.getName());
assertEquals(TagType.OPEN, boldOpen.getType());

markupStream.next();

final ComponentTag boldClose = (ComponentTag)markupStream.next();

log.info("", boldClose);
assertTrue(boldClose.getName().equals("b"));
assertEquals("b", boldClose.getName());
assertEquals(TagType.CLOSE, boldClose.getType());

markupStream.next();

final ComponentTag img = (ComponentTag)markupStream.next();

log.info("", img);
assertTrue(img.getName().equals("img"));
assertEquals("img", img.getName());
assertEquals(9, img.getAttributes().getInt("width"));
assertEquals(10, img.getAttributes().getInt("height"));
assertEquals(TagType.OPEN, img.getType());
Expand All @@ -101,15 +101,15 @@ void tagParsing() throws Exception
final ComponentTag marker = (ComponentTag)markupStream.next();

log.info("", marker);
assertTrue(marker.getName().equals("marker"));
assertEquals("marker", marker.getName());
assertEquals(TagType.OPEN_CLOSE, marker.getType());

markupStream.next();

final ComponentTag aClose = (ComponentTag)markupStream.next();

log.info("", aClose);
assertTrue(aClose.getName().equals("a"));
assertEquals("a", aClose.getName());

assertNull(markupStream.next());
}
Expand All @@ -133,12 +133,12 @@ final void test1() throws Exception
log.info("tok(4)=" + tokens.get(4));
log.info("tok(5)=" + tokens.get(5));

assertTrue(tokens.get(0).equals("This is a test "));
assertEquals("This is a test ", tokens.get(0).toString());

final ComponentTag a = (ComponentTag)tokens.get(1);

assertEquals(9, a.getAttributes().getInt("componentName:id"));
assertTrue(tokens.get(2).equals(" <b>bold</b> "));
assertEquals(" <b>bold</b> ", tokens.get(2).toString());

final ComponentTag b = (ComponentTag)tokens.get(3);

Expand All @@ -147,7 +147,7 @@ final void test1() throws Exception
final ComponentTag closeA = (ComponentTag)tokens.get(5);

assertEquals("a", closeA.getName());
assertTrue(tokens.get(6).equals(" of the emergency broadcasting system"));
assertEquals(" of the emergency broadcasting system", tokens.get(6).toString());
}

/**
Expand Down

0 comments on commit 3928c38

Please sign in to comment.