Source:
public void badInputs() throws Exception { TestUtils.assertException(IllegalArgumentException.class, () -> Account.fromJson(null), null); JSONObject badMetadata1 = new JSONObject().put("badKey", "badValue"); TestUtils.assertException(JSONException.class, () -> Account.fromJson(badMetadata1), null); JSONObject badMetadata2 = deepCopy(refAccountJson); badMetadata2.remove(ACCOUNT_ID_KEY); TestUtils.assertException(JSONException.class, () -> Account.fromJson(badMetadata2), null); JSONObject badMetadata3 = deepCopy(refAccountJson).put(Account.JSON_VERSION_KEY, 2); TestUtils.assertException(IllegalStateException.class, () -> Account.fromJson(badMetadata3), null); JSONObject badMetadata4 = deepCopy(refAccountJson).put(Account.STATUS_KEY, "invalidAccountStatus"); TestUtils.assertException(IllegalArgumentException.class, () -> Account.fromJson(badMetadata4), null); TestUtils.assertException(IllegalArgumentException.class, () -> Container.fromJson(null, refAccountId), null); JSONObject badMetadata5 = deepCopy(v1ContainerJsonList.get(0)).put(Container.STATUS_KEY, "invalidContainerStatus"); TestUtils.assertException(IllegalArgumentException.class, () -> Container.fromJson(badMetadata5, refAccountId), null); JSONObject badMetadata6 = deepCopy(v1ContainerJsonList.get(0)); badMetadata6.remove(CONTAINER_ID_KEY); TestUtils.assertException(JSONException.class, () -> Container.fromJson(badMetadata6, refAccountId), null); JSONObject badMetadata8 = deepCopy(v1ContainerJsonList.get(0)).put(Container.JSON_VERSION_KEY, 3); TestUtils.assertException(IllegalStateException.class, () -> Container.fromJson(badMetadata8, refAccountId), null); }

Target:
public void badInputs() throws Exception { TestUtils.assertException(IllegalArgumentException.class, () -> Account.fromJson(null), null); JSONObject badMetadata1 = new JSONObject().put("badKey", "badValue"); TestUtils.assertException(JSONException.class, () -> Account.fromJson(badMetadata1), null); JSONObject badMetadata2 = deepCopy(refAccountJson); badMetadata2.remove(ACCOUNT_ID_KEY); TestUtils.assertException(JSONException.class, () -> Account.fromJson(badMetadata2), null); JSONObject badMetadata3 = deepCopy(refAccountJson).put(Account.JSON_VERSION_KEY, 2); TestUtils.assertException(IllegalStateException.class, () -> Account.fromJson(badMetadata3), null); JSONObject badMetadata4 = deepCopy(refAccountJson).put(Account.STATUS_KEY, "invalidAccountStatus"); TestUtils.assertException(IllegalArgumentException.class, () -> Account.fromJson(badMetadata4), null); TestUtils.assertException(IllegalArgumentException.class, () -> Container.fromJson(null, refAccountId), null); JSONObject badMetadata5 = deepCopy(containerJsonList.get(0)).put(Container.STATUS_KEY, "invalidContainerStatus"); TestUtils.assertException(IllegalArgumentException.class, () -> Container.fromJson(badMetadata5, refAccountId), null); JSONObject badMetadata6 = deepCopy(containerJsonList.get(0)); badMetadata6.remove(CONTAINER_ID_KEY); TestUtils.assertException(JSONException.class, () -> Container.fromJson(badMetadata6, refAccountId), null); JSONObject badMetadata7 = deepCopy(containerJsonList.get(0)).put(Container.JSON_VERSION_KEY, LATEST_CONTAINER_JSON_VERSION + 1); TestUtils.assertException(IllegalStateException.class, () -> Container.fromJson(badMetadata7, refAccountId), null); }