kkapelon / java-testing-with-spock Goto Github PK
View Code? Open in Web Editor NEWCode samples from the book "Java testing with Spock"
Home Page: https://www.manning.com/books/java-testing-with-spock
Code samples from the book "Java testing with Spock"
Home Page: https://www.manning.com/books/java-testing-with-spock
I have two issues. I am trying to buy your book on Manning's site and it won't add to my cart.
I am hoping it will help with a problem I am having. I have a test like this:
import spock.lang.Specification
class EmployeeTest extends Specification {
def "a valid employee should be valid"() {
given:
def Employee employee = new Employee()
def User mockUser = Mock(User)
when:
BusinessServiceResult bsResult = employee.prepareForPersistance("aTransactionId", "aTransactionName", mockUser);
then:
bsResult != null
bsResult.isSuccessful()
}
}
I get
groovy.lang.MissingMethodException: No signature of method: com.pbi.datanet.model.businessobject.bo.Employee.prepareForPersistance() is applicable for argument types: (java.lang.String, java.lang.String, com.pbi.datanet.model.businessobject.bo.User$$EnhancerByCGLIB$$20359d67) values: [aTransactionId, aTransactionName, Mock for type 'User' named 'mockUser']
Possible solutions: prepareForPersistence(java.lang.String, java.lang.String, com.pbi.datanet.model.businessobject.bo.User)
but I have seen in your code here that you pass mocks as real objects. Sorry to leave this here it's the only way I could find to contact you.
mockito dependency is missing in build.gradle
Hi,
I have taken an interest in Spock and have looked to the Manning book for learning about it. I have forked your repository and have started working on providing Gradle build scripts. Once completed, I would like to make a pull request to have the Gradle build scripts merged into your repo. Is this something you would find of value?
Thanks,
Mike
If you run the tests from within the IntelliJ IDE the tests fail, but if you run them from the command line using: mvn test
the tests pass.
Stacktrace:
java.io.FileNotFoundException: src/test/resources/quotes.txt (No such file or directory)
at java.io.FileInputStream.(FileInputStream.java:146)
at groovy.util.CharsetToolkit.(CharsetToolkit.java:69)
at com.manning.spock.chapter2.GroovyFilesSpec.demo for reading a text file line by line(GroovyFilesSpec.groovy:20)
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.