use of org.apache.sling.testing.mock.sling.servlet.MockRequestPathInfo in project aem-core-cif-components by adobe.
the class ProductPageWithUrlPathTest method testParseWithNestedCategory.
@Test
public void testParseWithNestedCategory() {
MockRequestPathInfo pathInfo = new MockRequestPathInfo();
pathInfo.setResourcePath("/page/path");
pathInfo.setSuffix("/foo-bar/sub/category/deep.html");
ProductUrlFormat.Params parameters = subject.parse(pathInfo, null);
assertEquals("/page/path", parameters.getPage());
assertEquals("foo-bar/sub/category/deep", parameters.getUrlPath());
assertEquals("deep", parameters.getUrlKey());
assertEquals("foo-bar/sub/category", parameters.getCategoryUrlParams().getUrlPath());
assertEquals("category", parameters.getCategoryUrlParams().getUrlKey());
}
use of org.apache.sling.testing.mock.sling.servlet.MockRequestPathInfo in project aem-core-cif-components by adobe.
the class ProductPageWithCategoryAndUrlKeyTest method testParseNoCategory.
@Test
public void testParseNoCategory() {
MockRequestPathInfo pathInfo = new MockRequestPathInfo();
pathInfo.setResourcePath("/page/path");
pathInfo.setSuffix("/foo-bar.html");
ProductUrlFormat.Params parameters = subject.parse(pathInfo, null);
assertEquals("/page/path", parameters.getPage());
assertEquals("foo-bar", parameters.getUrlKey());
assertNull(parameters.getCategoryUrlParams().getUrlKey());
}
use of org.apache.sling.testing.mock.sling.servlet.MockRequestPathInfo in project aem-core-cif-components by adobe.
the class ProductPageWithSkuAndUrlKeyTest method testParseSuffixNoSlash.
@Test
public void testParseSuffixNoSlash() {
MockRequestPathInfo pathInfo = new MockRequestPathInfo();
pathInfo.setResourcePath("/page/path");
pathInfo.setSuffix("/foo-bar.html");
ProductUrlFormat.Params parameters = subject.parse(pathInfo, null);
assertEquals("/page/path", parameters.getPage());
assertEquals("foo-bar", parameters.getSku());
assertNull(parameters.getUrlKey());
}
use of org.apache.sling.testing.mock.sling.servlet.MockRequestPathInfo in project aem-core-cif-components by adobe.
the class ProductPageWithSkuAndUrlPathTest method testParseNoSuffix.
@Test
public void testParseNoSuffix() {
MockRequestPathInfo pathInfo = new MockRequestPathInfo();
pathInfo.setResourcePath("/page/path");
ProductUrlFormat.Params parameters = subject.parse(pathInfo, null);
assertEquals("/page/path", parameters.getPage());
assertNull(parameters.getSku());
assertNull(parameters.getUrlKey());
}
use of org.apache.sling.testing.mock.sling.servlet.MockRequestPathInfo in project aem-core-cif-components by adobe.
the class ProductPageWithSkuAndUrlPathTest method testParseSuffixOnlySku.
@Test
public void testParseSuffixOnlySku() {
MockRequestPathInfo pathInfo = new MockRequestPathInfo();
pathInfo.setResourcePath("/page/path");
pathInfo.setSuffix("/foo-bar.html");
ProductUrlFormat.Params parameters = subject.parse(pathInfo, null);
assertEquals("/page/path", parameters.getPage());
assertEquals("foo-bar", parameters.getSku());
assertNull(parameters.getUrlKey());
assertNull(parameters.getUrlPath());
}
Aggregations