@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")); }
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 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 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(); }
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(); }
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();  }