@@ -55,40 +55,57 @@ void tearDown() {
55
55
56
56
@ Test
57
57
void testCreateCollection () throws Exception {
58
- SpreadsheetConfigCollectionInfos collectionToCreate = new SpreadsheetConfigCollectionInfos (null , createSpreadsheetConfigs ());
58
+ SpreadsheetConfigCollectionInfos collectionToCreate = new SpreadsheetConfigCollectionInfos (null , createSpreadsheetConfigs (), null );
59
59
60
60
UUID collectionUuid = postSpreadsheetConfigCollection (collectionToCreate );
61
61
SpreadsheetConfigCollectionInfos createdCollection = getSpreadsheetConfigCollection (collectionUuid );
62
62
63
63
assertThat (createdCollection )
64
- .usingRecursiveComparison ()
65
- .ignoringFields ("spreadsheetConfigs.columns.uuid" , "id" , "spreadsheetConfigs.id" )
66
- .isEqualTo (collectionToCreate );
64
+ .usingRecursiveComparison ()
65
+ .ignoringFields ("spreadsheetConfigs.columns.uuid" , "id" , "spreadsheetConfigs.id" )
66
+ .ignoringExpectedNullFields ()
67
+ .isEqualTo (collectionToCreate );
68
+ assertThat (createdCollection .id ()).isNotNull ();
69
+ }
70
+
71
+ @ Test
72
+ void testCreateCollectionWithAliases () throws Exception {
73
+ SpreadsheetConfigCollectionInfos collectionToCreate = new SpreadsheetConfigCollectionInfos (null , createSpreadsheetConfigs (), List .of ("alias1" , "alias2" , "alias3" ));
74
+
75
+ UUID collectionUuid = postSpreadsheetConfigCollection (collectionToCreate );
76
+ SpreadsheetConfigCollectionInfos createdCollection = getSpreadsheetConfigCollection (collectionUuid );
77
+
78
+ assertThat (createdCollection )
79
+ .usingRecursiveComparison ()
80
+ .ignoringFields ("spreadsheetConfigs.columns.uuid" , "id" , "spreadsheetConfigs.id" )
81
+ .ignoringExpectedNullFields ()
82
+ .isEqualTo (collectionToCreate );
67
83
assertThat (createdCollection .id ()).isNotNull ();
68
84
}
69
85
70
86
@ Test
71
87
void testReadCollection () throws Exception {
72
- SpreadsheetConfigCollectionInfos collectionToRead = new SpreadsheetConfigCollectionInfos (null , createSpreadsheetConfigs ());
88
+ SpreadsheetConfigCollectionInfos collectionToRead = new SpreadsheetConfigCollectionInfos (null , createSpreadsheetConfigs (), null );
73
89
74
90
UUID collectionUuid = saveAndReturnId (collectionToRead );
75
91
76
92
SpreadsheetConfigCollectionInfos receivedCollection = getSpreadsheetConfigCollection (collectionUuid );
77
93
78
94
assertThat (receivedCollection )
79
- .usingRecursiveComparison ()
80
- .ignoringFields ("spreadsheetConfigs.columns.uuid" , "id" , "spreadsheetConfigs.id" )
81
- .isEqualTo (collectionToRead );
95
+ .usingRecursiveComparison ()
96
+ .ignoringFields ("spreadsheetConfigs.columns.uuid" , "id" , "spreadsheetConfigs.id" )
97
+ .ignoringExpectedNullFields ()
98
+ .isEqualTo (collectionToRead );
82
99
assertThat (receivedCollection .id ()).isEqualTo (collectionUuid );
83
100
}
84
101
85
102
@ Test
86
103
void testUpdateCollection () throws Exception {
87
- SpreadsheetConfigCollectionInfos collectionToUpdate = new SpreadsheetConfigCollectionInfos (null , createSpreadsheetConfigs ());
104
+ SpreadsheetConfigCollectionInfos collectionToUpdate = new SpreadsheetConfigCollectionInfos (null , createSpreadsheetConfigs (), null );
88
105
89
106
UUID collectionUuid = saveAndReturnId (collectionToUpdate );
90
107
91
- SpreadsheetConfigCollectionInfos updatedCollection = new SpreadsheetConfigCollectionInfos (collectionUuid , createUpdatedSpreadsheetConfigs ());
108
+ SpreadsheetConfigCollectionInfos updatedCollection = new SpreadsheetConfigCollectionInfos (collectionUuid , createUpdatedSpreadsheetConfigs (), null );
92
109
93
110
String updatedCollectionJson = mapper .writeValueAsString (updatedCollection );
94
111
@@ -100,14 +117,15 @@ void testUpdateCollection() throws Exception {
100
117
SpreadsheetConfigCollectionInfos retrievedCollection = getSpreadsheetConfigCollection (collectionUuid );
101
118
102
119
assertThat (retrievedCollection )
103
- .usingRecursiveComparison ()
104
- .ignoringFields ("spreadsheetConfigs.columns.uuid" , "spreadsheetConfigs.id" )
105
- .isEqualTo (updatedCollection );
120
+ .usingRecursiveComparison ()
121
+ .ignoringFields ("spreadsheetConfigs.columns.uuid" , "spreadsheetConfigs.id" )
122
+ .ignoringExpectedNullFields ()
123
+ .isEqualTo (updatedCollection );
106
124
}
107
125
108
126
@ Test
109
127
void testDeleteCollection () throws Exception {
110
- SpreadsheetConfigCollectionInfos collectionToDelete = new SpreadsheetConfigCollectionInfos (null , createSpreadsheetConfigs ());
128
+ SpreadsheetConfigCollectionInfos collectionToDelete = new SpreadsheetConfigCollectionInfos (null , createSpreadsheetConfigs (), null );
111
129
112
130
UUID collectionUuid = saveAndReturnId (collectionToDelete );
113
131
@@ -120,23 +138,24 @@ void testDeleteCollection() throws Exception {
120
138
121
139
@ Test
122
140
void testDuplicateCollection () throws Exception {
123
- SpreadsheetConfigCollectionInfos collectionToCreate = new SpreadsheetConfigCollectionInfos (null , createSpreadsheetConfigs ());
141
+ SpreadsheetConfigCollectionInfos collectionToCreate = new SpreadsheetConfigCollectionInfos (null , createSpreadsheetConfigs (), null );
124
142
UUID collectionUuid = postSpreadsheetConfigCollection (collectionToCreate );
125
143
126
144
UUID duplicatedCollectionUuid = duplicateSpreadsheetConfigCollection (collectionUuid );
127
145
128
146
SpreadsheetConfigCollectionInfos duplicatedCollection = getSpreadsheetConfigCollection (duplicatedCollectionUuid );
129
147
assertThat (duplicatedCollection )
130
- .usingRecursiveComparison ()
131
- .ignoringFields ("spreadsheetConfigs.columns.uuid" , "id" , "spreadsheetConfigs.id" )
132
- .isEqualTo (collectionToCreate );
148
+ .usingRecursiveComparison ()
149
+ .ignoringFields ("spreadsheetConfigs.columns.uuid" , "id" , "spreadsheetConfigs.id" )
150
+ .ignoringExpectedNullFields ()
151
+ .isEqualTo (collectionToCreate );
133
152
assertThat (duplicatedCollection .id ()).isNotEqualTo (collectionUuid );
134
153
}
135
154
136
155
@ Test
137
156
void testMergeModelsIntoNewCollection () throws Exception {
138
157
// create a first collection with 2 configs
139
- SpreadsheetConfigCollectionInfos collectionToCreate = new SpreadsheetConfigCollectionInfos (null , createSpreadsheetConfigs ());
158
+ SpreadsheetConfigCollectionInfos collectionToCreate = new SpreadsheetConfigCollectionInfos (null , createSpreadsheetConfigs (), null );
140
159
UUID collectionUuid = postSpreadsheetConfigCollection (collectionToCreate );
141
160
List <UUID > configIds = getSpreadsheetConfigCollection (collectionUuid ).spreadsheetConfigs ().stream ().map (SpreadsheetConfigInfos ::id ).toList ();
142
161
assertThat (configIds ).hasSize (2 );
@@ -163,7 +182,7 @@ void testCreateDefaultCollection() throws Exception {
163
182
164
183
@ Test
165
184
void testAddSpreadsheetConfigToCollection () throws Exception {
166
- SpreadsheetConfigCollectionInfos initialCollection = new SpreadsheetConfigCollectionInfos (null , createSpreadsheetConfigs ());
185
+ SpreadsheetConfigCollectionInfos initialCollection = new SpreadsheetConfigCollectionInfos (null , createSpreadsheetConfigs (), null );
167
186
UUID collectionUuid = postSpreadsheetConfigCollection (initialCollection );
168
187
169
188
List <ColumnInfos > columnInfos = Arrays .asList (
@@ -189,7 +208,7 @@ void testAddSpreadsheetConfigToCollection() throws Exception {
189
208
190
209
@ Test
191
210
void testRemoveSpreadsheetConfigFromCollection () throws Exception {
192
- SpreadsheetConfigCollectionInfos initialCollection = new SpreadsheetConfigCollectionInfos (null , createSpreadsheetConfigs ());
211
+ SpreadsheetConfigCollectionInfos initialCollection = new SpreadsheetConfigCollectionInfos (null , createSpreadsheetConfigs (), null );
193
212
UUID collectionUuid = postSpreadsheetConfigCollection (initialCollection );
194
213
195
214
SpreadsheetConfigCollectionInfos createdCollection = getSpreadsheetConfigCollection (collectionUuid );
@@ -218,7 +237,7 @@ void testAddSpreadsheetConfigToNonExistentCollection() throws Exception {
218
237
219
238
@ Test
220
239
void testRemoveNonExistentSpreadsheetConfig () throws Exception {
221
- SpreadsheetConfigCollectionInfos collection = new SpreadsheetConfigCollectionInfos (null , createSpreadsheetConfigs ());
240
+ SpreadsheetConfigCollectionInfos collection = new SpreadsheetConfigCollectionInfos (null , createSpreadsheetConfigs (), null );
222
241
UUID collectionUuid = postSpreadsheetConfigCollection (collection );
223
242
224
243
UUID nonExistentConfigId = UUID .randomUUID ();
@@ -229,7 +248,7 @@ void testRemoveNonExistentSpreadsheetConfig() throws Exception {
229
248
@ Test
230
249
void testReorderSpreadsheetConfigs () throws Exception {
231
250
// Create a collection with multiple configs
232
- SpreadsheetConfigCollectionInfos collection = new SpreadsheetConfigCollectionInfos (null , createSpreadsheetConfigs ());
251
+ SpreadsheetConfigCollectionInfos collection = new SpreadsheetConfigCollectionInfos (null , createSpreadsheetConfigs (), null );
233
252
UUID collectionId = postSpreadsheetConfigCollection (collection );
234
253
235
254
// Get the created collection to get the config IDs
0 commit comments