Compare commits

...

5 Commits

Author SHA1 Message Date
snyk-bot
9ac88f0f25 fix: upgrade org.postgresql:postgresql from 42.2.12 to 42.2.18.jre7
Snyk has created this PR to upgrade org.postgresql:postgresql from 42.2.12 to 42.2.18.jre7.

See this package in Maven Repository:
https://mvnrepository.com/artifact/org.postgresql/postgresql/

See this project in Snyk:
https://app.snyk.io/org/wkrzywiec/project/8c281e44-2e28-41de-b479-52d5d28556c7?utm_source=github&utm_medium=upgrade-pr
2020-12-15 23:02:09 +00:00
Wojtek Krzywiec
e2b77ab1d0 Merge pull request #19 from wkrzywiec/spock-tests
Spock depenencies tests
2020-10-13 06:37:00 +02:00
Wojtek Krzywiec
967a349b4c bring back JUnit4 deps 2020-10-13 06:34:26 +02:00
Wojtek Krzywiec
42b08c8995 BorrowingFacadeSpec added 2020-09-20 12:32:04 +02:00
Wojtek Krzywiec
58a9a0f95b add spock dependencies to pom.xml 2020-09-19 12:41:34 +02:00
2 changed files with 70 additions and 11 deletions

49
pom.xml
View File

@@ -72,7 +72,7 @@
<dependency>
<groupId>org.postgresql</groupId>
<artifactId>postgresql</artifactId>
<version>42.2.12</version>
<version>42.2.18.jre7</version>
</dependency>
<dependency>
<groupId>org.liquibase</groupId>
@@ -91,16 +91,28 @@
<version>1.2.32</version>
</dependency>
<!-- TEST dependencies -->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
<exclusions>
<exclusion>
<groupId>org.junit.vintage</groupId>
<artifactId>junit-vintage-engine</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.spockframework</groupId>
<artifactId>spock-core</artifactId>
<version>1.3-groovy-2.5</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.spockframework</groupId>
<artifactId>spock-spring</artifactId>
<version>1.3-groovy-2.5</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>io.rest-assured</groupId>
<artifactId>rest-assured</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>com.tngtech.archunit</groupId>
@@ -108,10 +120,7 @@
<version>0.13.1</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>io.rest-assured</groupId>
<artifactId>rest-assured</artifactId>
</dependency>
</dependencies>
<build>
@@ -144,8 +153,25 @@
<artifactId>maven-surefire-plugin</artifactId>
<configuration>
<reportsDirectory>${surefire.and.failsafe.report.dir}</reportsDirectory>
<includes>
<include>**/*Spec.java</include>
<include>**/*Test.java</include>
</includes>
</configuration>
</plugin>
<plugin>
<groupId>org.codehaus.gmavenplus</groupId>
<artifactId>gmavenplus-plugin</artifactId>
<version>1.10.0</version>
<executions>
<execution>
<goals>
<goal>addTestSources</goal>
<goal>compileTests</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.jacoco</groupId>
<artifactId>jacoco-maven-plugin</artifactId>
@@ -263,6 +289,7 @@
<sonar.sources>.</sonar.sources>
<sonar.inclusions>src/main/java/**,src/main/resources/**</sonar.inclusions>
<sonar.exclusions>${code.coverage.exclusions}</sonar.exclusions>
<sonat.tests>src/test/groovy,src/test/java</sonat.tests>
<sonar.projectKey>wkrzywiec_library-hexagonal</sonar.projectKey>
<sonar.organization>wkrzywiec</sonar.organization>
<sonar.coverage.jacoco.xmlReportPaths>target/site/jacoco/jacoco.xml,target/site/jacoco-it/jacoco.xml</sonar.coverage.jacoco.xmlReportPaths>

View File

@@ -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
}
}