[rest-gradle-plugin] 36/83: Fix the unit tests

Alastair McKinstry mckinstry at moszumanska.debian.org
Wed Oct 25 15:59:05 UTC 2017


This is an automated email from the git hooks/post-receive script.

mckinstry pushed a commit to branch debian/master
in repository rest-gradle-plugin.

commit 6d3df74913384121cddaf49d011c88b02348a23d
Author: Andrea Rossi <andrea.rossi at here.com>
Date:   Tue Aug 5 23:08:42 2014 +0200

    Fix the unit tests
    
    Now the unit tests don't check response.getData(), since it's not
    called anymore
    Fixes the authentication header test, now it really checks the header
---
 src/main/groovy/org/_10ne/gradle/rest/RestTask.groovy     |  1 +
 src/test/groovy/org/_10ne/gradle/rest/RestTaskSpec.groovy | 11 +++++------
 2 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/src/main/groovy/org/_10ne/gradle/rest/RestTask.groovy b/src/main/groovy/org/_10ne/gradle/rest/RestTask.groovy
index eef2a7a..d22d4c3 100644
--- a/src/main/groovy/org/_10ne/gradle/rest/RestTask.groovy
+++ b/src/main/groovy/org/_10ne/gradle/rest/RestTask.groovy
@@ -15,6 +15,7 @@
  */
 
 package org._10ne.gradle.rest
+
 import groovyx.net.http.HttpResponseDecorator
 import groovyx.net.http.RESTClient
 import org.apache.commons.lang.StringUtils
diff --git a/src/test/groovy/org/_10ne/gradle/rest/RestTaskSpec.groovy b/src/test/groovy/org/_10ne/gradle/rest/RestTaskSpec.groovy
index 3f9cce0..c179c14 100644
--- a/src/test/groovy/org/_10ne/gradle/rest/RestTaskSpec.groovy
+++ b/src/test/groovy/org/_10ne/gradle/rest/RestTaskSpec.groovy
@@ -42,6 +42,10 @@ class RestTaskSpec extends Specification {
             requestContentType = 'requestContentType'
             requestBody = 'requestBody'
             contentType = 'contentType'
+
+            doLast({
+                println serverResponse.getData()
+            })
         }
         def mockClient = Mock(RESTClient)
         task.client = mockClient
@@ -63,7 +67,6 @@ class RestTaskSpec extends Specification {
             assert params.requestContentType == 'requestContentType'
             mockResponse
         }
-        1 * mockResponse.getData() >> { 'somedata' }
     }
 
     def 'Configure and execute a preemptive authentication request'() {
@@ -90,9 +93,6 @@ class RestTaskSpec extends Specification {
         when:
         task.executeRequest()
 
-        and:
-        headers[HttpHeaders.AUTHORIZATION] == 'Basic dXNlcm5hbWU6cGFzc3dvcmQ='
-
         then:
         1 * mockClient.setUri('bob.com')
         1 * mockClient.getHeaders() >> { headers }
@@ -102,9 +102,9 @@ class RestTaskSpec extends Specification {
             assert params.body == 'requestBody'
             assert params.contentType == 'contentType'
             assert params.requestContentType == 'requestContentType'
+            assert headers.get(HttpHeaders.AUTHORIZATION) == 'Basic dXNlcm5hbWU6cGFzc3dvcmQ='
             mockResponse
         }
-        1 * mockResponse.getData() >> { 'somedata' }
     }
 
     def 'Configure and execute a request with a custom header'() {
@@ -140,7 +140,6 @@ class RestTaskSpec extends Specification {
             assert headers.get('key') == 'value'
             mockResponse
         }
-        1 * mockResponse.getData() >> { 'somedata' }
     }
 
     def 'Configure and execute a request using a proxy'() {

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-java/rest-gradle-plugin.git



More information about the pkg-java-commits mailing list