### Question:
Duration extends TimeBase<Duration> { public static Duration fromJsonObject(JsonObject jsonObject) { int secs = jsonObject.containsKey(Duration.FIELD_SECS) ? jsonObject .getInt(Duration.FIELD_SECS) : 0; int nsecs = jsonObject.containsKey(Duration.FIELD_NSECS) ? jsonObject .getInt(Duration.FIELD_NSECS) : 0; return new Duration(secs, nsecs); } Duration();  Duration(int secs, int nsecs);  Duration(double sec);  Duration(long nano); @Override Duration add(Duration d); @Override Duration subtract(Duration d); boolean sleep(); @Override Duration clone(); static Duration fromSec(double sec); static Duration fromNano(long nano); static Duration fromJsonString(String jsonString); static Duration fromJsonObject(JsonObject jsonObject); static final String TYPE; }### Answer:
@Test public void testFromJsonObject() { JsonObject jsonObject = Json.createObjectBuilder() .add(Duration.FIELD_SECS, d1.getSecs()) .add(Duration.FIELD_NSECS, d1.getNsecs()).build(); Duration d = Duration.fromJsonObject(jsonObject); assertEquals(d1.toString(), d.toString()); assertEquals(d1.toJsonObject(), d.toJsonObject()); assertEquals(d1.getPrimitiveType(), d.getPrimitiveType()); assertEquals(d1.getSecs(), d.getSecs()); assertEquals(d1.getNsecs(), d.getNsecs()); assertEquals(d1.toSec(), d.toSec(), 0); assertEquals(d1.toNSec(), d.toNSec()); assertNotSame(d1, d); assertNotSame(d1.toString(), d.toString()); assertNotSame(d1.toJsonObject(), d.toJsonObject()); }