use of org.pac4j.core.context.MockWebContext in project pac4j by pac4j.
the class DefaultUrlResolverTests method testCompute_whenServerIsNotUsingDefaultHttpPort.
@Test
public void testCompute_whenServerIsNotUsingDefaultHttpPort() {
final MockWebContext context = MockWebContext.create();
context.setServerName("pac4j.com");
context.setServerPort(8080);
final String result = resolver.compute("/cas/login", context);
assertEquals("http://pac4j.com:8080/cas/login", result);
}
use of org.pac4j.core.context.MockWebContext in project pac4j by pac4j.
the class HeaderMatcherTests method testNullExpectedValueNull.
@Test
public void testNullExpectedValueNull() {
final HeaderMatcher matcher = new HeaderMatcher(NAME, null);
final MockWebContext context = MockWebContext.create();
assertTrue(matcher.matches(context));
}
use of org.pac4j.core.context.MockWebContext in project pac4j by pac4j.
the class HttpMethodMatcherTests method testGoodMethod.
@Test
public void testGoodMethod() {
final HttpMethodMatcher matcher = new HttpMethodMatcher(HTTP_METHOD.POST);
final MockWebContext context = MockWebContext.create().setRequestMethod(HTTP_METHOD.POST.name());
assertTrue(matcher.matches(context));
}
use of org.pac4j.core.context.MockWebContext in project pac4j by pac4j.
the class HttpMethodMatcherTests method testGoodMethod2.
@Test
public void testGoodMethod2() {
final HttpMethodMatcher matcher = new HttpMethodMatcher(HTTP_METHOD.DELETE, HTTP_METHOD.POST);
final MockWebContext context = MockWebContext.create().setRequestMethod(HTTP_METHOD.POST.name());
assertTrue(matcher.matches(context));
}
use of org.pac4j.core.context.MockWebContext in project pac4j by pac4j.
the class HttpMethodMatcherTests method testBadMethod2.
@Test
public void testBadMethod2() {
final HttpMethodMatcher matcher = new HttpMethodMatcher(HTTP_METHOD.GET, HTTP_METHOD.PUT);
final MockWebContext context = MockWebContext.create().setRequestMethod(HTTP_METHOD.POST.name());
assertFalse(matcher.matches(context));
}
Aggregations