### Question:
SplitByEveryRadioButton extends RadioButton implements SplitParametersBuilderCreator, RestorableView, ResettableView { @Override public SplitByEveryXPagesParametersBuilder getBuilder(Consumer<String> onError) { this.field.validate(); if (this.field.getValidationState() == ValidationState.VALID) { return new SplitByEveryXPagesParametersBuilder(Integer.parseInt(this.field.getText())); } onError.accept(DefaultI18nContext.getInstance().i18n("Invalid number of pages")); return null; } SplitByEveryRadioButton(ValidableTextField field); @Override SplitByEveryXPagesParametersBuilder getBuilder(Consumer<String> onError); @Override void saveStateTo(Map<String, String> data); @Override void restoreStateFrom(Map<String, String> data); @Override void resetView();  }### Answer:
@Test public void invalidBuilder() { ValidableTextField field = lookup("#field").queryAs(ValidableTextField.class); assertEquals(ValidationState.NOT_VALIDATED, field.getValidationState()); clickOn(field).write("Chuck").push(KeyCode.ENTER); victim.getBuilder(onError); verify(onError).accept(anyString()); }
@Test public void builder() throws Exception { ValidableTextField field = lookup("#field").queryAs(ValidableTextField.class); assertEquals(ValidationState.NOT_VALIDATED, field.getValidationState()); clickOn(field).type(KeyCode.DIGIT6).push(KeyCode.ENTER); final File file = folder.newFile("my.pdf"); SplitByEveryXPagesParametersBuilder builder = victim.getBuilder(onError); builder.compress(true); FileOrDirectoryTaskOutput output = mock(FileOrDirectoryTaskOutput.class); builder.output(output); builder.existingOutput(ExistingOutputPolicy.OVERWRITE); builder.prefix("prefix"); PdfFileSource source = PdfFileSource.newInstanceNoPassword(file); builder.source(source); builder.version(PdfVersion.VERSION_1_7); SplitByEveryXPagesParameters params = builder.build(); assertTrue(params.isCompress()); assertEquals(ExistingOutputPolicy.OVERWRITE, params.getExistingOutputPolicy()); assertEquals(PdfVersion.VERSION_1_7, params.getVersion()); assertThat(params.getPages(20), contains(6, 12, 18)); assertEquals("prefix", params.getOutputPrefix()); assertEquals(output, params.getOutput()); assertEquals(source, params.getSourceList().get(0)); verify(onError, never()).accept(anyString()); }