Changed exception check by JUnit API usage (#6133)
This commit is contained in:
parent
25b96faa86
commit
e3c87fc2af
|
@ -18,6 +18,7 @@ import org.junit.jupiter.api.Test;
|
||||||
import static org.hamcrest.MatcherAssert.assertThat;
|
import static org.hamcrest.MatcherAssert.assertThat;
|
||||||
import static org.hamcrest.Matchers.allOf;
|
import static org.hamcrest.Matchers.allOf;
|
||||||
import static org.hamcrest.Matchers.containsString;
|
import static org.hamcrest.Matchers.containsString;
|
||||||
|
import static org.junit.jupiter.api.Assertions.assertThrows;
|
||||||
import static org.junit.jupiter.api.Assertions.fail;
|
import static org.junit.jupiter.api.Assertions.fail;
|
||||||
|
|
||||||
public class SyntaxTest
|
public class SyntaxTest
|
||||||
|
@ -61,19 +62,13 @@ public class SyntaxTest
|
||||||
|
|
||||||
for (String token : tokens)
|
for (String token : tokens)
|
||||||
{
|
{
|
||||||
try
|
Throwable e = assertThrows(IllegalArgumentException.class,
|
||||||
{
|
() -> Syntax.requireValidRFC2616Token(token, "Test Based"));
|
||||||
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(),
|
assertThat("Testing Bad RFC2616 Token [" + token + "]", e.getMessage(),
|
||||||
allOf(containsString("Test Based"),
|
allOf(containsString("Test Based"),
|
||||||
containsString("RFC2616")));
|
containsString("RFC2616")));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testRequireValidRFC6265CookieValueGood()
|
public void testRequireValidRFC6265CookieValueGood()
|
||||||
|
|
Loading…
Reference in New Issue