DXJob extends DXExecution { @Override public <T> T getOutput(Class<T> outputClass) throws IllegalStateException { Describe d = describeImpl(DXJSON .getObjectBuilder() .put("fields", DXJSON.getObjectBuilder().put("output", true).put("state", true) .build()).build()); if (d.getState() != JobState.DONE) { throw new IllegalStateException("Expected job to be in state DONE, but it is in state " + d.getState()); } return d.getOutput(outputClass); } private  DXJob(String jobId); private  DXJob(String jobId, DXEnvironment env); private  DXJob(String jobId, DXEnvironment env, JsonNode cachedDescribe); static DXJob getInstance(String jobId); static DXJob getInstanceWithEnvironment(String jobId, DXEnvironment env); @Override Describe describe(); @Override Describe getCachedDescribe(); @Override T getOutput(Class<T> outputClass); @Override void terminate(); @Override DXJob waitUntilDone();  }
@Test public void testJobDescribeDeserializationWithNullValues() throws IOException { String describeJson = "{\"id\": \"job-000000000000000000000000\"}"; DXJob.Describe describe = new DXJob.Describe(DXJSON.safeTreeToValue( DXJSON.parseJson(describeJson), DXJob.DescribeResponseHash.class), DXEnvironment.create()); Assert.assertEquals("job-000000000000000000000000", describe.getId()); try { describe.getInput(ExampleInput.class); Assert.fail("Expected retrieving input to fail"); } catch (IllegalStateException e) { } try { describe.getOriginalInput(ExampleInput.class); Assert.fail("Expected retrieving original input to fail"); } catch (IllegalStateException e) { } try { describe.getRunInput(ExampleInput.class); Assert.fail("Expected retrieving run input to fail"); } catch (IllegalStateException e) { } try { describe.getOutput(ExampleOutput.class); Assert.fail("Expected retrieving output to fail"); } catch (IllegalStateException e) { } describeJson = "{\"id\": \"job-000000000000000000000000\", \"output\": null}"; describe = new DXJob.Describe(DXJSON.safeTreeToValue(DXJSON.parseJson(describeJson), DXJob.DescribeResponseHash.class), DXEnvironment.create()); Assert.assertEquals("job-000000000000000000000000", describe.getId()); Assert.assertEquals(null, describe.getOutput(ExampleOutput.class)); }