@Test public void shouldCreateNobtWithDefaultValues() throws Exception { NobtFactory sut = new NobtFactory( Optimizer::defaultOptimizer, Clock.fixed(FIRST_OF_2017.toInstant(ZoneOffset.UTC), ZoneOffset.UTC) ); Nobt nobt = sut.create("Test", Sets.newHashSet(thomas), EUR); assertThat(nobt, allOf( hasName(equalTo("Test")), hasCurrency(equalTo(EUR)), hasParticipants(containsInAnyOrder(thomas)), hasId(notNullValue(NobtId.class)), hasCreationTime(equalTo(ZonedDateTime.of(2017, 1, 1, 0, 0, 0, 0, ZoneOffset.UTC).toInstant())) )); }
public Nobt create(String name, Set<Person> explicitParticipants, CurrencyKey currencyKey) { return new Nobt(NobtId.newInstance(), currencyKey, name, explicitParticipants, emptySet(), emptySet(), emptySet(), Instant.now(clock), optimizerFactory.get()); }
NobtFactory { public Nobt create(String name, Set<Person> explicitParticipants, CurrencyKey currencyKey) { return new Nobt(NobtId.newInstance(), currencyKey, name, explicitParticipants, emptySet(), emptySet(), emptySet(), Instant.now(clock), optimizerFactory.get()); } }
NobtFactory { public Nobt create(String name, Set<Person> explicitParticipants, CurrencyKey currencyKey) { return new Nobt(NobtId.newInstance(), currencyKey, name, explicitParticipants, emptySet(), emptySet(), emptySet(), Instant.now(clock), optimizerFactory.get()); } NobtFactory();  NobtFactory(Supplier<Optimizer> optimizerFactory, Clock clock); }
NobtFactory { public Nobt create(String name, Set<Person> explicitParticipants, CurrencyKey currencyKey) { return new Nobt(NobtId.newInstance(), currencyKey, name, explicitParticipants, emptySet(), emptySet(), emptySet(), Instant.now(clock), optimizerFactory.get()); } NobtFactory();  NobtFactory(Supplier<Optimizer> optimizerFactory, Clock clock); Nobt create(String name, Set<Person> explicitParticipants, CurrencyKey currencyKey); }
NobtFactory { public Nobt create(String name, Set<Person> explicitParticipants, CurrencyKey currencyKey) { return new Nobt(NobtId.newInstance(), currencyKey, name, explicitParticipants, emptySet(), emptySet(), emptySet(), Instant.now(clock), optimizerFactory.get()); } NobtFactory();  NobtFactory(Supplier<Optimizer> optimizerFactory, Clock clock); Nobt create(String name, Set<Person> explicitParticipants, CurrencyKey currencyKey);  }