-
Notifications
You must be signed in to change notification settings - Fork 55
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #19 from wkrzywiec/spock-tests
Spock depenencies tests
- Loading branch information
Showing
2 changed files
with
68 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
32 changes: 32 additions & 0 deletions
32
src/test/groovy/io/wkrzywiec/hexagonal/library/domain/borrowing/BorrowingFacadeSpec.groovy
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 | ||
} | ||
} |