diff --git a/samples/view-store/src/test/java/store/customer/api/CustomerEntityTest.java b/samples/view-store/src/test/java/store/customer/api/CustomerEntityTest.java index d05c13024..5ce256919 100644 --- a/samples/view-store/src/test/java/store/customer/api/CustomerEntityTest.java +++ b/samples/view-store/src/test/java/store/customer/api/CustomerEntityTest.java @@ -1,5 +1,6 @@ package store.customer.api; +import akka.Done; import akka.javasdk.testkit.EventSourcedResult; import akka.javasdk.testkit.EventSourcedTestKit; import org.junit.jupiter.api.Test; @@ -8,6 +9,7 @@ import store.customer.domain.Customer; import store.customer.domain.CustomerEvent; +import static akka.Done.done; import static org.junit.jupiter.api.Assertions.assertEquals; import static store.customer.domain.CustomerEvent.CustomerAddressChanged; import static store.customer.domain.CustomerEvent.CustomerCreated; @@ -25,16 +27,16 @@ public void testCustomerNameChange() { String name = "Some Customer"; Address address = new Address("123 Some Street", "Some City"); Customer customer = new Customer("someone@example.com", name, address); - EventSourcedResult result = testKit.call(entity -> entity.create(customer)); - assertEquals("OK", result.getReply()); + EventSourcedResult result = testKit.call(entity -> entity.create(customer)); + assertEquals(done(), result.getReply()); assertEquals(name, testKit.getState().name()); result.getNextEventOfType(CustomerCreated.class); } { String newName = "Some Name"; - EventSourcedResult result = testKit.call(entity -> entity.changeName(newName)); - assertEquals("OK", result.getReply()); + EventSourcedResult result = testKit.call(entity -> entity.changeName(newName)); + assertEquals(done(), result.getReply()); assertEquals(newName, testKit.getState().name()); result.getNextEventOfType(CustomerNameChanged.class); } @@ -49,8 +51,8 @@ public void testCustomerAddressChange() { { Address address = new Address("123 Some Street", "Some City"); Customer customer = new Customer("someone@example.com", "Some Customer", address); - EventSourcedResult result = testKit.call(e -> e.create(customer)); - assertEquals("OK", result.getReply()); + EventSourcedResult result = testKit.call(e -> e.create(customer)); + assertEquals(done(), result.getReply()); assertEquals(address.street(), testKit.getState().address().street()); assertEquals(address.city(), testKit.getState().address().city()); result.getNextEventOfType(CustomerCreated.class); @@ -58,8 +60,8 @@ public void testCustomerAddressChange() { { Address newAddress = new Address("42 Some Road", "Some Other City"); - EventSourcedResult result = testKit.call(e -> e.changeAddress(newAddress)); - assertEquals("OK", result.getReply()); + EventSourcedResult result = testKit.call(e -> e.changeAddress(newAddress)); + assertEquals(done(), result.getReply()); assertEquals(newAddress.street(), testKit.getState().address().street()); assertEquals(newAddress.city(), testKit.getState().address().city()); result.getNextEventOfType(CustomerAddressChanged.class); diff --git a/samples/view-store/src/test/java/store/product/api/ProductEntityTest.java b/samples/view-store/src/test/java/store/product/api/ProductEntityTest.java index 456e68a21..43ab214b4 100644 --- a/samples/view-store/src/test/java/store/product/api/ProductEntityTest.java +++ b/samples/view-store/src/test/java/store/product/api/ProductEntityTest.java @@ -1,5 +1,6 @@ package store.product.api; +import akka.Done; import akka.javasdk.testkit.EventSourcedResult; import akka.javasdk.testkit.EventSourcedTestKit; import org.junit.jupiter.api.Test; @@ -8,6 +9,7 @@ import store.product.domain.Product; import store.product.domain.ProductEvent; +import static akka.Done.done; import static org.junit.jupiter.api.Assertions.assertEquals; public class ProductEntityTest { @@ -21,16 +23,16 @@ public void testProductNameChange() { { String name = "Super Duper Thingamajig"; Product product = new Product(name, new Money("USD", 123, 45)); - EventSourcedResult result = testKit.call(entity -> entity.create(product)); - assertEquals("OK", result.getReply()); + EventSourcedResult result = testKit.call(entity -> entity.create(product)); + assertEquals(done(), result.getReply()); assertEquals(name, testKit.getState().name()); result.getNextEventOfType(ProductEvent.ProductCreated.class); } { String newName = "Thing Supreme"; - EventSourcedResult result = testKit.call(entity -> entity.changeName(newName)); - assertEquals("OK", result.getReply()); + EventSourcedResult result = testKit.call(entity -> entity.changeName(newName)); + assertEquals(done(), result.getReply()); assertEquals(newName, testKit.getState().name()); result.getNextEventOfType(ProductEvent.ProductNameChanged.class); } @@ -45,8 +47,8 @@ public void testProductPriceChange() { { Money price = new Money("USD", 123, 45); Product product = new Product("Super Duper Thingamajig", price); - EventSourcedResult result = testKit.call(e -> e.create(product)); - assertEquals("OK", result.getReply()); + EventSourcedResult result = testKit.call(e -> e.create(product)); + assertEquals(done(), result.getReply()); assertEquals(price.currency(), testKit.getState().price().currency()); assertEquals(price.units(), testKit.getState().price().units()); assertEquals(price.cents(), testKit.getState().price().cents()); @@ -55,8 +57,8 @@ public void testProductPriceChange() { { Money newPrice = new Money("USD", 56, 78); - EventSourcedResult result = testKit.call(e -> e.changePrice(newPrice)); - assertEquals("OK", result.getReply()); + EventSourcedResult result = testKit.call(e -> e.changePrice(newPrice)); + assertEquals(done(), result.getReply()); assertEquals(newPrice.currency(), testKit.getState().price().currency()); assertEquals(newPrice.units(), testKit.getState().price().units()); assertEquals(newPrice.cents(), testKit.getState().price().cents());