Template { @SuppressWarnings("unused") public static @Nullable String getResourceTypeFromTemplatePath(@NotNull String templatePath) { if (templatePath == null) { return null; } String resource = null; Matcher matcher = TEMPLATE_PATH_PATTERN.matcher(templatePath); if (matcher.matches()) { resource = matcher.group(2) + "/components" + StringUtils.defaultString(matcher.group(3)) + "/page/" + matcher.group(4); } return resource; } private  Template(); @SuppressWarnings("unused") static @Nullable String getResourceTypeFromTemplatePath(@NotNull String templatePath); static boolean is(@NotNull Page page, @NotNull TemplatePathInfo @NotNull... templates); static boolean is(@NotNull Page page, @NotNull String @NotNull... templatePaths); static @Nullable TemplatePathInfo forTemplatePath(@NotNull String templatePath, @NotNull TemplatePathInfo @NotNull... templates); @SafeVarargs static @Nullable TemplatePathInfo forTemplatePath(@NotNull String templatePath,
      @NotNull Class<E> @NotNull... templateEnums); static @Nullable TemplatePathInfo forPage(@NotNull Page page, @NotNull TemplatePathInfo @NotNull... templates); @SafeVarargs static @Nullable TemplatePathInfo forPage(@NotNull Page page, @NotNull Class<E> @NotNull... templateEnums);  }
@Test void testGetResourceTypeFromTemplatePath() { assertNull(null, Template.getResourceTypeFromTemplatePath(null)); assertNull(null, Template.getResourceTypeFromTemplatePath("")); assertNull(null, Template.getResourceTypeFromTemplatePath("/apps")); assertEquals("app1/components/page/t1", Template.getResourceTypeFromTemplatePath("/apps/app1/templates/t1")); assertEquals("app1/components/page/t1", Template.getResourceTypeFromTemplatePath("/libs/app1/templates/t1")); assertEquals("aaa/app1/components/bbb/page/t1", Template.getResourceTypeFromTemplatePath("/apps/aaa/app1/templates/bbb/t1")); assertEquals("aaa/ddd/app1/components/bbb/ccc/page/t1", Template.getResourceTypeFromTemplatePath("/apps/aaa/ddd/app1/templates/bbb/ccc/t1")); }