Я скачал jar и прошел путь сборки, а также "scribejava-apis-2.5.3" и "scribejava-core-4.2.0"
код ниже:
public class Basicfunc {
String Consumerkeys= "******************";
String Consumersecretkeys="************";
String Token="**********_*^%&-**************";
String Tokensecret="*********************";
@Test
public void getLatestTweet(){
RestAssured.baseURI = "https://api.twitter.com/1.1/statuses";
Response res = given().auth().oauth(Consumerkeys, Consumersecretkeys, Token, Tokensecret).
queryParam("count","1").
when().get("/home_timeline.json").then().extract().response();
String response = res.asString();
System.out.println(response);
JsonPath js = new JsonPath(response);
System.out.println(js.getString("text"));
}
}
ошибка ниже:
java.lang.NoClassDefFoundError: com / github / scribejava / core / model / AbstractRequest
на io.restassured.internal.http.AuthConfig.oauth (AuthConfig.java:182)
at io.restassured.internal.http.AuthConfig $ oauth.call (Неизвестный источник)
в org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCall (CallSiteArray.java:47)
в org.codehaus.groovy.runtime.callsite.AbstractCallSite.call (AbstractCallSite.java:116)
в org.codehaus.groovy.runtime.callsite.AbstractCallSite.call (AbstractCallSite.java:152)
на io.restassured.authentication.OAuthScheme.authenticate (OAuthScheme.groovy: 35)
в io.restassured.authentication.AuthenticationScheme $ authenticate.call (Неизвестный источник)
в org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCall (CallSiteArray.java:47)
в org.codehaus.groovy.runtime.callsite.AbstractCallSite.call (AbstractCallSite.java:116)
в org.codehaus.groovy.runtime.callsite.AbstractCallSite.call (AbstractCallSite.java:128)
в io.restassured.internal.RequestSpecificationImpl.sendRequest (RequestSpecificationImpl.groovy: 1265)
at sun.reflect.NativeMethodAccessorImpl.invoke0 (собственный метод)
at sun.reflect.NativeMethodAccessorImpl.invoke (NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke (DelegatingMethodAccessorImpl.java:43)
в java.lang.reflect.Method.invoke (Method.java:498)
в org.codehaus.groovy.reflection.CachedMethod.invoke (CachedMethod.java:98)
at groovy.lang.MetaMethod.doMethodInvoke (MetaMethod.java:325)
at groovy.lang.MetaClassImpl.invokeMethod (MetaClassImpl.java:1225)
at groovy.lang.MetaClassImpl.invokeMethod (MetaClassImpl.java:1034)
at groovy.lang.MetaClassImpl.invokeMethod (MetaClassImpl.java:822)
в io.restassured.internal.RequestSpecificationImpl.invokeMethod (RequestSpecificationImpl.groovy)
в org.codehaus.groovy.runtime.callsite.PogoInterceptableSite.call (PogoInterceptableSite.java:47)
в org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCall (CallSiteArray.java:47)
в org.codehaus.groovy.runtime.callsite.AbstractCallSite.call (AbstractCallSite.java:116)
в org.codehaus.groovy.runtime.callsite.AbstractCallSite.call (AbstractCallSite.java:152)
на io.restassured.internal.filter.SendRequestFilter.filter (SendRequestFilter.groovy: 30)
в io.restassured.filter.Filter $ filter $ 0.call (Неизвестный источник)
в org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCall (CallSiteArray.java:47)
на io.restassured.filter.Filter $ filter.call (неизвестный источник)
в io.restassured.internal.filter.FilterContextImpl.next (FilterContextImpl.groovy: 72)
на io.restassured.filter.time.TimingFilter.filter (TimingFilter.java:56)
на io.restassured.filter.Filter $ filter.call (неизвестный источник)
в org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCall (CallSiteArray.java:47)
в org.codehaus.groovy.runtime.callsite.AbstractCallSite.call (AbstractCallSite.java:116)
в org.codehaus.groovy.runtime.callsite.AbstractCallSite.call (AbstractCallSite.java:144)
в io.restassured.internal.filter.FilterContextImpl.next (FilterContextImpl.groovy: 72)
на io.restassured.filter.FilterContext $ next.call (неизвестный источник)
в org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCall (CallSiteArray.java:47)
в org.codehaus.groovy.runtime.callsite.AbstractCallSite.call (AbstractCallSite.java:116)
в org.codehaus.groovy.runtime.callsite.AbstractCallSite.call (AbstractCallSite.java:136)в io.restassured.internal.RequestSpecificationImpl.applyPathParamsAndSendRequest (RequestSpecificationImpl.groovy: 1749)
at sun.reflect.NativeMethodAccessorImpl.invoke0 (собственный метод)
at sun.reflect.NativeMethodAccessorImpl.invoke (NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke (DelegatingMethodAccessorImpl.java:43)
в java.lang.reflect.Method.invoke (Method.java:498)
в org.codehaus.groovy.reflection.CachedMethod.invoke (CachedMethod.java:98)
at groovy.lang.MetaMethod.doMethodInvoke (MetaMethod.java:325)
at groovy.lang.MetaClassImpl.invokeMethod (MetaClassImpl.java:1225)
at groovy.lang.MetaClassImpl.invokeMethod (MetaClassImpl.java:1034)
at groovy.lang.MetaClassImpl.invokeMethod (MetaClassImpl.java:822)
в io.restassured.internal.RequestSpecificationImpl.invokeMethod (RequestSpecificationImpl.groovy)
в org.codehaus.groovy.runtime.callsite.PogoInterceptableSite.call (PogoInterceptableSite.java:47)
в org.codehaus.groovy.runtime.callsite.PogoInterceptableSite.callCurrent (PogoInterceptableSite.java:57)
в org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCallCurrent (CallSiteArray.java:51)
в org.codehaus.groovy.runtime.callsite.AbstractCallSite.callCurrent (AbstractCallSite.java:157)
в org.codehaus.groovy.runtime.callsite.AbstractCallSite.callCurrent (AbstractCallSite.java:185)
в io.restassured.internal.RequestSpecificationImpl.applyPathParamsAndSendRequest (RequestSpecificationImpl.groovy: 1755)
at sun.reflect.NativeMethodAccessorImpl.invoke0 (собственный метод)
at sun.reflect.NativeMethodAccessorImpl.invoke (NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke (DelegatingMethodAccessorImpl.java:43)
в java.lang.reflect.Method.invoke (Method.java:498)
в org.codehaus.groovy.reflection.CachedMethod.invoke (CachedMethod.java:98)
at groovy.lang.MetaMethod.doMethodInvoke (MetaMethod.java:325)
at groovy.lang.MetaClassImpl.invokeMethod (MetaClassImpl.java:1225)
at groovy.lang.MetaClassImpl.invokeMethod (MetaClassImpl.java:1034)
at groovy.lang.MetaClassImpl.invokeMethod (MetaClassImpl.java:822)
в io.restassured.internal.RequestSpecificationImpl.invokeMethod (RequestSpecificationImpl.groovy)
в org.codehaus.groovy.runtime.callsite.PogoInterceptableSite.call (PogoInterceptableSite.java:47)
в org.codehaus.groovy.runtime.callsite.PogoInterceptableSite.callCurrent (PogoInterceptableSite.java:57)
в org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCallCurrent (CallSiteArray.java:51)
в org.codehaus.groovy.runtime.callsite.AbstractCallSite.callCurrent (AbstractCallSite.java:157)
в org.codehaus.groovy.runtime.callsite.AbstractCallSite.callCurrent (AbstractCallSite.java:185)
в io.restassured.internal.RequestSpecificationImpl.get (RequestSpecificationImpl.groovy: 171)
в io.restassured.internal.RequestSpecificationImpl.get (RequestSpecificationImpl.groovy)
на twitter.api.test.Basicfunc.getLatestTweet (Basicfunc.java:25)
at sun.reflect.NativeMethodAccessorImpl.invoke0 (собственный метод)
at sun.reflect.NativeMethodAccessorImpl.invoke (NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke (DelegatingMethodAccessorImpl.java:43)
в java.lang.reflect.Method.invoke (Method.java:498)
в org.testng.internal.MethodInvocationHelper.invokeMethod (MethodInvocationHelper.java:124)
в org.testng.internal.Invoker.invokeMethod (Invoker.java:583)
в org.testng.internal.Invoker.invokeTestMethod (Invoker.java:719)
в org.testng.internal.Invoker.invokeTestMethods (Invoker.java:989)
в org.testng.internal.TestMethodWorker.invokeTestMethods (TestMethodWorker.java:125)
в org.testng.internal.TestMethodWorker.run (TestMethodWorker.java:109)в org.testng.TestRunner.privateRun (TestRunner.java:648)
в org.testng.TestRunner.run (TestRunner.java:505)
в org.testng.SuiteRunner.runTest (SuiteRunner.java:455)
на org.testng.SuiteRunner.runSequentially (SuiteRunner.java:450)
в org.testng.SuiteRunner.privateRun (SuiteRunner.java:415)
в org.testng.SuiteRunner.run (SuiteRunner.java:364)
на org.testng.SuiteRunnerWorker.runSuite (SuiteRunnerWorker.java:52)
на org.testng.SuiteRunnerWorker.run (SuiteRunnerWorker.java:84)
на org.testng.TestNG.runSuitesSequentially (TestNG.java:1208)
в org.testng.TestNG.runSuitesLocally (TestNG.java:1137)
на org.testng.TestNG.runSuites (TestNG.java:1049)
на org.testng.TestNG.run (TestNG.java:1017)
на org.testng.remote.AbstractRemoteTestNG.run (AbstractRemoteTestNG.java:114)
в org.testng.remote.RemoteTestNG.initAndRun (RemoteTestNG.java:251)
в org.testng.remote.RemoteTestNG.main (RemoteTestNG.java:77)
Вызывается: java.lang.ClassNotFoundException: com.github.scribejava.core.model.AbstractRequest
на java.net.URLClassLoader.findClass (URLClassLoader.java:381)
в java.lang.ClassLoader.loadClass (ClassLoader.java:424)
at sun.misc.Launcher $ AppClassLoader.loadClass (Launcher.java:335)
в java.lang.ClassLoader.loadClass (ClassLoader.java:357)
... еще 100