@Test public void shouldUseDifferentSettingsInEachThread() throws Exception { ObjectMapper objectMapper = new ObjectMapper(); objectMapper.configure(SerializationFeature.WRITE_DATES_AS_TIMESTAMPS, true); FileNamingStrategy fileNamingStrategy = (folder, fileNamePrefix, fixtureName) -> "abc.test"; Settings.Builder settings = new Settings.Builder().setObjectMapper(objectMapper) .setDefaultSnapshotWriter() .setGeneratorFileNamingStrategy(fileNamingStrategy) .setSnapshotFileNamingStrategy(fileNamingStrategy); FixtureAnnotations.initFixtures(this, settings); Thread t2 = new Thread() { @Override public void run() { FileNamingStrategy fileNamingStrategy = (folder, fileNamePrefix, fixtureName) -> "cba.test"; Settings.Builder settings = new Settings.Builder().setDefaultObjectMapper() .setGeneratorFileNamingStrategy(fileNamingStrategy) .setSnapshotFolderPath("a/b/c"); try { FixtureAnnotations.initFixtures(this, settings); } catch (Exception e) { throw new RuntimeException(e); } assertThat(settings().getObjectMapper()).isNotEqualTo(objectMapper); assertThat(settings().getGeneratorFileNamingStrategy()).isEqualTo(fileNamingStrategy); assertThat(settings().getSnapshotFileNamingStrategy()).isEqualTo(fileNamingStrategy); assertThat(settings().getSnapshotFixtureWriter()).isInstanceOf(StaticPathDefaultSnapshotWriter.class); } }; t2.start(); t2.join(); assertThat(settings().getObjectMapper()).isEqualTo(objectMapper); assertThat(settings().getGeneratorFileNamingStrategy()).isEqualTo(fileNamingStrategy); assertThat(settings().getSnapshotFileNamingStrategy()).isEqualTo(fileNamingStrategy); assertThat(settings().getSnapshotFixtureWriter()).isInstanceOf(DefaultSnapshotWriter.class); }
public static void initFixtures(Object targetInstance) throws Exception { initFixtures(targetInstance, null); }
FixtureAnnotations { public static void initFixtures(Object targetInstance) throws Exception { initFixtures(targetInstance, null); } }
FixtureAnnotations { public static void initFixtures(Object targetInstance) throws Exception { initFixtures(targetInstance, null); }  }
FixtureAnnotations { public static void initFixtures(Object targetInstance) throws Exception { initFixtures(targetInstance, null); }  static void initFixtures(Object targetInstance); static void initFixtures(Object targetInstance, Settings.Builder settings); }
FixtureAnnotations { public static void initFixtures(Object targetInstance) throws Exception { initFixtures(targetInstance, null); }  static void initFixtures(Object targetInstance); static void initFixtures(Object targetInstance, Settings.Builder settings);  }