@Test public void should_map_entity_to_form() throws Exception { JobFormEntity preparedEntity = formFactory.givenJobFormEntityWithValues(); JobForm.Builder form = formFactory.givenJobFormBuilderWithValues(); mapperUnderTest.mapEntityOnForm(form, preparedEntity); JobSource source = form.build().getSource(); assertThat(source.getUri(), is("/my/uri")); assertThat(source.getParameters(), hasItem(new ReportParameter("key", Collections.singleton("value")))); }
@Override public void mapEntityOnForm(JobForm.Builder form, JobFormEntity entity) { JobSource.Builder builder = new JobSource.Builder(); builder.withUri(entity.getSourceUri()); Map<String, Set<String>> parameters = entity.getSourceParameters(); if (parameters != null) { List<ReportParameter> params = mapParams(parameters); builder.withParameters(params); } JobSource source = builder.build(); form.withJobSource(source); }
JobSourceMapper extends JobMapper { @Override public void mapEntityOnForm(JobForm.Builder form, JobFormEntity entity) { JobSource.Builder builder = new JobSource.Builder(); builder.withUri(entity.getSourceUri()); Map<String, Set<String>> parameters = entity.getSourceParameters(); if (parameters != null) { List<ReportParameter> params = mapParams(parameters); builder.withParameters(params); } JobSource source = builder.build(); form.withJobSource(source); } }
JobSourceMapper extends JobMapper { @Override public void mapEntityOnForm(JobForm.Builder form, JobFormEntity entity) { JobSource.Builder builder = new JobSource.Builder(); builder.withUri(entity.getSourceUri()); Map<String, Set<String>> parameters = entity.getSourceParameters(); if (parameters != null) { List<ReportParameter> params = mapParams(parameters); builder.withParameters(params); } JobSource source = builder.build(); form.withJobSource(source); }  }
JobSourceMapper extends JobMapper { @Override public void mapEntityOnForm(JobForm.Builder form, JobFormEntity entity) { JobSource.Builder builder = new JobSource.Builder(); builder.withUri(entity.getSourceUri()); Map<String, Set<String>> parameters = entity.getSourceParameters(); if (parameters != null) { List<ReportParameter> params = mapParams(parameters); builder.withParameters(params); } JobSource source = builder.build(); form.withJobSource(source); }  @Override void mapFormOnEntity(JobForm form, JobFormEntity entity); @Override void mapEntityOnForm(JobForm.Builder form, JobFormEntity entity); }
JobSourceMapper extends JobMapper { @Override public void mapEntityOnForm(JobForm.Builder form, JobFormEntity entity) { JobSource.Builder builder = new JobSource.Builder(); builder.withUri(entity.getSourceUri()); Map<String, Set<String>> parameters = entity.getSourceParameters(); if (parameters != null) { List<ReportParameter> params = mapParams(parameters); builder.withParameters(params); } JobSource source = builder.build(); form.withJobSource(source); }  @Override void mapFormOnEntity(JobForm form, JobFormEntity entity); @Override void mapEntityOnForm(JobForm.Builder form, JobFormEntity entity);  }