suvallur / rest-assured

Automatically exported from code.google.com/p/rest-assured
0 stars 0 forks source link

Runtime exception when using REST Assured without Hamcrest library #326

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. Non-maven project setup with all REST Assured jars added to build path 
except hamcrest libraries.
2. Write a JUnit/TestNG test using JUnit/TestNG assert (without using any 
Hamcrest matcher)
3. Compile and Run the test

What is the expected output? What do you see instead?

Since Hamcrest matchers are not used in the code, the test should run just fine.

What version of the product are you using? On what operating system?
Version used: 2.3.0
OS: Linux and Windows

Please provide any additional information below.

Should be able to use REST Assured without using Hamcrest libraries.

Original issue reported on code.google.com by spvinit...@gmail.com on 5 May 2014 at 11:01

GoogleCodeExporter commented 9 years ago
Here is the stack trace of the error when excluding Hamcrest from build path. 
Also, would like to know if all the transitive dependencies(libraries) fall 
under Apache 2.0 license as they as distributed as part of REST Assured.

java.lang.NoClassDefFoundError: org/hamcrest/Matcher
    at java.lang.Class.getDeclaredMethods0(Native Method)
    at java.lang.Class.privateGetDeclaredMethods(Unknown Source)
    at java.lang.Class.privateGetPublicMethods(Unknown Source)
    at java.lang.Class.getMethods(Unknown Source)
    at org.codehaus.groovy.reflection.stdclasses.CachedSAMClass.getSAMMethod(CachedSAMClass.java:135)
    at org.codehaus.groovy.reflection.ClassInfo.isSAM(ClassInfo.java:280)
    at org.codehaus.groovy.reflection.ClassInfo.createCachedClass(ClassInfo.java:270)
    at org.codehaus.groovy.reflection.ClassInfo.access$400(ClassInfo.java:36)
    at org.codehaus.groovy.reflection.ClassInfo$LazyCachedClassRef.initValue(ClassInfo.java:441)
    at org.codehaus.groovy.reflection.ClassInfo$LazyCachedClassRef.initValue(ClassInfo.java:432)
    at org.codehaus.groovy.util.LazyReference.getLocked(LazyReference.java:46)
    at org.codehaus.groovy.util.LazyReference.get(LazyReference.java:33)
    at org.codehaus.groovy.reflection.ClassInfo.getCachedClass(ClassInfo.java:89)
    at org.codehaus.groovy.reflection.ReflectionCache.getCachedClass(ReflectionCache.java:107)
    at org.codehaus.groovy.reflection.ParameterTypes.getParametersTypes0(ParameterTypes.java:78)
    at org.codehaus.groovy.reflection.ParameterTypes.getParameterTypes(ParameterTypes.java:64)
    at org.codehaus.groovy.reflection.CachedMethod.compareToMethod(CachedMethod.java:183)
    at org.codehaus.groovy.reflection.CachedMethod.compareTo(CachedMethod.java:139)
    at org.codehaus.groovy.reflection.CachedMethod$MyComparator.compare(CachedMethod.java:312)
    at java.util.Arrays.binarySearch0(Unknown Source)
    at java.util.Arrays.binarySearch(Unknown Source)
    at org.codehaus.groovy.reflection.CachedMethod.find(CachedMethod.java:65)
    at groovy.lang.MetaClassImpl.applyPropertyDescriptors(MetaClassImpl.java:2360)
    at groovy.lang.MetaClassImpl.setupProperties(MetaClassImpl.java:2126)
    at groovy.lang.MetaClassImpl.addProperties(MetaClassImpl.java:3075)
    at groovy.lang.MetaClassImpl.initialize(MetaClassImpl.java:3046)
    at org.codehaus.groovy.reflection.ClassInfo.getMetaClassUnderLock(ClassInfo.java:176)
    at org.codehaus.groovy.reflection.ClassInfo.getMetaClass(ClassInfo.java:192)
    at com.jayway.restassured.internal.RequestSpecificationImpl.$getStaticMetaClass(RequestSpecificationImpl.groovy)
    at com.jayway.restassured.internal.RequestSpecificationImpl.<init>(RequestSpecificationImpl.groovy:93)
    at com.jayway.restassured.RestAssured.createTestSpecification(RestAssured.java:1372)
    at com.jayway.restassured.RestAssured.given(RestAssured.java:692)
    at com.jayway.restassured.RestAssured.get(RestAssured.java:759)
    at SampleGETMethod.testVerifyNimbulaSites(SampleGETMethod.java:57)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
    at java.lang.reflect.Method.invoke(Unknown Source)
    at org.testng.internal.MethodInvocationHelper.invokeMethod(MethodInvocationHelper.java:84)
    at org.testng.internal.Invoker.invokeMethod(Invoker.java:714)
    at org.testng.internal.Invoker.invokeTestMethod(Invoker.java:901)
    at org.testng.internal.Invoker.invokeTestMethods(Invoker.java:1231)
    at org.testng.internal.TestMethodWorker.invokeTestMethods(TestMethodWorker.java:127)
    at org.testng.internal.TestMethodWorker.run(TestMethodWorker.java:111)
    at org.testng.TestRunner.privateRun(TestRunner.java:767)
    at org.testng.TestRunner.run(TestRunner.java:617)
    at org.testng.SuiteRunner.runTest(SuiteRunner.java:334)
    at org.testng.SuiteRunner.runSequentially(SuiteRunner.java:329)
    at org.testng.SuiteRunner.privateRun(SuiteRunner.java:291)
    at org.testng.SuiteRunner.run(SuiteRunner.java:240)
    at org.testng.SuiteRunnerWorker.runSuite(SuiteRunnerWorker.java:52)
    at org.testng.SuiteRunnerWorker.run(SuiteRunnerWorker.java:86)
    at org.testng.TestNG.runSuitesSequentially(TestNG.java:1224)
    at org.testng.TestNG.runSuitesLocally(TestNG.java:1149)
    at org.testng.TestNG.run(TestNG.java:1057)
    at org.testng.remote.RemoteTestNG.run(RemoteTestNG.java:111)
    at org.testng.remote.RemoteTestNG.initAndRun(RemoteTestNG.java:204)
    at org.testng.remote.RemoteTestNG.main(RemoteTestNG.java:175)
Caused by: java.lang.ClassNotFoundException: org.hamcrest.Matcher
    at java.net.URLClassLoader$1.run(Unknown Source)
    at java.net.URLClassLoader$1.run(Unknown Source)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.net.URLClassLoader.findClass(Unknown Source)
    at java.lang.ClassLoader.loadClass(Unknown Source)
    at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
    at java.lang.ClassLoader.loadClass(Unknown Source)
    ... 58 more

Original comment by spvinit...@gmail.com on 5 May 2014 at 11:02