0
votes

I have REST Assured working in one of our JAR projects. Now I'm trying to add a similar test class in our WAR project.

I added REST Assured to the WAR project:

<dependency conf="test->default" org="com.jayway.restassured"
    name="rest-assured" rev="1.8.1"/>

I have also ASM on the test classpath (asm-4.0, asm-analysis-4.0, asm-commons-4.0, asm-tree-4.0, asm-util-4.0); mentioning this since the only search results on my problem suggested a relationship with ASM.

When I run my test, it gives the following error:

java.lang.NoSuchMethodError: org.codehaus.groovy.runtime.ScriptBytecodeAdapter.castToType(Ljava/lang/Object;Ljava/lang/Class;)Ljava/lang/Object;
    at com.jayway.restassured.internal.ResponseParserRegistrar.<init>(ResponseParserRegistrar.groovy)
    at com.mycompany.testSomething(SomethingTest.java:50)

I've minimized my test to the following:

@Test
public void testSomething() {
    ResponseParserRegistrar r = new ResponseParserRegistrar();
}

Obviously I have no direct need to create a ResponseParserRegistrar, but this is what REST Assured does and fails on when I use REST Assured.

Your help would be much appreciated!

2

2 Answers

0
votes

Have a look at FAQ #2 at https://code.google.com/p/rest-assured/wiki/FAQ, that would solve your classpath issues. Also I would encourage you to upgrade to a newer version since 1.8.1 is really old.

0
votes

There is possibility server can't read your method or it will require a some parameters.

NoSuchMethodError is being thrown when program tries to call a class method that doesn’t exist. The method can be static or it can be an instance method too