Skip to content

Commit

Permalink
#1306 Remove unneeded hack in BaseFakerTest
Browse files Browse the repository at this point in the history
there is no need to initialize static Faker's vars in some specific way. They should stably work in any order.
  • Loading branch information
asolntsev committed Jul 21, 2024
1 parent cba5476 commit 604b3b3
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 13 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ void shouldCreateUniqueValues() throws InvocationTargetException, IllegalAccessE
assertThat(difference.entriesDiffering()).hasSizeGreaterThan(difference.entriesInCommon().size());
}

public static Map<String, String> buildReport(Faker faker) throws IllegalAccessException, InvocationTargetException {
private static Map<String, String> buildReport(Faker faker) throws IllegalAccessException, InvocationTargetException {
Map<String, String> result = new HashMap<>();

// Need to sort the methods since they are sometimes returned in a different order
Expand Down
12 changes: 0 additions & 12 deletions src/test/java/net/datafaker/providers/base/BaseFakerTest.java
Original file line number Diff line number Diff line change
@@ -1,15 +1,12 @@
package net.datafaker.providers.base;

import net.datafaker.Faker;
import net.datafaker.integration.FakerRepeatabilityIntegrationTest;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.TestInfo;
import org.junit.jupiter.api.TestInstance;
import org.junit.jupiter.params.ParameterizedTest;
import org.junit.jupiter.params.provider.MethodSource;
import org.mockito.MockitoAnnotations;

import java.lang.reflect.InvocationTargetException;
import java.util.Collection;
import java.util.HashSet;
import java.util.List;
Expand All @@ -24,15 +21,6 @@
@TestInstance(TestInstance.Lifecycle.PER_CLASS)
public class BaseFakerTest<T extends BaseFaker> {

static {
try {
// This will allow to init all the static Faker's vars first in predictable way
FakerRepeatabilityIntegrationTest.buildReport(new Faker());
} catch (IllegalAccessException | InvocationTargetException e) {
throw new RuntimeException(e);
}
}

private static final Logger LOG = Logger.getLogger(BaseFakerTest.class.getCanonicalName());
protected final T faker = getFaker();

Expand Down

0 comments on commit 604b3b3

Please sign in to comment.