### Question:
StripeSourceTypeModel extends StripeJsonModel { static void putAdditionalFieldsIntoMap( @Nullable Map<String, Object> map, @Nullable Map<String, Object> additionalFields) { if (map == null || additionalFields == null || additionalFields.isEmpty()) { return; } for(String key : additionalFields.keySet()) { map.put(key, additionalFields.get(key)); } } StripeSourceTypeModel(); @NonNull Map<String, Object> getAdditionalFields();  }### Answer:
@Test public void putAdditionalFieldsIntoMap_whenGivenFields_putsThemIntoTheMap() { Map<String, Object> originalMap = new HashMap<String, Object>() {{ put("a", "a_val"); put("b", "b_val"); }}; Map<String, Object> extraMap = new HashMap<String, Object>() {{ put("c", 100); put("d", false); }}; putAdditionalFieldsIntoMap(originalMap, extraMap); assertEquals(4, originalMap.size()); assertEquals("a_val", originalMap.get("a")); assertEquals("b_val", originalMap.get("b")); assertEquals(100, originalMap.get("c")); assertEquals(false, originalMap.get("d")); }
@Test public void putAdditionalFieldsIntoMap_whenGivenDuplicateFields_putsThemIntoTheMap() { Map<String, Object> originalMap = new HashMap<String, Object>() {{ put("a", "a_val"); put("b", "b_val"); }}; Map<String, Object> extraMap = new HashMap<String, Object>() {{ put("a", 100); put("d", false); }}; putAdditionalFieldsIntoMap(originalMap, extraMap); assertEquals(3, originalMap.size()); assertEquals(100, originalMap.get("a")); assertEquals("b_val", originalMap.get("b")); assertEquals(false, originalMap.get("d")); }
@Test public void putAdditionalFieldsIntoMap_whenGivenEmptyMap_doesNothing() { Map<String, Object> originalMap = new HashMap<String, Object>() {{ put("a", "a_val"); put("b", "b_val"); }}; Map<String, Object> emptyMap = new HashMap<>(); putAdditionalFieldsIntoMap(originalMap, emptyMap); assertEquals(2, originalMap.size()); assertEquals("a_val", originalMap.get("a")); assertEquals("b_val", originalMap.get("b")); }
@Test public void putAdditionalFieldsIntoMap_whenGivenNullForEitherInput_doesNothing() { Map<String, Object> littleMap = new HashMap<String, Object>() {{ put("a", "b"); }}; putAdditionalFieldsIntoMap(null, littleMap); putAdditionalFieldsIntoMap(littleMap, null); assertEquals(1, littleMap.size()); assertEquals("b", littleMap.get("a")); }