use of org.apache.sling.testing.mock.sling.servlet.MockRequestPathInfo in project aem-core-cif-components by adobe.
the class ProductPageWithSkuAndUrlKeyTest method testParse.
@Test
public void testParse() {
MockRequestPathInfo pathInfo = new MockRequestPathInfo();
pathInfo.setResourcePath("/page/path");
pathInfo.setSuffix("/foo-bar/next-generation-foo-bar2021.html");
ProductUrlFormat.Params parameters = subject.parse(pathInfo, null);
assertEquals("/page/path", parameters.getPage());
assertEquals("foo-bar", parameters.getSku());
assertEquals("next-generation-foo-bar2021", parameters.getUrlKey());
}
use of org.apache.sling.testing.mock.sling.servlet.MockRequestPathInfo in project aem-core-cif-components by adobe.
the class ProductPageWithSkuAndUrlPathTest method testParseWithNestedCategory.
@Test
public void testParseWithNestedCategory() {
MockRequestPathInfo pathInfo = new MockRequestPathInfo();
pathInfo.setResourcePath("/page/path");
pathInfo.setSuffix("/foo-bar/top-level-category/sub-category/next-generation-foo-bar2021.html");
ProductUrlFormat.Params parameters = subject.parse(pathInfo, null);
assertEquals("/page/path", parameters.getPage());
assertEquals("foo-bar", parameters.getSku());
assertEquals("next-generation-foo-bar2021", parameters.getUrlKey());
assertEquals("top-level-category/sub-category/next-generation-foo-bar2021", parameters.getUrlPath());
assertEquals("top-level-category/sub-category", parameters.getCategoryUrlParams().getUrlPath());
assertEquals("sub-category", parameters.getCategoryUrlParams().getUrlKey());
}
use of org.apache.sling.testing.mock.sling.servlet.MockRequestPathInfo in project aem-core-cif-components by adobe.
the class ProductPageWithSkuAndUrlPathTest method testParseNoCategory.
@Test
public void testParseNoCategory() {
MockRequestPathInfo pathInfo = new MockRequestPathInfo();
pathInfo.setResourcePath("/page/path");
pathInfo.setSuffix("/foo-bar/next-generation-foo-bar2021.html");
ProductUrlFormat.Params parameters = subject.parse(pathInfo, null);
assertEquals("/page/path", parameters.getPage());
assertEquals("foo-bar", parameters.getSku());
assertEquals("next-generation-foo-bar2021", parameters.getUrlKey());
assertEquals("next-generation-foo-bar2021", parameters.getUrlPath());
assertNull(parameters.getCategoryUrlParams().getUrlPath());
assertNull(parameters.getCategoryUrlParams().getUrlKey());
}
use of org.apache.sling.testing.mock.sling.servlet.MockRequestPathInfo in project aem-core-cif-components by adobe.
the class ProductPageWithSkuAndUrlPathTest method testParse.
@Test
public void testParse() {
MockRequestPathInfo pathInfo = new MockRequestPathInfo();
pathInfo.setResourcePath("/page/path");
pathInfo.setSuffix("/foo-bar/top-level-category/next-generation-foo-bar2021.html");
ProductUrlFormat.Params parameters = subject.parse(pathInfo, null);
assertEquals("/page/path", parameters.getPage());
assertEquals("foo-bar", parameters.getSku());
assertEquals("next-generation-foo-bar2021", parameters.getUrlKey());
assertEquals("top-level-category/next-generation-foo-bar2021", parameters.getUrlPath());
assertEquals("top-level-category", parameters.getCategoryUrlParams().getUrlPath());
assertEquals("top-level-category", parameters.getCategoryUrlParams().getUrlKey());
}
use of org.apache.sling.testing.mock.sling.servlet.MockRequestPathInfo in project aem-core-cif-components by adobe.
the class ProductPageWithSkuCategoryAndUrlKeyTest 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());
assertNull(parameters.getCategoryUrlParams().getUrlKey());
}
Aggregations