### Question:
ChildrenExtractor implements FromJsonFormat<Set<String>> { @Override public Set<String> fromJson(String json) { try { return childrenOf(objectMapper.readValue(json, ObjectNode.class)); } catch (IOException e) { throw new SagaException("Failed to deserialize json " + json, e); } }  @Override Set<String> fromJson(String json);  }### Answer:
@Test public void extractsChildrenIdFromJson() throws Exception { Set<String> children = extractor.fromJson(json); assertThat(children, containsInAnyOrder("id1", "id2", "id3")); }
@Test public void emptyChildrenIfNoSuchField() throws Exception { Set<String> children = extractor.fromJson("{}"); assertThat(children.isEmpty(), is(true)); }
@Test public void emptyChildrenIfNoneResponse() throws Exception { Set<String> children = extractor.fromJson(SagaResponse.NONE_RESPONSE.body()); assertThat(children, containsInAnyOrder("none")); }
@Test public void blowsUpWithInvalidJson() throws Exception { try { extractor.fromJson("blah"); expectFailing(SagaException.class); } catch (SagaException e) { assertThat(e.getMessage(), is("Failed to deserialize json blah")); } }