org.spockframework:spock-core:0.7-groovy-2.0
Gradle 1.12
Groovy 1.8.6
java
Hello,
I am trying to use spockwith my java application to run unit tests and build with gradle.
However, since I'm new to spock, I'm not sure how I can pass the actual parameters to get the correct output?
This is the signature of the function I want to test, which takes an input stream, char [] and a string:
public String makeRequest(InputStream keystoreFilename, char[] keystorePassword, String cnn_url) {
...
}
So, in my test specification, I want to transfer the keystore file as inputStream, where the actual keystore is located .. /resources/keystore.bks, and the actual password for the keystore and URL where the web service is. However, I get this error when trying to run unit test:
groovy.lang.MissingMethodException: No signature of method: com.sunsystem.HttpSnapClient.SnapClientTest.FileInputStream()
My test test is lower, but I think I'm wrong.
import spock.lang.Specification;
import java.io.InputStream;
import java.io.FileInputStream;
class SnapClientTest extends Specification {
def 'Connect to https web service'() {
setup:
def snapzClient = new SnapzClient();
def inputStream = FileInputStream("../resources/keystore.bks")
def keystorePwd = "password".toCharArray()
def url = "https://example_webservice.com"
expect: 'success when all correct parameters are used'
snapzClient.makeRequest(A, B, C) == RESULT
where:
A | B | C | RESULT
inputStream | keystorePwd | url | 0
}
}
,