Giter Site home page Giter Site logo

kkapelon / java-testing-with-spock Goto Github PK

View Code? Open in Web Editor NEW
270.0 270.0 136.0 398 KB

Code samples from the book "Java testing with Spock"

Home Page: https://www.manning.com/books/java-testing-with-spock

Java 36.33% Groovy 59.49% HTML 0.27% CSS 2.00% FreeMarker 1.91%
book gradle-support groovy java java-test junit-test rest spock-tests test-driven-development test-framework testing

java-testing-with-spock's People

Contributors

francescobianchi avatar jonatasemidio avatar kkapelon avatar lreimer avatar mikesmithson avatar willis7 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

java-testing-with-spock's Issues

Help

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.

Add Gradle Builds

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

Tests Fail in GroovyFilesSpec of Chapter 2

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)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.