Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public static List<String> validate(ServiceTemplateType templateType, String htmlContent) {
- List<String> errors = simplePlaceholderValidator(htmlContent, templateType).validate(SimplePlaceholderValidationPattern.create()
- .templateWithType(LP_WAP_SUBSCRIBE_AOC)
- .shouldContain(SUBNAME, SUBPRICE, ACCOUNT, PROVIDER, TARIFF_YES_URL, TARIFF_NO_URL, LK_LINK_URL)
- .a().vot().etot().templateWithType(LP_WAP_PURCHASE_AOC)
- .shouldContain(ACCOUNT, PROVIDER, TARIFF_YES_URL, TARIFF_NO_URL, SERVICE_PRICE, SERVICE_NAME, EXPIRE_DATE, LK_LINK_URL)
- .a().next().templateWithType(LP_WAP_PURCHASE_ACCEPT)
- .shouldContain(SERVICE_NAME, EXPIRE_DATE, LK_LINK_URL)
- .and().templateWithType(LP_WAP_SUBSCRIBE_ACCEPT)
- .shouldContain(SUBNAME, LK_LINK_URL)
- .templateWithType(LP_WAP_SUBSCRIBE_ERROR)
- .shouldContain(SUBNAME, LK_LINK_URL)
- .templateWithType(LP_WEP_SUBSCRIBE_ERROR)
- .shouldContain(SUBNAME, LK_LINK_URL)
- .templateWithType(LP_WAP_PURCHASE_ERROR)
- .shouldContain(SERVICE_NAME, LK_LINK_URL)
- .templateWithType(LP_WAP_UNSUBSCRIBE_AOC)
- .shouldContain(SUBNAME, TARIFF_YES_URL, TARIFF_NO_URL, LK_LINK_URL)
- .templateWithType(LP_WEP_UNSUBSCRIBE_AOC)
- .shouldContain(SUBNAME, TARIFF_YES_URL, TARIFF_NO_URL, LK_LINK_URL)
- .templateWithType(LP_WEP_SUBSCRIBE_AUTHORIZATION)
- .shouldContain(MSISDN_INPUT, ACTION_FORM, CAPTCHA_INPUT, CAPTCHA_RELOAD_ELEM)
- .templateWithType(LP_WEP_SUBSCRIBE_AOC)
- .shouldContain(SUBNAME, SUBPRICE, ACCOUNT, PROVIDER, ACTION_FORM, SMS_CODE_INPUT)
- );
- // CAPTCHA_IMG
- if (LP_WEP_SUBSCRIBE_AUTHORIZATION.equals(templateType)) {
- Elements elements = Jsoup.parse(htmlContent).select("img[src~=" + CAPTCHA_IMG_SRC);
- if (CollectionUtils.isEmpty(elements)) {
- errors.add(CAPTCHA_IMG);
- }
- }
- return errors;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement