Skip to content

Commit c9c0054

Browse files
DATAMONGO-2613 - Polishing.
Use the opportunity to remove public modifiers from touched test class. Original Pull Request: #883
1 parent b388659 commit c9c0054

File tree

1 file changed

+38
-39
lines changed

1 file changed

+38
-39
lines changed

spring-data-mongodb/src/test/java/org/springframework/data/mongodb/core/schema/JsonSchemaObjectUnitTests.java

Lines changed: 38 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,6 @@
3232

3333
import org.bson.Document;
3434
import org.junit.jupiter.api.Test;
35-
3635
import org.springframework.data.domain.Range;
3736
import org.springframework.data.domain.Range.*;
3837

@@ -43,14 +42,14 @@
4342
* @author Mark Paluch
4443
* @author Michał Kurcius
4544
*/
46-
public class JsonSchemaObjectUnitTests {
45+
class JsonSchemaObjectUnitTests {
4746

4847
// -----------------
4948
// type from class
5049
// -----------------
5150

5251
@Test // DATAMONGO-1849
53-
public void primitiveType() {
52+
void primitiveType() {
5453

5554
assertThat(JsonSchemaObject.of(boolean.class).getTypes()).containsExactly(Type.booleanType());
5655
assertThat(JsonSchemaObject.of(int.class).getTypes()).containsExactly(Type.intType());
@@ -61,20 +60,20 @@ public void primitiveType() {
6160
}
6261

6362
@Test // DATAMONGO-1849
64-
public void objectType() {
63+
void objectType() {
6564

6665
assertThat(JsonSchemaObject.of(Object.class).getTypes()).containsExactly(Type.objectType());
6766
assertThat(JsonSchemaObject.of(Map.class).getTypes()).containsExactly(Type.objectType());
6867
assertThat(JsonSchemaObject.of(Document.class).getTypes()).containsExactly(Type.objectType());
6968
}
7069

7170
@Test // DATAMONGO-1849
72-
public void binaryData() {
71+
void binaryData() {
7372
assertThat(JsonSchemaObject.of(byte[].class).getTypes()).containsExactly(Type.binaryType());
7473
}
7574

7675
@Test // DATAMONGO-1849
77-
public void collectionType() {
76+
void collectionType() {
7877

7978
assertThat(JsonSchemaObject.of(Object[].class).getTypes()).containsExactly(Type.arrayType());
8079
assertThat(JsonSchemaObject.of(Collection.class).getTypes()).containsExactly(Type.arrayType());
@@ -83,7 +82,7 @@ public void collectionType() {
8382
}
8483

8584
@Test // DATAMONGO-1849
86-
public void dateType() {
85+
void dateType() {
8786
assertThat(JsonSchemaObject.of(Date.class).getTypes()).containsExactly(Type.dateType());
8887
}
8988

@@ -92,22 +91,22 @@ public void dateType() {
9291
// -----------------
9392

9493
@Test // DATAMONGO-1835
95-
public void objectObjectShouldRenderTypeCorrectly() {
94+
void objectObjectShouldRenderTypeCorrectly() {
9695

9796
assertThat(object().generatedDescription().toDocument())
9897
.isEqualTo(new Document("type", "object").append("description", "Must be an object."));
9998
}
10099

101100
@Test // DATAMONGO-1835
102-
public void objectObjectShouldRenderNrPropertiesCorrectly() {
101+
void objectObjectShouldRenderNrPropertiesCorrectly() {
103102

104103
assertThat(object().propertiesCount(from(inclusive(10)).to(inclusive(20))).generatedDescription().toDocument())
105104
.isEqualTo(new Document("type", "object").append("description", "Must be an object with [10-20] properties.")
106105
.append("minProperties", 10).append("maxProperties", 20));
107106
}
108107

109108
@Test // DATAMONGO-1835
110-
public void objectObjectShouldRenderRequiredPropertiesCorrectly() {
109+
void objectObjectShouldRenderRequiredPropertiesCorrectly() {
111110

112111
assertThat(object().required("spring", "data", "mongodb").generatedDescription().toDocument())
113112
.isEqualTo(new Document("type", "object")
@@ -116,7 +115,7 @@ public void objectObjectShouldRenderRequiredPropertiesCorrectly() {
116115
}
117116

118117
@Test // DATAMONGO-1835
119-
public void objectObjectShouldRenderAdditionalPropertiesCorrectlyWhenBoolean() {
118+
void objectObjectShouldRenderAdditionalPropertiesCorrectlyWhenBoolean() {
120119

121120
assertThat(object().additionalProperties(true).generatedDescription().toDocument()).isEqualTo(
122121
new Document("type", "object").append("description", "Must be an object allowing additional properties.")
@@ -128,7 +127,7 @@ public void objectObjectShouldRenderAdditionalPropertiesCorrectlyWhenBoolean() {
128127
}
129128

130129
@Test // DATAMONGO-1835
131-
public void objectObjectShouldRenderPropertiesCorrectly() {
130+
void objectObjectShouldRenderPropertiesCorrectly() {
132131

133132
Document expected = new Document("type", "object")
134133
.append("description", "Must be an object defining restrictions for name, active.").append("properties",
@@ -143,7 +142,7 @@ public void objectObjectShouldRenderPropertiesCorrectly() {
143142
}
144143

145144
@Test // DATAMONGO-1835
146-
public void objectObjectShouldRenderNestedObjectPropertiesCorrectly() {
145+
void objectObjectShouldRenderNestedObjectPropertiesCorrectly() {
147146

148147
Document expected = new Document("type", "object")
149148
.append("description", "Must be an object defining restrictions for address.")
@@ -159,7 +158,7 @@ public void objectObjectShouldRenderNestedObjectPropertiesCorrectly() {
159158
}
160159

161160
@Test // DATAMONGO-1835
162-
public void objectObjectShouldRenderPatternPropertiesCorrectly() {
161+
void objectObjectShouldRenderPatternPropertiesCorrectly() {
163162

164163
Document expected = new Document("type", "object")
165164
.append("description", "Must be an object defining restrictions for patterns na.*.")
@@ -171,7 +170,7 @@ public void objectObjectShouldRenderPatternPropertiesCorrectly() {
171170
}
172171

173172
@Test // DATAMONGO-1849
174-
public void objectShouldIncludeRequiredNestedCorrectly() {
173+
void objectShouldIncludeRequiredNestedCorrectly() {
175174

176175
assertThat(object() //
177176
.properties( //
@@ -186,29 +185,29 @@ public void objectShouldIncludeRequiredNestedCorrectly() {
186185
// -----------------
187186

188187
@Test // DATAMONGO-1835
189-
public void stringObjectShouldRenderTypeCorrectly() {
188+
void stringObjectShouldRenderTypeCorrectly() {
190189

191190
assertThat(string().generatedDescription().toDocument())
192191
.isEqualTo(new Document("type", "string").append("description", "Must be a string."));
193192
}
194193

195194
@Test // DATAMONGO-1835
196-
public void stringObjectShouldRenderDescriptionCorrectly() {
195+
void stringObjectShouldRenderDescriptionCorrectly() {
197196

198197
assertThat(string().description("error msg").toDocument())
199198
.isEqualTo(new Document("type", "string").append("description", "error msg"));
200199
}
201200

202201
@Test // DATAMONGO-1835
203-
public void stringObjectShouldRenderRangeCorrectly() {
202+
void stringObjectShouldRenderRangeCorrectly() {
204203

205204
assertThat(string().length(from(inclusive(10)).to(inclusive(20))).generatedDescription().toDocument())
206205
.isEqualTo(new Document("type", "string").append("description", "Must be a string with length [10-20].")
207206
.append("minLength", 10).append("maxLength", 20));
208207
}
209208

210209
@Test // DATAMONGO-1835
211-
public void stringObjectShouldRenderPatternCorrectly() {
210+
void stringObjectShouldRenderPatternCorrectly() {
212211

213212
assertThat(string().matching("^spring$").generatedDescription().toDocument())
214213
.isEqualTo(new Document("type", "string").append("description", "Must be a string matching ^spring$.")
@@ -220,15 +219,15 @@ public void stringObjectShouldRenderPatternCorrectly() {
220219
// -----------------
221220

222221
@Test // DATAMONGO-1835
223-
public void numberObjectShouldRenderMultipleOfCorrectly() {
222+
void numberObjectShouldRenderMultipleOfCorrectly() {
224223

225224
assertThat(number().multipleOf(3.141592F).generatedDescription().toDocument())
226225
.isEqualTo(new Document("type", "number").append("description", "Must be a numeric value multiple of 3.141592.")
227226
.append("multipleOf", 3.141592F));
228227
}
229228

230229
@Test // DATAMONGO-1835
231-
public void numberObjectShouldRenderMaximumCorrectly() {
230+
void numberObjectShouldRenderMaximumCorrectly() {
232231

233232
assertThat(
234233
number().within(Range.of(Bound.unbounded(), Bound.inclusive(3.141592F))).generatedDescription().toDocument())
@@ -244,7 +243,7 @@ public void numberObjectShouldRenderMaximumCorrectly() {
244243
}
245244

246245
@Test // DATAMONGO-1835
247-
public void numberObjectShouldRenderMinimumCorrectly() {
246+
void numberObjectShouldRenderMinimumCorrectly() {
248247

249248
assertThat(
250249
number().within(Range.of(Bound.inclusive(3.141592F), Bound.unbounded())).generatedDescription().toDocument())
@@ -264,42 +263,42 @@ public void numberObjectShouldRenderMinimumCorrectly() {
264263
// -----------------
265264

266265
@Test // DATAMONGO-1835
267-
public void arrayObjectShouldRenderItemsCorrectly() {
266+
void arrayObjectShouldRenderItemsCorrectly() {
268267

269268
assertThat(array().items(Arrays.asList(string(), bool())).toDocument()).isEqualTo(new Document("type", "array")
270269
.append("items", Arrays.asList(new Document("type", "string"), new Document("type", "boolean"))));
271270
}
272271

273272
@Test // DATAMONGO-2613
274-
public void arrayObjectShouldRenderItemsCorrectlyAsObjectIfContainsOnlyOneElement() {
273+
void arrayObjectShouldRenderItemsCorrectlyAsObjectIfContainsOnlyOneElement() {
275274

276-
assertThat(array().items(Collections.singletonList(string())).toDocument()).isEqualTo(new Document("type", "array")
277-
.append("items", new Document("type", "string")));
275+
assertThat(array().items(Collections.singletonList(string())).toDocument())
276+
.isEqualTo(new Document("type", "array").append("items", new Document("type", "string")));
278277
}
279278

280279
@Test // DATAMONGO-1835
281-
public void arrayObjectShouldRenderMaxItemsCorrectly() {
280+
void arrayObjectShouldRenderMaxItemsCorrectly() {
282281

283282
assertThat(array().maxItems(5).generatedDescription().toDocument()).isEqualTo(new Document("type", "array")
284283
.append("description", "Must be an array having size unbounded-5].").append("maxItems", 5));
285284
}
286285

287286
@Test // DATAMONGO-1835
288-
public void arrayObjectShouldRenderMinItemsCorrectly() {
287+
void arrayObjectShouldRenderMinItemsCorrectly() {
289288

290289
assertThat(array().minItems(5).generatedDescription().toDocument()).isEqualTo(new Document("type", "array")
291290
.append("description", "Must be an array having size [5-unbounded.").append("minItems", 5));
292291
}
293292

294293
@Test // DATAMONGO-1835
295-
public void arrayObjectShouldRenderUniqueItemsCorrectly() {
294+
void arrayObjectShouldRenderUniqueItemsCorrectly() {
296295

297296
assertThat(array().uniqueItems(true).generatedDescription().toDocument()).isEqualTo(new Document("type", "array")
298297
.append("description", "Must be an array of unique values.").append("uniqueItems", true));
299298
}
300299

301300
@Test // DATAMONGO-1835
302-
public void arrayObjectShouldRenderAdditionalItemsItemsCorrectly() {
301+
void arrayObjectShouldRenderAdditionalItemsItemsCorrectly() {
303302

304303
assertThat(array().additionalItems(true).generatedDescription().toDocument())
305304
.isEqualTo(new Document("type", "array").append("description", "Must be an array with additional items.")
@@ -314,7 +313,7 @@ public void arrayObjectShouldRenderAdditionalItemsItemsCorrectly() {
314313
// -----------------
315314

316315
@Test // DATAMONGO-1835
317-
public void booleanShouldRenderCorrectly() {
316+
void booleanShouldRenderCorrectly() {
318317

319318
assertThat(bool().generatedDescription().toDocument())
320319
.isEqualTo(new Document("type", "boolean").append("description", "Must be a boolean."));
@@ -325,7 +324,7 @@ public void booleanShouldRenderCorrectly() {
325324
// -----------------
326325

327326
@Test // DATAMONGO-1835
328-
public void nullShouldRenderCorrectly() {
327+
void nullShouldRenderCorrectly() {
329328

330329
assertThat(nil().generatedDescription().toDocument())
331330
.isEqualTo(new Document("type", "null").append("description", "Must be null."));
@@ -336,7 +335,7 @@ public void nullShouldRenderCorrectly() {
336335
// -----------------
337336

338337
@Test // DATAMONGO-1877
339-
public void dateShouldRenderCorrectly() {
338+
void dateShouldRenderCorrectly() {
340339

341340
assertThat(date().generatedDescription().toDocument())
342341
.isEqualTo(new Document("bsonType", "date").append("description", "Must be a date."));
@@ -347,7 +346,7 @@ public void dateShouldRenderCorrectly() {
347346
// -----------------
348347

349348
@Test // DATAMONGO-1877
350-
public void timestampShouldRenderCorrectly() {
349+
void timestampShouldRenderCorrectly() {
351350

352351
assertThat(timestamp().generatedDescription().toDocument())
353352
.isEqualTo(new Document("bsonType", "timestamp").append("description", "Must be a timestamp."));
@@ -358,35 +357,35 @@ public void timestampShouldRenderCorrectly() {
358357
// -----------------
359358

360359
@Test // DATAMONGO-1835
361-
public void typedObjectShouldRenderEnumCorrectly() {
360+
void typedObjectShouldRenderEnumCorrectly() {
362361

363362
assertThat(of(String.class).possibleValues(Arrays.asList("one", "two")).toDocument())
364363
.isEqualTo(new Document("type", "string").append("enum", Arrays.asList("one", "two")));
365364
}
366365

367366
@Test // DATAMONGO-1835
368-
public void typedObjectShouldRenderAllOfCorrectly() {
367+
void typedObjectShouldRenderAllOfCorrectly() {
369368

370369
assertThat(of(Object.class).allOf(Arrays.asList(string())).toDocument())
371370
.isEqualTo(new Document("type", "object").append("allOf", Arrays.asList(new Document("type", "string"))));
372371
}
373372

374373
@Test // DATAMONGO-1835
375-
public void typedObjectShouldRenderAnyOfCorrectly() {
374+
void typedObjectShouldRenderAnyOfCorrectly() {
376375

377376
assertThat(of(String.class).anyOf(Arrays.asList(string())).toDocument())
378377
.isEqualTo(new Document("type", "string").append("anyOf", Arrays.asList(new Document("type", "string"))));
379378
}
380379

381380
@Test // DATAMONGO-1835
382-
public void typedObjectShouldRenderOneOfCorrectly() {
381+
void typedObjectShouldRenderOneOfCorrectly() {
383382

384383
assertThat(of(String.class).oneOf(Arrays.asList(string())).toDocument())
385384
.isEqualTo(new Document("type", "string").append("oneOf", Arrays.asList(new Document("type", "string"))));
386385
}
387386

388387
@Test // DATAMONGO-1835
389-
public void typedObjectShouldRenderNotCorrectly() {
388+
void typedObjectShouldRenderNotCorrectly() {
390389

391390
assertThat(untyped().notMatch(string()).toDocument())
392391
.isEqualTo(new Document("not", new Document("type", "string")));

0 commit comments

Comments
 (0)