diff --git a/pom.xml b/pom.xml index a6c4932..8562394 100644 --- a/pom.xml +++ b/pom.xml @@ -91,16 +91,28 @@ 1.2.32 + org.springframework.boot spring-boot-starter-test test - - - org.junit.vintage - junit-vintage-engine - - + + + org.spockframework + spock-core + 1.3-groovy-2.5 + test + + + org.spockframework + spock-spring + 1.3-groovy-2.5 + test + + + io.rest-assured + rest-assured + test com.tngtech.archunit @@ -108,10 +120,7 @@ 0.13.1 test - - io.rest-assured - rest-assured - + @@ -144,8 +153,25 @@ maven-surefire-plugin ${surefire.and.failsafe.report.dir} + + **/*Spec.java + **/*Test.java + + + org.codehaus.gmavenplus + gmavenplus-plugin + 1.10.0 + + + + addTestSources + compileTests + + + + org.jacoco jacoco-maven-plugin @@ -263,6 +289,7 @@ . src/main/java/**,src/main/resources/** ${code.coverage.exclusions} + src/test/groovy,src/test/java wkrzywiec_library-hexagonal wkrzywiec target/site/jacoco/jacoco.xml,target/site/jacoco-it/jacoco.xml diff --git a/src/test/groovy/io/wkrzywiec/hexagonal/library/domain/borrowing/BorrowingFacadeSpec.groovy b/src/test/groovy/io/wkrzywiec/hexagonal/library/domain/borrowing/BorrowingFacadeSpec.groovy new file mode 100644 index 0000000..eaa2406 --- /dev/null +++ b/src/test/groovy/io/wkrzywiec/hexagonal/library/domain/borrowing/BorrowingFacadeSpec.groovy @@ -0,0 +1,32 @@ +package io.wkrzywiec.hexagonal.library.domain.borrowing + +import io.wkrzywiec.hexagonal.library.domain.borrowing.core.BorrowingFacade +import io.wkrzywiec.hexagonal.library.domain.borrowing.core.model.AvailableBook +import io.wkrzywiec.hexagonal.library.domain.borrowing.core.model.MakeBookAvailableCommand +import io.wkrzywiec.hexagonal.library.domain.borrowing.core.ports.outgoing.BorrowingEventPublisher +import spock.lang.Specification + +class BorrowingFacadeSpec extends Specification { + + private BorrowingFacade facade; + private InMemoryBorrowingDatabase database; + private BorrowingEventPublisher eventPublisher; + + def setup(){ + database = new InMemoryBorrowingDatabase(); + eventPublisher = new BorrowingEventPublisherFake(); + facade = new BorrowingFacade(database, eventPublisher); + } + + def "Make a book available"(){ + + given: "prepare a command" + def command = new MakeBookAvailableCommand(100L) + + when: "receive MakeBookAvailableCommand" + facade.handle(command) + + then: "check database to have this book as available" + database.availableBooks[100L].idAsLong == new AvailableBook(100L).idAsLong + } +} \ No newline at end of file