AmpUtil { public static AMP_MODE getAmpMode(@NotNull SlingHttpServletRequest slingRequest) { PageManager pageManager = slingRequest.getResourceResolver().adaptTo(PageManager.class); if (pageManager != null) { Page page = pageManager.getContainingPage(slingRequest.getResource()); if (page != null) { String ampMode = page.getProperties().get(AMP_MODE_PROP, ""); if (!ampMode.isEmpty()) { return AMP_MODE.fromString(ampMode); } } } return AMP_MODE.fromString(getAmpPropertyFromPolicy(slingRequest)); }  static AMP_MODE getAmpMode(@NotNull SlingHttpServletRequest slingRequest); static final String AMP_SELECTOR; static final String DOT; }
@Test void isAmpModeWithDefaults() { context.currentResource("/content/no-amp"); assertEquals(AmpUtil.AMP_MODE.NO_AMP, AmpUtil.getAmpMode(context.request())); }
@Test void isAmpMode() { context.currentResource("/content/amp-only"); assertEquals(AmpUtil.AMP_MODE.AMP_ONLY, AmpUtil.getAmpMode(context.request())); }