Skip to content

Commit 9b13f4f

Browse files
committed
refactor: remove unnecessary map
1 parent 32d29e5 commit 9b13f4f

File tree

2 files changed

+6
-6
lines changed

2 files changed

+6
-6
lines changed

src/main/java/com/github/nylle/javafixture/specimen/AbstractSpecimen.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -58,9 +58,9 @@ public T create(final CustomizationContext customizationContext, Annotation[] an
5858
.forEach(field -> reflector.setField(field,
5959
customizationContext.getCustomFields().getOrDefault(
6060
field.getName(),
61-
Map.<String, ISpecimen<?>>of().getOrDefault(
62-
field.getGenericType().getTypeName(),
63-
specimenFactory.build(SpecimenType.fromClass(field.getGenericType()))).create(new CustomizationContext(List.of(), Map.of(), false), field.getAnnotations()))));
61+
specimenFactory
62+
.build(SpecimenType.fromClass(field.getGenericType()))
63+
.create(new CustomizationContext(List.of(), Map.of(), false), field.getAnnotations()))));
6464
return context.remove(type);
6565
} catch(SpecimenException ex) {
6666
return instanceFactory.manufacture(type, customizationContext, ex);

src/main/java/com/github/nylle/javafixture/specimen/ObjectSpecimen.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -66,9 +66,9 @@ private T populate(CustomizationContext customizationContext) {
6666
.forEach(field -> reflector.setField(field,
6767
customizationContext.getCustomFields().getOrDefault(
6868
field.getName(),
69-
Map.<String, ISpecimen<?>>of().getOrDefault(
70-
field.getGenericType().getTypeName(),
71-
specimenFactory.build(SpecimenType.fromClass(field.getGenericType()))).create(new CustomizationContext(List.of(), Map.of(), false), reflector.getFieldAnnotations(field)))));
69+
specimenFactory
70+
.build(SpecimenType.fromClass(field.getGenericType()))
71+
.create(new CustomizationContext(List.of(), Map.of(), false), reflector.getFieldAnnotations(field)))));
7272
} catch (SpecimenException ex) {
7373
return context.overwrite(type, instanceFactory.construct(type, customizationContext));
7474
}

0 commit comments

Comments
 (0)