Commit 603dd2c2 authored by Ard Schrijvers's avatar Ard Schrijvers

HSTTWO-4166 Fix unit test setup

parent 6e13b877
/*
* Copyright 2011-2013 Hippo B.V. (http://www.onehippo.com)
* Copyright 2011-2018 Hippo B.V. (http://www.onehippo.com)
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
......@@ -19,6 +19,7 @@ import static org.junit.Assert.assertEquals;
import org.easymock.EasyMock;
import org.hippoecm.hst.core.container.HstContainerURL;
import org.hippoecm.hst.core.request.ResolvedMount;
import org.hippoecm.hst.mock.core.request.MockHstRequestContext;
import org.junit.Test;
import org.springframework.mock.web.MockHttpServletRequest;
......@@ -36,6 +37,13 @@ public class TestCXFJaxrsService {
EasyMock.expect(baseURL.getContextPath()).andReturn("/app1").anyTimes();
EasyMock.expect(baseURL.getResolvedMountPath()).andReturn("/mount1").anyTimes();
EasyMock.replay(baseURL);
final ResolvedMount resolvedMount = EasyMock.createNiceMock(ResolvedMount.class);
EasyMock.expect(resolvedMount.getMatchingIgnoredPrefix()).andStubReturn(null);
EasyMock.replay(resolvedMount);
requestContext.setResolvedMount(resolvedMount);
requestContext.setBaseURL(baseURL);
String pathInfo = service.getJaxrsPathInfo(requestContext, request);
......@@ -49,6 +57,8 @@ public class TestCXFJaxrsService {
EasyMock.expect(baseURL.getResolvedMountPath()).andReturn("/mount1").anyTimes();
EasyMock.replay(baseURL);
requestContext.setBaseURL(baseURL);
requestContext.setResolvedMount(resolvedMount);
pathInfo = service.getJaxrsPathInfo(requestContext, request);
assertEquals("/", pathInfo);
......@@ -61,7 +71,9 @@ public class TestCXFJaxrsService {
EasyMock.expect(baseURL.getResolvedMountPath()).andReturn("/mount1").anyTimes();
EasyMock.replay(baseURL);
requestContext.setBaseURL(baseURL);
requestContext.setResolvedMount(resolvedMount);
pathInfo = service.getJaxrsPathInfo(requestContext, request);
assertEquals("/a/b/c", pathInfo);
}
......@@ -75,6 +87,14 @@ public class TestCXFJaxrsService {
EasyMock.expect(baseURL.getContextPath()).andReturn("/app1").anyTimes();
EasyMock.expect(baseURL.getResolvedMountPath()).andReturn("/mount1").anyTimes();
EasyMock.replay(baseURL);
final ResolvedMount resolvedMount = EasyMock.createNiceMock(ResolvedMount.class);
EasyMock.expect(resolvedMount.getMatchingIgnoredPrefix()).andStubReturn(null);
EasyMock.replay(resolvedMount);
requestContext.setResolvedMount(resolvedMount);
requestContext.setBaseURL(baseURL);
String pathInfo = service.getJaxrsPathInfo(requestContext, request);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment