美文网首页
Organizing Layers Using Hexagona

Organizing Layers Using Hexagona

作者: 矩形 | 来源:发表于2022-03-30 20:24 被阅读0次

https://www.baeldung.com/hexagonal-architecture-ddd-spring

class DomainOrderServiceUnitTest {

private OrderRepository orderRepository;
private DomainOrderService tested;
@BeforeEach
void setUp() {
    orderRepository = mock(OrderRepository.class);
    tested = new DomainOrderService(orderRepository);
}

@Test
void shouldCreateOrder_thenSaveIt() {
    final Product product = new Product(UUID.randomUUID(), BigDecimal.TEN, "productName");

    final UUID id = tested.createOrder(product);

    verify(orderRepository).save(any(Order.class));
    assertNotNull(id);
}

}

相关文章

网友评论

      本文标题:Organizing Layers Using Hexagona

      本文链接:https://www.haomeiwen.com/subject/papwjrtx.html