Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Getting Null Pointer for Destination #67

Open
sandeep540 opened this issue Dec 21, 2015 · 0 comments
Open

Getting Null Pointer for Destination #67

sandeep540 opened this issue Dec 21, 2015 · 0 comments

Comments

@sandeep540
Copy link

File
/**

*/
package com.colehaan.wc.integration.webservice.test;

import static com.eclipsesource.restfuse.Assert.assertOk;

import org.junit.Rule;
import org.junit.runner.RunWith;

import com.eclipsesource.restfuse.AuthenticationType;
import com.eclipsesource.restfuse.Destination;
import com.eclipsesource.restfuse.HttpJUnitRunner;
import com.eclipsesource.restfuse.Method;
import com.eclipsesource.restfuse.Response;
import com.eclipsesource.restfuse.annotation.Authentication;
import com.eclipsesource.restfuse.annotation.Context;
import com.eclipsesource.restfuse.annotation.HttpTest;

import junit.framework.TestCase;

/**

  • @author 13160
    *
    */
    @RunWith(HttpJUnitRunner.class)
    public class TestCHWebService extends TestCase {

    @context
    private Response response; // will be injected after every request

    @rule
    public Destination restfuse = getDestination();

    private Destination getDestination() {
    Destination destination = new Destination(this, "http://plmd.colehaan.net/Windchill/servlet/rest/webservice/mediabin");
    destination.getRequestContext().addHeader("Content-Type", "application/json");
    System.out.println(destination);
    return destination;
    }

    @httptest(method = Method.POST, path = "/getLineDrawingMetaData", authentications = {
    @authentication(user = "wcadmin", password = "wcadmin", type = AuthenticationType.BASIC) })

    public void checkPlmOnlineStatus() {
    assertOk(response);

    int responseCode = response.getStatus();
    System.out.println(responseCode);
    System.out.println(response.getBody());
    

    }

}

Error:

java.lang.NullPointerException
at com.github.kevinsawicki.http.HttpRequest$CloseOperation.done(HttpRequest.java:647)
at com.github.kevinsawicki.http.HttpRequest$Operation.call(HttpRequest.java:608)
at com.github.kevinsawicki.http.HttpRequest.copy(HttpRequest.java:2380)
at com.github.kevinsawicki.http.HttpRequest.send(HttpRequest.java:2727)
at com.eclipsesource.restfuse.internal.InternalRequest.post(InternalRequest.java:76)
at com.eclipsesource.restfuse.internal.HttpTestStatement.callService(HttpTestStatement.java:119)
at com.eclipsesource.restfuse.internal.HttpTestStatement.sendRequest(HttpTestStatement.java:105)
at com.eclipsesource.restfuse.internal.BasicStatement.evaluate(BasicStatement.java:30)
at com.eclipsesource.restfuse.internal.HttpTestStatement.doEvaluate(HttpTestStatement.java:84)
at com.eclipsesource.restfuse.internal.HttpTestStatement.evaluate(HttpTestStatement.java:64)
at org.junit.rules.RunRules.evaluate(RunRules.java:20)
at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:325)
at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:78)
at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:57)
at org.junit.runners.ParentRunner$3.run(ParentRunner.java:290)
at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:71)
at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:288)
at org.junit.runners.ParentRunner.access$000(ParentRunner.java:58)
at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:268)
at org.junit.runners.ParentRunner.run(ParentRunner.java:363)
at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:86)
at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:459)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:675)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:382)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:192)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant