@Test public void testRegisterPublisher() { PublisherContract contract = new PublisherContract(); PublisherContractId publisherContractId = PublisherContractId.randomId(); double feePercentage = 5.0; contract.register(publisherContractId, "Addison Wesley", feePercentage, LIMIT); PublisherContractRegisteredEvent event = getOnlyElement(filter(contract.getUncommittedEvents(), PublisherContractRegisteredEvent.class)); assertThat(event.feePercentage, is(5.0)); assertThat(event.publisherName, is("Addison Wesley")); }
public void register(PublisherContractId publisherContractId, String name, double feePercentage, long limit) { assertHasNotBeenRegistered(); applyChange(new PublisherContractRegisteredEvent(publisherContractId, nextVersion(), now(), name, feePercentage, limit)); }
PublisherContract extends AggregateRoot<PublisherContractId> { public void register(PublisherContractId publisherContractId, String name, double feePercentage, long limit) { assertHasNotBeenRegistered(); applyChange(new PublisherContractRegisteredEvent(publisherContractId, nextVersion(), now(), name, feePercentage, limit)); } }
PublisherContract extends AggregateRoot<PublisherContractId> { public void register(PublisherContractId publisherContractId, String name, double feePercentage, long limit) { assertHasNotBeenRegistered(); applyChange(new PublisherContractRegisteredEvent(publisherContractId, nextVersion(), now(), name, feePercentage, limit)); }  }
PublisherContract extends AggregateRoot<PublisherContractId> { public void register(PublisherContractId publisherContractId, String name, double feePercentage, long limit) { assertHasNotBeenRegistered(); applyChange(new PublisherContractRegisteredEvent(publisherContractId, nextVersion(), now(), name, feePercentage, limit)); }  void register(PublisherContractId publisherContractId, String name, double feePercentage, long limit); void registerPurchase(ProductId productId, long unitPrice, int quantity); }
PublisherContract extends AggregateRoot<PublisherContractId> { public void register(PublisherContractId publisherContractId, String name, double feePercentage, long limit) { assertHasNotBeenRegistered(); applyChange(new PublisherContractRegisteredEvent(publisherContractId, nextVersion(), now(), name, feePercentage, limit)); }  void register(PublisherContractId publisherContractId, String name, double feePercentage, long limit); void registerPurchase(ProductId productId, long unitPrice, int quantity);  }