Skip to content

Commit

Permalink
Changed exception check by JUnit API usage (#6133)
Browse files Browse the repository at this point in the history
  • Loading branch information
gvma committed Apr 5, 2021
1 parent 25b96fa commit e3c87fc
Showing 1 changed file with 5 additions and 10 deletions.
15 changes: 5 additions & 10 deletions jetty-http/src/test/java/org/eclipse/jetty/http/SyntaxTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
import static org.hamcrest.MatcherAssert.assertThat;
import static org.hamcrest.Matchers.allOf;
import static org.hamcrest.Matchers.containsString;
import static org.junit.jupiter.api.Assertions.assertThrows;
import static org.junit.jupiter.api.Assertions.fail;

public class SyntaxTest
Expand Down Expand Up @@ -61,17 +62,11 @@ public void testRequireValidRFC2616TokenBad()

for (String token : tokens)
{
try
{
Syntax.requireValidRFC2616Token(token, "Test Based");
fail("RFC2616 Token [" + token + "] Should have thrown " + IllegalArgumentException.class.getName());
}
catch (IllegalArgumentException e)
{
assertThat("Testing Bad RFC2616 Token [" + token + "]", e.getMessage(),
Throwable e = assertThrows(IllegalArgumentException.class,
() -> Syntax.requireValidRFC2616Token(token, "Test Based"));
assertThat("Testing Bad RFC2616 Token [" + token + "]", e.getMessage(),
allOf(containsString("Test Based"),
containsString("RFC2616")));
}
containsString("RFC2616")));
}
}

Expand Down

0 comments on commit e3c87fc

Please sign in to comment.