ApplyPreparationExportStrategy extends BaseSampleExportStrategy { @Override public boolean test(ExportParameters parameters) { if (parameters == null) { return false; } return parameters.getContent() == null && !StringUtils.isEmpty(parameters.getDatasetId()) && !StringUtils.isEmpty(parameters.getPreparationId()); }  @Override boolean test(ExportParameters parameters); @Override StreamingResponseBody execute(ExportParameters parameters);  }
@Test public void shouldNotAcceptNullParameter() throws Exception { assertFalse(applyPreparationExportStrategy.test(null)); }
@Test public void shouldNotAcceptIfDataSetParameterNotSet() throws Exception { final ExportParameters parameters = new ExportParameters(); parameters.setDatasetId(""); parameters.setPreparationId("1234"); parameters.setStepId("0"); parameters.setExportType("text"); parameters.setFrom(ExportParameters.SourceType.HEAD); assertFalse(applyPreparationExportStrategy.test(parameters)); }
@Test public void shouldNotAcceptIfPreparationParameterNotSet() throws Exception { final ExportParameters parameters = new ExportParameters(); parameters.setDatasetId("1234"); parameters.setPreparationId(""); parameters.setStepId("0"); parameters.setExportType("text"); parameters.setFrom(ExportParameters.SourceType.HEAD); assertFalse(applyPreparationExportStrategy.test(parameters)); }
@Test public void shouldAcceptIfDataSetAndPreparationParametersSet() throws Exception { final ExportParameters parameters = new ExportParameters(); parameters.setDatasetId("1234"); parameters.setPreparationId("1234"); assertTrue(applyPreparationExportStrategy.test(parameters)); }