@Test public void canReadByJavaType() throws Exception { CollectionType collectionType = CollectionType.construct(List.class, SimpleType.construct(MyBean.class)); List<MyBean> beans = factory.create(collectionType, "fixture6"); assertThat(beans).hasSize(3); assertThat(beans.get(0).getStringProperty()).isEqualTo("property1"); assertThat(beans.get(0).getIntProperty()).isEqualTo(1); assertThat(beans.get(1).getStringProperty()).isEqualTo("property2"); assertThat(beans.get(1).getIntProperty()).isEqualTo(2); assertThat(beans.get(2).getStringProperty()).isEqualTo("property3"); assertThat(beans.get(2).getIntProperty()).isEqualTo(3); }
public <T> T create(Class<T> type, String... fixtureNames) { return create(DEFAULT_REFERENCE_PREFIX, type, fixtureNames); }
BeanFactory { public <T> T create(Class<T> type, String... fixtureNames) { return create(DEFAULT_REFERENCE_PREFIX, type, fixtureNames); } }
BeanFactory { public <T> T create(Class<T> type, String... fixtureNames) { return create(DEFAULT_REFERENCE_PREFIX, type, fixtureNames); } BeanFactory();  BeanFactory(ObjectMapper objectMapper, FixtureScanner scanner);  BeanFactory(ObjectMapper objectMapper); }
BeanFactory { public <T> T create(Class<T> type, String... fixtureNames) { return create(DEFAULT_REFERENCE_PREFIX, type, fixtureNames); } BeanFactory();  BeanFactory(ObjectMapper objectMapper, FixtureScanner scanner);  BeanFactory(ObjectMapper objectMapper); void init(); void registerAll(Map<String, JsonNode> fixtures); void registerFixture(String name, JsonNode fixture); void unregisterAll(Collection<String> names); void unregisterFixture(String name); void setAllowUnknownProperties(boolean allowUnknownProperties); String createAsString(String... fixtureNames); String createAsString(boolean pretty, String... fixtureNames); String createAsString(boolean pretty, List<String> fixtureNames); String createAsString(boolean pretty, JsonNode jsonNode); T create(Class<T> type, String... fixtureNames); T create(JavaType type, String... fixtureNames); T create(String referencePrefix, JavaType type, String... fixtureNames); T create(String referencePrefix, Class<T> type, String... fixtureNames); Optional<JsonNode> getFixtureAsJsonNode(String fixtureName); }
BeanFactory { public <T> T create(Class<T> type, String... fixtureNames) { return create(DEFAULT_REFERENCE_PREFIX, type, fixtureNames); } BeanFactory();  BeanFactory(ObjectMapper objectMapper, FixtureScanner scanner);  BeanFactory(ObjectMapper objectMapper); void init(); void registerAll(Map<String, JsonNode> fixtures); void registerFixture(String name, JsonNode fixture); void unregisterAll(Collection<String> names); void unregisterFixture(String name); void setAllowUnknownProperties(boolean allowUnknownProperties); String createAsString(String... fixtureNames); String createAsString(boolean pretty, String... fixtureNames); String createAsString(boolean pretty, List<String> fixtureNames); String createAsString(boolean pretty, JsonNode jsonNode); T create(Class<T> type, String... fixtureNames); T create(JavaType type, String... fixtureNames); T create(String referencePrefix, JavaType type, String... fixtureNames); T create(String referencePrefix, Class<T> type, String... fixtureNames); Optional<JsonNode> getFixtureAsJsonNode(String fixtureName); static final String DEFAULT_REFERENCE_PREFIX; }