Skip to content

Commit 8c2f44a

Browse files
akutscheraNylle
authored andcommitted
style: Remove line breaks in empty bodies
1 parent 3dea6a7 commit 8c2f44a

File tree

2 files changed

+73
-131
lines changed

2 files changed

+73
-131
lines changed

.editorconfig

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,8 @@ ij_java_layout_static_imports_separately = true
2222

2323
ij_java_blank_lines_after_package = 1
2424
ij_java_blank_lines_after_imports = 1
25+
ij_any_keep_simple_classes_in_one_line = true
26+
ij_any_keep_simple_lambdas_in_one_line = true
2527

2628
[*.json]
2729
indent_size = 2

src/test/java/com/github/nylle/javafixture/SpecimenTypeTest.java

Lines changed: 71 additions & 131 deletions
Original file line numberDiff line numberDiff line change
@@ -62,16 +62,13 @@ class SpecimenTypeTest {
6262

6363
@Test
6464
void asClass() {
65-
assertThat(new SpecimenType<String>() {
66-
}.asClass()).isEqualTo(String.class);
65+
assertThat(new SpecimenType<String>() {}.asClass()).isEqualTo(String.class);
6766
}
6867

6968
@Test
7069
void isParametrized() {
71-
assertThat(new SpecimenType<String>() {
72-
}.isParameterized()).isFalse();
73-
assertThat(new SpecimenType<Optional<String>>() {
74-
}.isParameterized()).isTrue();
70+
assertThat(new SpecimenType<String>() {}.isParameterized()).isFalse();
71+
assertThat(new SpecimenType<Optional<String>>() {}.isParameterized()).isTrue();
7572
}
7673

7774
@Test
@@ -91,42 +88,24 @@ void isParameterizedStatic() throws NoSuchFieldException {
9188

9289
@Test
9390
void isCollection() {
94-
assertThat(new SpecimenType<Collection<String>>() {
95-
}.isCollection()).isTrue();
96-
assertThat(new SpecimenType<List<String>>() {
97-
}.isCollection()).isTrue();
98-
assertThat(new SpecimenType<NavigableSet<String>>() {
99-
}.isCollection()).isTrue();
100-
assertThat(new SpecimenType<SortedSet<String>>() {
101-
}.isCollection()).isTrue();
102-
assertThat(new SpecimenType<Set<String>>() {
103-
}.isCollection()).isTrue();
104-
assertThat(new SpecimenType<Deque<String>>() {
105-
}.isCollection()).isTrue();
106-
assertThat(new SpecimenType<BlockingDeque<String>>() {
107-
}.isCollection()).isTrue();
108-
assertThat(new SpecimenType<Queue<String>>() {
109-
}.isCollection()).isTrue();
110-
assertThat(new SpecimenType<BlockingQueue<String>>() {
111-
}.isCollection()).isTrue();
112-
assertThat(new SpecimenType<TransferQueue<String>>() {
113-
}.isCollection()).isTrue();
114-
assertThat(new SpecimenType<ArrayList<String>>() {
115-
}.isCollection()).isTrue();
116-
assertThat(new SpecimenType<HashSet<String>>() {
117-
}.isCollection()).isTrue();
118-
assertThat(new SpecimenType<TreeSet<String>>() {
119-
}.isCollection()).isTrue();
120-
assertThat(new SpecimenType<ArrayDeque<String>>() {
121-
}.isCollection()).isTrue();
122-
assertThat(new SpecimenType<LinkedBlockingDeque<String>>() {
123-
}.isCollection()).isTrue();
124-
assertThat(new SpecimenType<LinkedList<String>>() {
125-
}.isCollection()).isTrue();
126-
assertThat(new SpecimenType<LinkedBlockingQueue<String>>() {
127-
}.isCollection()).isTrue();
128-
assertThat(new SpecimenType<LinkedTransferQueue<String>>() {
129-
}.isCollection()).isTrue();
91+
assertThat(new SpecimenType<Collection<String>>() {}.isCollection()).isTrue();
92+
assertThat(new SpecimenType<List<String>>() {}.isCollection()).isTrue();
93+
assertThat(new SpecimenType<NavigableSet<String>>() {}.isCollection()).isTrue();
94+
assertThat(new SpecimenType<SortedSet<String>>() {}.isCollection()).isTrue();
95+
assertThat(new SpecimenType<Set<String>>() {}.isCollection()).isTrue();
96+
assertThat(new SpecimenType<Deque<String>>() {}.isCollection()).isTrue();
97+
assertThat(new SpecimenType<BlockingDeque<String>>() {}.isCollection()).isTrue();
98+
assertThat(new SpecimenType<Queue<String>>() {}.isCollection()).isTrue();
99+
assertThat(new SpecimenType<BlockingQueue<String>>() {}.isCollection()).isTrue();
100+
assertThat(new SpecimenType<TransferQueue<String>>() {}.isCollection()).isTrue();
101+
assertThat(new SpecimenType<ArrayList<String>>() {}.isCollection()).isTrue();
102+
assertThat(new SpecimenType<HashSet<String>>() {}.isCollection()).isTrue();
103+
assertThat(new SpecimenType<TreeSet<String>>() {}.isCollection()).isTrue();
104+
assertThat(new SpecimenType<ArrayDeque<String>>() {}.isCollection()).isTrue();
105+
assertThat(new SpecimenType<LinkedBlockingDeque<String>>() {}.isCollection()).isTrue();
106+
assertThat(new SpecimenType<LinkedList<String>>() {}.isCollection()).isTrue();
107+
assertThat(new SpecimenType<LinkedBlockingQueue<String>>() {}.isCollection()).isTrue();
108+
assertThat(new SpecimenType<LinkedTransferQueue<String>>() {}.isCollection()).isTrue();
130109
}
131110

132111
@TestWithCases
@@ -154,24 +133,15 @@ void isCollectionFromClass(Class<Collection> collectionType) {
154133

155134
@Test
156135
void isMap() {
157-
assertThat(new SpecimenType<Map>() {
158-
}.isMap()).isTrue();
159-
assertThat(new SpecimenType<ConcurrentNavigableMap>() {
160-
}.isMap()).isTrue();
161-
assertThat(new SpecimenType<ConcurrentMap>() {
162-
}.isMap()).isTrue();
163-
assertThat(new SpecimenType<NavigableMap>() {
164-
}.isMap()).isTrue();
165-
assertThat(new SpecimenType<SortedMap>() {
166-
}.isMap()).isTrue();
167-
assertThat(new SpecimenType<TreeMap>() {
168-
}.isMap()).isTrue();
169-
assertThat(new SpecimenType<ConcurrentSkipListMap>() {
170-
}.isMap()).isTrue();
171-
assertThat(new SpecimenType<ConcurrentHashMap>() {
172-
}.isMap()).isTrue();
173-
assertThat(new SpecimenType<HashMap>() {
174-
}.isMap()).isTrue();
136+
assertThat(new SpecimenType<Map>() {}.isMap()).isTrue();
137+
assertThat(new SpecimenType<ConcurrentNavigableMap>() {}.isMap()).isTrue();
138+
assertThat(new SpecimenType<ConcurrentMap>() {}.isMap()).isTrue();
139+
assertThat(new SpecimenType<NavigableMap>() {}.isMap()).isTrue();
140+
assertThat(new SpecimenType<SortedMap>() {}.isMap()).isTrue();
141+
assertThat(new SpecimenType<TreeMap>() {}.isMap()).isTrue();
142+
assertThat(new SpecimenType<ConcurrentSkipListMap>() {}.isMap()).isTrue();
143+
assertThat(new SpecimenType<ConcurrentHashMap>() {}.isMap()).isTrue();
144+
assertThat(new SpecimenType<HashMap>() {}.isMap()).isTrue();
175145
}
176146

177147
@TestWithCases
@@ -190,24 +160,15 @@ void isMapFromClass(Class<Map> mapType) {
190160

191161
@Test
192162
void isBoxed() {
193-
assertThat(new SpecimenType<String>() {
194-
}.isBoxed()).isFalse(); // false!
195-
assertThat(new SpecimenType<Byte>() {
196-
}.isBoxed()).isTrue();
197-
assertThat(new SpecimenType<Short>() {
198-
}.isBoxed()).isTrue();
199-
assertThat(new SpecimenType<Integer>() {
200-
}.isBoxed()).isTrue();
201-
assertThat(new SpecimenType<Long>() {
202-
}.isBoxed()).isTrue();
203-
assertThat(new SpecimenType<Float>() {
204-
}.isBoxed()).isTrue();
205-
assertThat(new SpecimenType<Double>() {
206-
}.isBoxed()).isTrue();
207-
assertThat(new SpecimenType<Character>() {
208-
}.isBoxed()).isTrue();
209-
assertThat(new SpecimenType<Boolean>() {
210-
}.isBoxed()).isTrue();
163+
assertThat(new SpecimenType<String>() {}.isBoxed()).isFalse(); // false!
164+
assertThat(new SpecimenType<Byte>() {}.isBoxed()).isTrue();
165+
assertThat(new SpecimenType<Short>() {}.isBoxed()).isTrue();
166+
assertThat(new SpecimenType<Integer>() {}.isBoxed()).isTrue();
167+
assertThat(new SpecimenType<Long>() {}.isBoxed()).isTrue();
168+
assertThat(new SpecimenType<Float>() {}.isBoxed()).isTrue();
169+
assertThat(new SpecimenType<Double>() {}.isBoxed()).isTrue();
170+
assertThat(new SpecimenType<Character>() {}.isBoxed()).isTrue();
171+
assertThat(new SpecimenType<Boolean>() {}.isBoxed()).isTrue();
211172
}
212173

213174
@TestWithCases
@@ -242,24 +203,21 @@ void isPrimitive(Class<?> value, boolean expected) {
242203
void isEnum() {
243204
assertThat(SpecimenType.fromClass(String.class).isEnum()).isFalse();
244205
assertThat(SpecimenType.fromClass(TestEnum.class).isEnum()).isTrue();
245-
assertThat(new SpecimenType<TestEnum>() {
246-
}.isEnum()).isTrue();
206+
assertThat(new SpecimenType<TestEnum>() {}.isEnum()).isTrue();
247207
}
248208

249209
@Test
250210
void isArray() {
251211
assertThat(SpecimenType.fromClass(List.class).isArray()).isFalse();
252212
assertThat(SpecimenType.fromClass(int[].class).isArray()).isTrue();
253-
assertThat(new SpecimenType<Integer[]>() {
254-
}.isArray()).isTrue();
213+
assertThat(new SpecimenType<Integer[]>() {}.isArray()).isTrue();
255214
}
256215

257216
@Test
258217
void isInterface() {
259218
assertThat(SpecimenType.fromClass(String.class).isInterface()).isFalse();
260219
assertThat(SpecimenType.fromClass(List.class).isInterface()).isTrue();
261-
assertThat(new SpecimenType<ITestGeneric<String, List<Optional>>>() {
262-
}.isInterface()).isTrue();
220+
assertThat(new SpecimenType<ITestGeneric<String, List<Optional>>>() {}.isInterface()).isTrue();
263221
}
264222

265223
@Test
@@ -270,14 +228,14 @@ void isAbstract() {
270228

271229
@Test
272230
void isTimeType() {
273-
assertThat(new SpecimenType<String>(){}.isTimeType()).isFalse(); // false
274-
assertThat(new SpecimenType<Duration>(){}.isTimeType()).isTrue();
275-
assertThat(new SpecimenType<JapaneseEra>(){}.isTimeType()).isTrue();
276-
assertThat(new SpecimenType<MonthDay>(){}.isTimeType()).isTrue();
277-
assertThat(new SpecimenType<Period>(){}.isTimeType()).isTrue();
278-
assertThat(new SpecimenType<ZoneId>(){}.isTimeType()).isTrue();
279-
assertThat(new SpecimenType<ZoneOffset>(){}.isTimeType()).isTrue();
280-
assertThat(new SpecimenType<ZonedDateTime>(){}.isTimeType()).isTrue();
231+
assertThat(new SpecimenType<String>() {}.isTimeType()).isFalse(); // false
232+
assertThat(new SpecimenType<Duration>() {}.isTimeType()).isTrue();
233+
assertThat(new SpecimenType<JapaneseEra>() {}.isTimeType()).isTrue();
234+
assertThat(new SpecimenType<MonthDay>() {}.isTimeType()).isTrue();
235+
assertThat(new SpecimenType<Period>() {}.isTimeType()).isTrue();
236+
assertThat(new SpecimenType<ZoneId>() {}.isTimeType()).isTrue();
237+
assertThat(new SpecimenType<ZoneOffset>() {}.isTimeType()).isTrue();
238+
assertThat(new SpecimenType<ZonedDateTime>() {}.isTimeType()).isTrue();
281239
}
282240

283241
@TestWithCases
@@ -299,9 +257,9 @@ void isTimeTypeFromClass(Class<?> value, boolean expected) {
299257

300258
@Test
301259
void isSpecialType() {
302-
assertThat(new SpecimenType<String>(){}.isSpecialType()).isFalse(); // false
303-
assertThat(new SpecimenType<URI>(){}.isSpecialType()).isTrue();
304-
assertThat(new SpecimenType<File>(){}.isSpecialType()).isTrue();
260+
assertThat(new SpecimenType<String>() {}.isSpecialType()).isFalse(); // false
261+
assertThat(new SpecimenType<URI>() {}.isSpecialType()).isTrue();
262+
assertThat(new SpecimenType<File>() {}.isSpecialType()).isTrue();
305263
}
306264

307265
@TestWithCases
@@ -314,8 +272,7 @@ void isSpecialTypeFromClass(Class<?> value, boolean expected) {
314272

315273
@Test
316274
void getGenericTypeArgument() {
317-
var sut = new SpecimenType<Map<String, Optional<Integer>>>() {
318-
};
275+
var sut = new SpecimenType<Map<String, Optional<Integer>>>() {};
319276

320277
assertThat(sut.getGenericTypeArgument(0)).isEqualTo(String.class);
321278
assertThat(sut.getGenericTypeArgument(1)).isInstanceOf(ParameterizedType.class);
@@ -330,8 +287,7 @@ void getGenericTypeArgument() {
330287

331288
@Test
332289
void getGenericTypeArguments() {
333-
var sut = new SpecimenType<Map<String, Optional<Integer>>>() {
334-
};
290+
var sut = new SpecimenType<Map<String, Optional<Integer>>>() {};
335291

336292
assertThat(sut.getGenericTypeArguments()).hasSize(2);
337293
assertThat(sut.getGenericTypeArguments()[0]).isEqualTo(String.class);
@@ -347,8 +303,7 @@ void getGenericTypeArguments() {
347303

348304
@Test
349305
void getTypeParameterName() {
350-
var sut = new SpecimenType<TestObjectGeneric<String, Optional<Integer>>>() {
351-
};
306+
var sut = new SpecimenType<TestObjectGeneric<String, Optional<Integer>>>() {};
352307

353308
assertThat(sut.getTypeParameterName(0)).isEqualTo("T");
354309
assertThat(sut.getTypeParameterName(1)).isEqualTo("U");
@@ -361,8 +316,7 @@ void getTypeParameterName() {
361316

362317
@Test
363318
void getTypeParameterNames() {
364-
var sut = new SpecimenType<TestObjectGeneric<String, Optional<Integer>>>() {
365-
};
319+
var sut = new SpecimenType<TestObjectGeneric<String, Optional<Integer>>>() {};
366320

367321
assertThat(sut.getTypeParameterNames()).hasSize(2);
368322
assertThat(sut.getTypeParameterNames()[0]).isEqualTo("T");
@@ -376,10 +330,8 @@ void getTypeParameterNames() {
376330

377331
@Test
378332
void getComponentType() {
379-
assertThat(new SpecimenType<int[]>() {
380-
}.getComponentType()).isEqualTo(int.class);
381-
assertThat(new SpecimenType<Integer[]>() {
382-
}.getComponentType()).isEqualTo(Integer.class);
333+
assertThat(new SpecimenType<int[]>() {}.getComponentType()).isEqualTo(int.class);
334+
assertThat(new SpecimenType<Integer[]>() {}.getComponentType()).isEqualTo(Integer.class);
383335

384336
assertThatExceptionOfType(SpecimenTypeException.class)
385337
.isThrownBy(() -> SpecimenType.fromClass(String.class).getComponentType())
@@ -397,8 +349,7 @@ void getComponentTypeFromClass(Class<?> value, Class<?> expected) {
397349
@Test
398350
void getEnumConstants() {
399351
assertThat(SpecimenType.fromClass(TestEnum.class).getEnumConstants().length).isEqualTo(3);
400-
assertThat(new SpecimenType<TestEnum>() {
401-
}.getEnumConstants().length).isEqualTo(3);
352+
assertThat(new SpecimenType<TestEnum>() {}.getEnumConstants().length).isEqualTo(3);
402353

403354
assertThatExceptionOfType(SpecimenTypeException.class)
404355
.isThrownBy(() -> SpecimenType.fromClass(String.class).getEnumConstants())
@@ -409,18 +360,14 @@ void getEnumConstants() {
409360
@Test
410361
void getName() {
411362
assertThat(SpecimenType.fromClass(Optional.class).getName()).isEqualTo("java.util.Optional");
412-
assertThat(new SpecimenType<Optional<String>>() {
413-
}.getName()).isEqualTo("java.util.Optional<java.lang.String>");
363+
assertThat(new SpecimenType<Optional<String>>() {}.getName()).isEqualTo("java.util.Optional<java.lang.String>");
414364
}
415365

416366
@Test
417367
void asParameterizedType() {
418-
assertThat(new SpecimenType<Optional<String>>() {
419-
}.asParameterizedType().getRawType()).isEqualTo(Optional.class);
420-
assertThat(new SpecimenType<Optional<String>>() {
421-
}.asParameterizedType().getActualTypeArguments().length).isEqualTo(1);
422-
assertThat(new SpecimenType<Optional<String>>() {
423-
}.asParameterizedType().getActualTypeArguments()[0].getTypeName()).isEqualTo(String.class.getName());
368+
assertThat(new SpecimenType<Optional<String>>() {}.asParameterizedType().getRawType()).isEqualTo(Optional.class);
369+
assertThat(new SpecimenType<Optional<String>>() {}.asParameterizedType().getActualTypeArguments().length).isEqualTo(1);
370+
assertThat(new SpecimenType<Optional<String>>() {}.asParameterizedType().getActualTypeArguments()[0].getTypeName()).isEqualTo(String.class.getName());
424371
}
425372

426373
@TestWithCases
@@ -440,8 +387,7 @@ void fromClass(Class<?> type) {
440387

441388
@Test
442389
void fromType() {
443-
Type type = new SpecimenType<Optional<String>>() {
444-
}.asParameterizedType();
390+
Type type = new SpecimenType<Optional<String>>() {}.asParameterizedType();
445391

446392
var sut = SpecimenType.fromClass(type);
447393

@@ -452,8 +398,7 @@ void fromType() {
452398

453399
@Test
454400
void createForObjectClass() {
455-
var sut = new SpecimenType<String>() {
456-
};
401+
var sut = new SpecimenType<String>() {};
457402

458403
assertThat(sut.asClass()).isEqualTo(String.class);
459404
assertThat(sut.isParameterized()).isFalse();
@@ -464,8 +409,7 @@ void createForObjectClass() {
464409

465410
@Test
466411
void createForGenericClass() {
467-
var sut = new SpecimenType<Optional<String>>() {
468-
};
412+
var sut = new SpecimenType<Optional<String>>() {};
469413

470414
assertThat(sut.asClass()).isEqualTo(Optional.class);
471415
assertThat(sut.isParameterized()).isTrue();
@@ -476,8 +420,7 @@ void createForGenericClass() {
476420

477421
@Test
478422
void createForListInterface() {
479-
var sut = new SpecimenType<List<String>>() {
480-
};
423+
var sut = new SpecimenType<List<String>>() {};
481424

482425
assertThat(sut.asClass()).isEqualTo(List.class);
483426
assertThat(sut.isParameterized()).isTrue();
@@ -488,8 +431,7 @@ void createForListInterface() {
488431

489432
@Test
490433
void createForMapInterface() {
491-
var sut = new SpecimenType<Map<String, Integer>>() {
492-
};
434+
var sut = new SpecimenType<Map<String, Integer>>() {};
493435

494436
assertThat(sut.asClass()).isEqualTo(Map.class);
495437
assertThat(sut.isParameterized()).isTrue();
@@ -501,8 +443,7 @@ void createForMapInterface() {
501443

502444
@Test
503445
void getDeclaredConstructors() {
504-
var sut = new SpecimenType<TestObjectWithAllConstructors>() {
505-
};
446+
var sut = new SpecimenType<TestObjectWithAllConstructors>() {};
506447

507448
var actual = sut.getDeclaredConstructors();
508449

@@ -511,8 +452,7 @@ void getDeclaredConstructors() {
511452

512453
@Test
513454
void getFactoryMethods() {
514-
var sut = new SpecimenType<TestObjectWithStaticMethods>() {
515-
};
455+
var sut = new SpecimenType<TestObjectWithStaticMethods>() {};
516456

517457
var actual = sut.getFactoryMethods();
518458

0 commit comments

Comments
 (0)