BAEL-3777: Fixed formatting
This commit is contained in:
parent
b05d42a6ea
commit
8b49858bfe
|
@ -41,13 +41,11 @@ public class Order {
|
|||
}
|
||||
|
||||
private OrderItem getOrderItem(final UUID id) {
|
||||
return orderItems
|
||||
.stream()
|
||||
.filter(orderItem -> orderItem
|
||||
.getProductId()
|
||||
.equals(id))
|
||||
.findFirst()
|
||||
.orElseThrow(() -> new DomainException("Product with " + id + " doesn't exist."));
|
||||
return orderItems.stream()
|
||||
.filter(orderItem -> orderItem.getProductId()
|
||||
.equals(id))
|
||||
.findFirst()
|
||||
.orElseThrow(() -> new DomainException("Product with " + id + " doesn't exist."));
|
||||
}
|
||||
|
||||
private void validateState() {
|
||||
|
@ -78,7 +76,6 @@ public class Order {
|
|||
return Collections.unmodifiableList(orderItems);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return Objects.hash(id, orderItems, price, status);
|
||||
|
|
|
@ -2,7 +2,7 @@ package com.baeldung.dddhexagonalspring.infrastracture.configuration;
|
|||
|
||||
import org.springframework.data.cassandra.repository.config.EnableCassandraRepositories;
|
||||
|
||||
import com.baeldung.dddhexagonalspring.infrastracture.repository.SpringDataCassandraOrderRepository;
|
||||
import com.baeldung.dddhexagonalspring.infrastracture.repository.cassandra.SpringDataCassandraOrderRepository;
|
||||
|
||||
@EnableCassandraRepositories(basePackageClasses = SpringDataCassandraOrderRepository.class)
|
||||
public class CassandraConfiguration {
|
||||
|
|
|
@ -1,8 +1,9 @@
|
|||
package com.baeldung.dddhexagonalspring.infrastracture.configuration;
|
||||
|
||||
import com.baeldung.dddhexagonalspring.infrastracture.repository.SpringDataMongoOrderRepository;
|
||||
import org.springframework.data.mongodb.repository.config.EnableMongoRepositories;
|
||||
|
||||
import com.baeldung.dddhexagonalspring.infrastracture.repository.mongo.SpringDataMongoOrderRepository;
|
||||
|
||||
@EnableMongoRepositories(basePackageClasses = SpringDataMongoOrderRepository.class)
|
||||
public class MongoDBConfiguration {
|
||||
}
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
package com.baeldung.dddhexagonalspring.infrastracture.repository;
|
||||
package com.baeldung.dddhexagonalspring.infrastracture.repository.cassandra;
|
||||
|
||||
import java.util.Optional;
|
||||
import java.util.UUID;
|
|
@ -1,4 +1,4 @@
|
|||
package com.baeldung.dddhexagonalspring.infrastracture.repository;
|
||||
package com.baeldung.dddhexagonalspring.infrastracture.repository.cassandra;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.List;
|
|
@ -1,4 +1,4 @@
|
|||
package com.baeldung.dddhexagonalspring.infrastracture.repository;
|
||||
package com.baeldung.dddhexagonalspring.infrastracture.repository.cassandra;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.UUID;
|
|
@ -1,4 +1,4 @@
|
|||
package com.baeldung.dddhexagonalspring.infrastracture.repository;
|
||||
package com.baeldung.dddhexagonalspring.infrastracture.repository.cassandra;
|
||||
|
||||
import java.util.UUID;
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
package com.baeldung.dddhexagonalspring.infrastracture.repository;
|
||||
package com.baeldung.dddhexagonalspring.infrastracture.repository.mongo;
|
||||
|
||||
import com.baeldung.dddhexagonalspring.domain.Order;
|
||||
import com.baeldung.dddhexagonalspring.domain.repository.OrderRepository;
|
|
@ -1,4 +1,4 @@
|
|||
package com.baeldung.dddhexagonalspring.infrastracture.repository;
|
||||
package com.baeldung.dddhexagonalspring.infrastracture.repository.mongo;
|
||||
|
||||
import com.baeldung.dddhexagonalspring.domain.Order;
|
||||
import org.springframework.data.mongodb.repository.MongoRepository;
|
|
@ -6,7 +6,7 @@ import java.math.BigDecimal;
|
|||
import java.util.Optional;
|
||||
import java.util.UUID;
|
||||
|
||||
import org.junit.After;
|
||||
import org.junit.jupiter.api.AfterEach;
|
||||
import org.junit.jupiter.api.Test;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.boot.test.context.SpringBootTest;
|
||||
|
@ -16,6 +16,7 @@ import org.springframework.test.context.junit.jupiter.SpringJUnitConfig;
|
|||
import com.baeldung.dddhexagonalspring.domain.Order;
|
||||
import com.baeldung.dddhexagonalspring.domain.Product;
|
||||
import com.baeldung.dddhexagonalspring.domain.repository.OrderRepository;
|
||||
import com.baeldung.dddhexagonalspring.infrastracture.repository.cassandra.SpringDataCassandraOrderRepository;
|
||||
|
||||
@SpringJUnitConfig
|
||||
@SpringBootTest
|
||||
|
@ -28,8 +29,8 @@ class CassandraDbOrderRepositoryIntegrationTest {
|
|||
@Autowired
|
||||
private OrderRepository orderRepository;
|
||||
|
||||
@After
|
||||
void cleanUp(){
|
||||
@AfterEach
|
||||
void cleanUp() {
|
||||
cassandraOrderRepository.deleteAll();
|
||||
}
|
||||
|
||||
|
@ -39,6 +40,7 @@ class CassandraDbOrderRepositoryIntegrationTest {
|
|||
// given
|
||||
final UUID id = UUID.randomUUID();
|
||||
final Order order = createOrder(id);
|
||||
order.addOrder(new Product(UUID.randomUUID(), BigDecimal.TEN, "second"));
|
||||
order.complete();
|
||||
|
||||
// when
|
||||
|
|
|
@ -6,7 +6,7 @@ import java.math.BigDecimal;
|
|||
import java.util.Optional;
|
||||
import java.util.UUID;
|
||||
|
||||
import org.junit.After;
|
||||
import org.junit.jupiter.api.AfterEach;
|
||||
import org.junit.jupiter.api.Test;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.boot.test.context.SpringBootTest;
|
||||
|
@ -16,6 +16,7 @@ import org.springframework.test.context.junit.jupiter.SpringJUnitConfig;
|
|||
import com.baeldung.dddhexagonalspring.domain.Order;
|
||||
import com.baeldung.dddhexagonalspring.domain.Product;
|
||||
import com.baeldung.dddhexagonalspring.domain.repository.OrderRepository;
|
||||
import com.baeldung.dddhexagonalspring.infrastracture.repository.mongo.SpringDataMongoOrderRepository;
|
||||
|
||||
@SpringJUnitConfig
|
||||
@SpringBootTest
|
||||
|
@ -28,8 +29,8 @@ class MongoDbOrderRepositoryIntegrationTest {
|
|||
@Autowired
|
||||
private OrderRepository orderRepository;
|
||||
|
||||
@After
|
||||
void cleanUp(){
|
||||
@AfterEach
|
||||
void cleanUp() {
|
||||
mongoOrderRepository.deleteAll();
|
||||
}
|
||||
|
||||
|
|
|
@ -2,6 +2,9 @@ package com.baeldung.dddhexagonalspring.infrastracture.repository;
|
|||
|
||||
import com.baeldung.dddhexagonalspring.domain.Order;
|
||||
import com.baeldung.dddhexagonalspring.domain.Product;
|
||||
import com.baeldung.dddhexagonalspring.infrastracture.repository.mongo.MongoDbOrderRepository;
|
||||
import com.baeldung.dddhexagonalspring.infrastracture.repository.mongo.SpringDataMongoOrderRepository;
|
||||
|
||||
import org.junit.jupiter.api.BeforeEach;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
|
@ -18,7 +21,7 @@ class MongoDbOrderRepositoryUnitTest {
|
|||
private MongoDbOrderRepository tested;
|
||||
|
||||
@BeforeEach
|
||||
void setUp(){
|
||||
void setUp() {
|
||||
springDataOrderRepository = mock(SpringDataMongoOrderRepository.class);
|
||||
|
||||
tested = new MongoDbOrderRepository(springDataOrderRepository);
|
||||
|
|
Loading…
Reference in New Issue