3333@ MyCoReTest
3434public class MCRURLFunctionsTests {
3535
36- private static final String XSL = "/xslt/functions/url-test.xsl" ;
37-
38- private static final String FUNCTION_PARAM_NAME = "fn-name" ;
3936 private static final String URL_PARAM_NAME = "url" ;
4037 private static final String PAR_PARAM_NAME = "par" ;
4138 private static final String VALUE_PARAM_NAME = "value" ;
4239
43- private static final String URI_PREFIX = "http://mycore.org" ;
40+ private static final String URL_PREFIX = "http://mycore.org" ;
4441
4542 @ ParameterizedTest
4643 @ CsvSource ({
@@ -61,7 +58,7 @@ public class MCRURLFunctionsTests {
6158 "'?foo', foo, ''"
6259 })
6360 public void testGetParam (String queryUrl , String param , String expected ) throws Exception {
64- assertEquals (expected , getParam (URI_PREFIX + queryUrl , param ));
61+ assertEquals (expected , getParam (URL_PREFIX + queryUrl , param ));
6562 }
6663
6764 @ ParameterizedTest
@@ -84,7 +81,7 @@ public void testGetParam(String queryUrl, String param, String expected) throws
8481 "'?my-param=bar', my-param, os, '?my-param=os'"
8582 })
8683 public void testSetParam (String queryUrl , String param , String value , String expected ) throws Exception {
87- assertEquals (URI_PREFIX + expected , setParam (URI_PREFIX + queryUrl , param , value ));
84+ assertEquals (URL_PREFIX + expected , setParam (URL_PREFIX + queryUrl , param , value ));
8885 }
8986
9087 @ ParameterizedTest
@@ -107,7 +104,7 @@ public void testSetParam(String queryUrl, String param, String value, String exp
107104 "'?foo=bar&foo=os', foo, '?foo=os'"
108105 })
109106 public void testDelParam (String queryUrl , String param , String expected ) throws Exception {
110- assertEquals (URI_PREFIX + expected , delParam (URI_PREFIX + queryUrl , param ));
107+ assertEquals (URL_PREFIX + expected , delParam (URL_PREFIX + queryUrl , param ));
111108 }
112109
113110 private String getParam (String url , String param ) throws TransformerException {
@@ -125,7 +122,7 @@ private String setParam(String url, String param, String value) throws Transform
125122 return callFunction ("set-param" , parameters );
126123 }
127124
128- public String delParam (String url , String param ) throws TransformerException {
125+ private String delParam (String url , String param ) throws TransformerException {
129126 Map <String , String > parameters = new HashMap <>();
130127 parameters .put (URL_PARAM_NAME , url );
131128 parameters .put (PAR_PARAM_NAME , param );
@@ -134,7 +131,7 @@ public String delParam(String url, String param) throws TransformerException {
134131
135132 private String callFunction (String name , Map <String , String > params ) throws TransformerException {
136133 Map <String , Object > parameters = new HashMap <>(params );
137- parameters .put (FUNCTION_PARAM_NAME , name );
138- return MCRTestCaseXSLTUtil .transform (XSL , parameters ).getRootElement ().getText ();
134+ parameters .put ("fn-name" , name );
135+ return MCRTestCaseXSLTUtil .transform ("/xslt/functions/url-test.xsl" , parameters ).getRootElement ().getText ();
139136 }
140137}
0 commit comments