JSONIntermediateDataFormat extends IntermediateDataFormat<JSONObject> { @Override public Object[] getObjectData() { super.validateSchema(schema); return toObject(data); } JSONIntermediateDataFormat();  JSONIntermediateDataFormat(Schema schema); @Override void setCSVTextData(String text); @Override String getCSVTextData(); @Override void setObjectData(Object[] data); @Override Object[] getObjectData(); @Override void write(DataOutput out); @Override void read(DataInput in); @Override Set<String> getJars(); @Override String toString();  }
@Test(expectedExceptions = SqoopException.class) public void testNullSchema() { dataFormat = new JSONIntermediateDataFormat(null); dataFormat.getObjectData(); }
@Test(expectedExceptions = SqoopException.class) public void testNotSettingSchemaAndGetObjectData() { dataFormat = new JSONIntermediateDataFormat(); dataFormat.getObjectData(); }
@SuppressWarnings("unchecked") @Test public void testNullValueAsDataInAndObjectArrayOut() { JSONObject json = new JSONObject(); for (int i = 1; i <= 15; i++) { json.put(String.valueOf(i), null); } dataFormat.setData(json); Object[] out = dataFormat.getObjectData(); assertEquals(15, out.length); for (Object obj : out) { assertEquals(obj, null); } }