@Test public void buildUrl_allFieldsSet_correspondingUrlReturned() throws Exception { final String expectedUrl = "https: "&regExp=dummy&textType=normal&oneTextLine=true&oneWordPerTextLine=true" + "&markingType=simpleText&placeholdersCount=1&writingStyle=default&description=dummy&pdfPassword=dummy"; ProcessTextFieldInput sut = (ProcessTextFieldInput) new ProcessTextFieldInput.Builder() .language("English") .letterSet("dummy") .regExp("dummy") .textType(TextType.NORMAL.toString()) .oneTextLine(String.valueOf(true)) .oneWordPerTextLine(String.valueOf(true)) .markingType(MarkingType.SIMPLE_TEXT.toString()) .placeholdersCount(String.valueOf(1)) .description("dummy") .pdfPassword("dummy") .writingStyle(WritingStyle.DEFAULT.toString()) .locationId(LocationId.EU.toString()) .build(); String url = sut.getUrl(); assertEquals(expectedUrl, url); }
@Override public @NotNull String getUrl() throws URISyntaxException { URIBuilder urlBuilder = new URIBuilder() .setScheme(this.getLocationId().getProtocol()) .setHost(String.format(Urls.HOST_TEMPLATE, this.getLocationId().toString(), Endpoints.PROCESS_TEXT_FIELD)); if (this.getRegion() != null) { urlBuilder.addParameter(QueryParams.REGION, this.getRegion().toString()); } if (this.getLanguages() != null && !this.getLanguages().isEmpty()) { urlBuilder.addParameter(QueryParams.LANGUAGE, StringUtils.join(this.getLanguages(), ',')); } if (StringUtils.isNotEmpty(this.getLetterSet())) { urlBuilder.addParameter(QueryParams.LETTER_SET, this.getLetterSet()); } if (StringUtils.isNotEmpty(this.getRegExp())) { urlBuilder.addParameter(QueryParams.REG_EXP, this.getRegExp()); } if (this.getTextType() != null) { urlBuilder.addParameter(QueryParams.TEXT_TYPE, this.getTextType().toString()); } urlBuilder.addParameter(QueryParams.ONE_TEXT_LINE, String.valueOf(this.isOneTextLine())); urlBuilder.addParameter(QueryParams.ONE_WORD_PER_TEXT_LINE, String.valueOf(this.isOneWordPerTextLine())); if (this.getMarkingType() != null) { urlBuilder.addParameter(QueryParams.MARKING_TYPE, this.getMarkingType().toString()); } urlBuilder.addParameter(QueryParams.PLACEHOLDERS_COUNT, String.valueOf(this.getPlaceholdersCount())); if (this.getWritingStyle() != null) { urlBuilder.addParameter(QueryParams.WRITING_STYLE, this.getWritingStyle().toString()); } if (StringUtils.isNotEmpty(this.getDescription())) { urlBuilder.addParameter(QueryParams.DESCRIPTION, this.getDescription()); } if (StringUtils.isNotEmpty(this.getPdfPassword())) { urlBuilder.addParameter(QueryParams.PDF_PASSWORD, this.getPdfPassword()); } return urlBuilder.build().toString(); }
ProcessTextFieldInput extends AbbyyInput { @Override public @NotNull String getUrl() throws URISyntaxException { URIBuilder urlBuilder = new URIBuilder() .setScheme(this.getLocationId().getProtocol()) .setHost(String.format(Urls.HOST_TEMPLATE, this.getLocationId().toString(), Endpoints.PROCESS_TEXT_FIELD)); if (this.getRegion() != null) { urlBuilder.addParameter(QueryParams.REGION, this.getRegion().toString()); } if (this.getLanguages() != null && !this.getLanguages().isEmpty()) { urlBuilder.addParameter(QueryParams.LANGUAGE, StringUtils.join(this.getLanguages(), ',')); } if (StringUtils.isNotEmpty(this.getLetterSet())) { urlBuilder.addParameter(QueryParams.LETTER_SET, this.getLetterSet()); } if (StringUtils.isNotEmpty(this.getRegExp())) { urlBuilder.addParameter(QueryParams.REG_EXP, this.getRegExp()); } if (this.getTextType() != null) { urlBuilder.addParameter(QueryParams.TEXT_TYPE, this.getTextType().toString()); } urlBuilder.addParameter(QueryParams.ONE_TEXT_LINE, String.valueOf(this.isOneTextLine())); urlBuilder.addParameter(QueryParams.ONE_WORD_PER_TEXT_LINE, String.valueOf(this.isOneWordPerTextLine())); if (this.getMarkingType() != null) { urlBuilder.addParameter(QueryParams.MARKING_TYPE, this.getMarkingType().toString()); } urlBuilder.addParameter(QueryParams.PLACEHOLDERS_COUNT, String.valueOf(this.getPlaceholdersCount())); if (this.getWritingStyle() != null) { urlBuilder.addParameter(QueryParams.WRITING_STYLE, this.getWritingStyle().toString()); } if (StringUtils.isNotEmpty(this.getDescription())) { urlBuilder.addParameter(QueryParams.DESCRIPTION, this.getDescription()); } if (StringUtils.isNotEmpty(this.getPdfPassword())) { urlBuilder.addParameter(QueryParams.PDF_PASSWORD, this.getPdfPassword()); } return urlBuilder.build().toString(); } }
ProcessTextFieldInput extends AbbyyInput { @Override public @NotNull String getUrl() throws URISyntaxException { URIBuilder urlBuilder = new URIBuilder() .setScheme(this.getLocationId().getProtocol()) .setHost(String.format(Urls.HOST_TEMPLATE, this.getLocationId().toString(), Endpoints.PROCESS_TEXT_FIELD)); if (this.getRegion() != null) { urlBuilder.addParameter(QueryParams.REGION, this.getRegion().toString()); } if (this.getLanguages() != null && !this.getLanguages().isEmpty()) { urlBuilder.addParameter(QueryParams.LANGUAGE, StringUtils.join(this.getLanguages(), ',')); } if (StringUtils.isNotEmpty(this.getLetterSet())) { urlBuilder.addParameter(QueryParams.LETTER_SET, this.getLetterSet()); } if (StringUtils.isNotEmpty(this.getRegExp())) { urlBuilder.addParameter(QueryParams.REG_EXP, this.getRegExp()); } if (this.getTextType() != null) { urlBuilder.addParameter(QueryParams.TEXT_TYPE, this.getTextType().toString()); } urlBuilder.addParameter(QueryParams.ONE_TEXT_LINE, String.valueOf(this.isOneTextLine())); urlBuilder.addParameter(QueryParams.ONE_WORD_PER_TEXT_LINE, String.valueOf(this.isOneWordPerTextLine())); if (this.getMarkingType() != null) { urlBuilder.addParameter(QueryParams.MARKING_TYPE, this.getMarkingType().toString()); } urlBuilder.addParameter(QueryParams.PLACEHOLDERS_COUNT, String.valueOf(this.getPlaceholdersCount())); if (this.getWritingStyle() != null) { urlBuilder.addParameter(QueryParams.WRITING_STYLE, this.getWritingStyle().toString()); } if (StringUtils.isNotEmpty(this.getDescription())) { urlBuilder.addParameter(QueryParams.DESCRIPTION, this.getDescription()); } if (StringUtils.isNotEmpty(this.getPdfPassword())) { urlBuilder.addParameter(QueryParams.PDF_PASSWORD, this.getPdfPassword()); } return urlBuilder.build().toString(); } private  ProcessTextFieldInput(Builder builder); }
ProcessTextFieldInput extends AbbyyInput { @Override public @NotNull String getUrl() throws URISyntaxException { URIBuilder urlBuilder = new URIBuilder() .setScheme(this.getLocationId().getProtocol()) .setHost(String.format(Urls.HOST_TEMPLATE, this.getLocationId().toString(), Endpoints.PROCESS_TEXT_FIELD)); if (this.getRegion() != null) { urlBuilder.addParameter(QueryParams.REGION, this.getRegion().toString()); } if (this.getLanguages() != null && !this.getLanguages().isEmpty()) { urlBuilder.addParameter(QueryParams.LANGUAGE, StringUtils.join(this.getLanguages(), ',')); } if (StringUtils.isNotEmpty(this.getLetterSet())) { urlBuilder.addParameter(QueryParams.LETTER_SET, this.getLetterSet()); } if (StringUtils.isNotEmpty(this.getRegExp())) { urlBuilder.addParameter(QueryParams.REG_EXP, this.getRegExp()); } if (this.getTextType() != null) { urlBuilder.addParameter(QueryParams.TEXT_TYPE, this.getTextType().toString()); } urlBuilder.addParameter(QueryParams.ONE_TEXT_LINE, String.valueOf(this.isOneTextLine())); urlBuilder.addParameter(QueryParams.ONE_WORD_PER_TEXT_LINE, String.valueOf(this.isOneWordPerTextLine())); if (this.getMarkingType() != null) { urlBuilder.addParameter(QueryParams.MARKING_TYPE, this.getMarkingType().toString()); } urlBuilder.addParameter(QueryParams.PLACEHOLDERS_COUNT, String.valueOf(this.getPlaceholdersCount())); if (this.getWritingStyle() != null) { urlBuilder.addParameter(QueryParams.WRITING_STYLE, this.getWritingStyle().toString()); } if (StringUtils.isNotEmpty(this.getDescription())) { urlBuilder.addParameter(QueryParams.DESCRIPTION, this.getDescription()); } if (StringUtils.isNotEmpty(this.getPdfPassword())) { urlBuilder.addParameter(QueryParams.PDF_PASSWORD, this.getPdfPassword()); } return urlBuilder.build().toString(); } private  ProcessTextFieldInput(Builder builder); Region getRegion(); List<String> getLanguages(); String getLetterSet(); String getRegExp(); TextType getTextType(); Boolean isOneTextLine(); Boolean isOneWordPerTextLine(); MarkingType getMarkingType(); Integer getPlaceholdersCount(); WritingStyle getWritingStyle(); String getDescription(); String getPdfPassword(); @Override @NotNull String getUrl(); }
ProcessTextFieldInput extends AbbyyInput { @Override public @NotNull String getUrl() throws URISyntaxException { URIBuilder urlBuilder = new URIBuilder() .setScheme(this.getLocationId().getProtocol()) .setHost(String.format(Urls.HOST_TEMPLATE, this.getLocationId().toString(), Endpoints.PROCESS_TEXT_FIELD)); if (this.getRegion() != null) { urlBuilder.addParameter(QueryParams.REGION, this.getRegion().toString()); } if (this.getLanguages() != null && !this.getLanguages().isEmpty()) { urlBuilder.addParameter(QueryParams.LANGUAGE, StringUtils.join(this.getLanguages(), ',')); } if (StringUtils.isNotEmpty(this.getLetterSet())) { urlBuilder.addParameter(QueryParams.LETTER_SET, this.getLetterSet()); } if (StringUtils.isNotEmpty(this.getRegExp())) { urlBuilder.addParameter(QueryParams.REG_EXP, this.getRegExp()); } if (this.getTextType() != null) { urlBuilder.addParameter(QueryParams.TEXT_TYPE, this.getTextType().toString()); } urlBuilder.addParameter(QueryParams.ONE_TEXT_LINE, String.valueOf(this.isOneTextLine())); urlBuilder.addParameter(QueryParams.ONE_WORD_PER_TEXT_LINE, String.valueOf(this.isOneWordPerTextLine())); if (this.getMarkingType() != null) { urlBuilder.addParameter(QueryParams.MARKING_TYPE, this.getMarkingType().toString()); } urlBuilder.addParameter(QueryParams.PLACEHOLDERS_COUNT, String.valueOf(this.getPlaceholdersCount())); if (this.getWritingStyle() != null) { urlBuilder.addParameter(QueryParams.WRITING_STYLE, this.getWritingStyle().toString()); } if (StringUtils.isNotEmpty(this.getDescription())) { urlBuilder.addParameter(QueryParams.DESCRIPTION, this.getDescription()); } if (StringUtils.isNotEmpty(this.getPdfPassword())) { urlBuilder.addParameter(QueryParams.PDF_PASSWORD, this.getPdfPassword()); } return urlBuilder.build().toString(); } private  ProcessTextFieldInput(Builder builder); Region getRegion(); List<String> getLanguages(); String getLetterSet(); String getRegExp(); TextType getTextType(); Boolean isOneTextLine(); Boolean isOneWordPerTextLine(); MarkingType getMarkingType(); Integer getPlaceholdersCount(); WritingStyle getWritingStyle(); String getDescription(); String getPdfPassword(); @Override @NotNull String getUrl();  }