Compare commits

...

5 Commits

Author SHA1 Message Date
snyk-bot
f9c0349fd8 fix: pom.xml to reduce vulnerabilities
The following vulnerabilities are fixed with an upgrade:
- https://snyk.io/vuln/SNYK-JAVA-COMFASTERXMLJACKSONCORE-3038424
- https://snyk.io/vuln/SNYK-JAVA-COMFASTERXMLJACKSONCORE-3038426
- https://snyk.io/vuln/SNYK-JAVA-ORGYAML-2806360
- https://snyk.io/vuln/SNYK-JAVA-ORGYAML-3016889
- https://snyk.io/vuln/SNYK-JAVA-ORGYAML-3016891
2022-10-17 22:14:51 +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

@@ -88,19 +88,31 @@
<dependency>
<groupId>org.springdoc</groupId>
<artifactId>springdoc-openapi-ui</artifactId>
<version>1.2.32</version>
<version>1.6.4</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
}
}