File tree 2 files changed +16
-0
lines changed
main/java/com/kobylynskyi/graphql/codegen/model
test/java/com/kobylynskyi/graphql/codegen
2 files changed +16
-0
lines changed Original file line number Diff line number Diff line change @@ -21,6 +21,9 @@ public class MappingConfig {
21
21
private String modelNameSuffix ;
22
22
23
23
public void putCustomTypeMappingIfAbsent (String from , String to ) {
24
+ if (customTypesMapping == null ) {
25
+ customTypesMapping = new HashMap <>();
26
+ }
24
27
if (!customTypesMapping .containsKey (from )) {
25
28
customTypesMapping .put (from , to );
26
29
}
Original file line number Diff line number Diff line change @@ -110,6 +110,19 @@ void generate_NoCustomMappings() throws Exception {
110
110
assertThat (Utils .getFileContent (eventFile .getPath ()), StringContains .containsString ("String createdDateTime;" ));
111
111
}
112
112
113
+ @ Test
114
+ void generate_NullCustomMappings () throws Exception {
115
+ mappingConfig .setCustomTypesMapping (null );
116
+ generator .generate ();
117
+
118
+ File [] files = Objects .requireNonNull (outputJavaClassesDir .listFiles ());
119
+ File eventFile = Arrays .stream (files )
120
+ .filter (file -> file .getName ().equalsIgnoreCase ("Event.java" ))
121
+ .findFirst ().orElseThrow (FileNotFoundException ::new );
122
+
123
+ assertThat (Utils .getFileContent (eventFile .getPath ()), StringContains .containsString ("String createdDateTime;" ));
124
+ }
125
+
113
126
@ Test
114
127
void generate_NoPackage () throws Exception {
115
128
mappingConfig .setPackageName (null );
You can’t perform that action at this time.
0 commit comments