ReportJsonPostProcessor implements PostProcessor<Report> { @Override public void postDeserialize(final Report report, final JsonElement jsonElement, final Gson gson) { addFeatureIndex(report); addFeatureInformationToScenarios(report); mergeBackgroundScenarios(report); } @Inject  ReportJsonPostProcessor(); @Override void postDeserialize(final Report report, final JsonElement jsonElement, final Gson gson); @Override void postSerialize(final JsonElement jsonElement, final Report report, final Gson gson);  }
@Test public void postDeserializeTest() { Report report = new Report(); List<Element> elements = new ArrayList<>(); Element backgroundElement = new Element(); List<Step> backgroundSteps = new ArrayList<>(); Step backgroundStep1 = new Step(); backgroundStep1.setName("background step 1"); backgroundSteps.add(backgroundStep1); Step backgroundStep2 = new Step(); backgroundStep2.setName("background step 2"); backgroundSteps.add(backgroundStep2); backgroundElement.setSteps(backgroundSteps); backgroundElement.setType("background"); elements.add(backgroundElement); Element element = new Element(); List<Tag> scenarioTags = new ArrayList<>(); Tag tag = new Tag(); tag.setName("@tag"); scenarioTags.add(tag); element.setTags(scenarioTags); List<Step> steps = new ArrayList<>(); Step step = new Step(); step.setName("element step 1"); steps.add(step); Step step2 = new Step(); step2.setName("element step 2"); steps.add(step2); element.setSteps(steps); elements.add(element); List<Tag> featureTags = new ArrayList<>(); Tag featureTag = new Tag(); tag.setName("@feature"); featureTags.add(featureTag); report.setTags(featureTags); report.setElements(elements); assertThat(report.getElements().size(), is(2)); assertThat(report.getElements().get(1).getTags().size(), is(1)); reportJsonPostProcessor.postDeserialize(report, null, null); assertThat(report.getElements().size(), is(1)); Element firstElement = report.getElements().get(0); assertThat(firstElement.getTags().size(), is(2)); List<Step> firstElementSteps = firstElement.getSteps(); assertThat(firstElementSteps.size(), is(4)); assertThat(firstElementSteps.get(0).getName(), is("background step 1")); assertThat(firstElementSteps.get(1).getName(), is("background step 2")); assertThat(firstElementSteps.get(2).getName(), is("element step 1")); assertThat(firstElementSteps.get(3).getName(), is("element step 2")); }