### Question:
StripeJsonModel { static void putStripeJsonModelListIfNotNull( @NonNull Map<String, Object> upperLevelMap, @NonNull @Size(min = 1) String key, @Nullable List<? extends StripeJsonModel> jsonModelList) { if (jsonModelList == null) { return; } List<Map<String, Object>> mapList = new ArrayList<>(); for (int i = 0; i < jsonModelList.size(); i++) { mapList.add(jsonModelList.get(i).toMap()); } upperLevelMap.put(key, mapList); }  @NonNull abstract Map<String, Object> toMap(); @NonNull abstract JSONObject toJson(); @Override String toString(); @Override boolean equals(Object obj); @Override int hashCode();  }### Answer:
@Test public void putStripeJsonModelListIfNotNull_forMapsWhenNull_doesNothing() { Map<String, Object> sampleMap = new HashMap<>(); StripeJsonModel.putStripeJsonModelListIfNotNull(sampleMap, "mapkey", null); assertTrue(sampleMap.isEmpty()); }
@Test public void putStripeJsonModelListIfNotNull_forJsonWhenNull_doesNothing() { JSONObject jsonObject = new JSONObject(); StripeJsonModel.putStripeJsonModelListIfNotNull(jsonObject, "jsonkey", null); assertFalse(jsonObject.has("jsonkey")); }