"$type":"/items/Bundle",
"id":"djQ6MTIzNDovaXRlbXMvQnVuZGxlOg:-734003741",
"name":"Mital-BundleTest"
}]
@Test()
public void testCreateMyItem() {
given().spec(requestSpec).
param("$type", "/items/Bundle").
param("id","djQ6MTIzNDovaXRlbXMvQnVuZGxlOg:-734003741").
param("name","newname11" ).contentType(ContentType.JSON).when().post().then().assertThat().statusCode(201);
}
I am getting error:
{
"$type": "/common/Error",
"type": "input",
"message": "Error decoding JSON input: com.fasterxml.jackson.core.JsonParseException: Unexpected character ('%' (code 37)): expected a valid value (number, String, array, object, 'true', 'false' or 'null')\n at [Source: java.io.ByteArrayInputStream@7c57bd0a; line: 1, column: 2]"
}
FAILED: testCreateMyItem
java.lang.AssertionError: Expected status code <201> doesn't match actual status code <400>.
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
at java.lang.reflect.Constructor.newInstance(Constructor.java:422)
at org.codehaus.groovy.reflection.CachedConstructor.invoke(CachedConstructor.java:77)
at org.codehaus.groovy.runtime.callsite.ConstructorSite$ConstructorSiteNoUnwrapNoCoerce.callConstructor(ConstructorSite.java:102)
at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCallConstructor(CallSiteArray.java:57)
at org.codehaus.groovy.runtime.callsite.AbstractCallSite.callConstructor(AbstractCallSite.java:232)
at org.codehaus.groovy.runtime.callsite.AbstractCallSite.callConstructor(AbstractCallSite.java:244)
at com.jayway.restassured.internal.ResponseSpecificationImpl$HamcrestAssertionClosure.validate(ResponseSpecificationImpl.groovy:572)
at com.jayway.restassured.internal.ResponseSpecificationImpl$HamcrestAssertionClosure$validate$1.call(Unknown Source)
at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCall(CallSiteArray.java:45)
at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:110)
at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:122)
at com.jayway.restassured.internal.ResponseSpecificationImpl.validateResponseIfRequired(ResponseSpecificationImpl.groovy:731)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:497)
at org.codehaus.groovy.runtime.callsite.PogoMetaMethodSite$PogoCachedMethodSiteNoUnwrapNoCoerce.invoke(PogoMetaMethodSite.java:207)
at org.codehaus.groovy.runtime.callsite.PogoMetaMethodSite.callCurrent(PogoMetaMethodSite.java:56)
at org.codehaus.groovy.runtime.callsite.AbstractCallSite.callCurrent(AbstractCallSite.java:163)
at com.jayway.restassured.internal.ResponseSpecificationImpl.statusCode(ResponseSpecificationImpl.groovy:106)
at com.jayway.restassured.specification.ResponseSpecification$statusCode$0.callCurrent(Unknown Source)
at com.jayway.restassured.internal.ResponseSpecificationImpl.statusCode(ResponseSpecificationImpl.groovy:114)
at com.jayway.restassured.internal.ValidatableResponseOptionsImpl.statusCode(ValidatableResponseOptionsImpl.java:114)
at com.intuit.sb.sbg.qboitemservice.tests.service.BundleServiceTest.testCreateBundleItem(BundleServiceTest.java:27)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:497)
at org.testng.internal.MethodInvocationHelper.invokeMethod(MethodInvocationHelper.java:84)
at org.testng.internal.MethodInvocationHelper$1.runTestMethod(MethodInvocationHelper.java:200)
at com.intuit.tools.common.teststatus.DisabledTestHook.runTestMethod(DisabledTestHook.java:182)
at com.intuit.tools.common.teststatus.DisabledTestHook.run(DisabledTestHook.java:198)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:497)
at org.testng.internal.MethodInvocationHelper.invokeHookable(MethodInvocationHelper.java:212)
at org.testng.internal.Invoker.invokeMethod(Invoker.java:707)
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:348)
at org.testng.SuiteRunner.runSequentially(SuiteRunner.java:343)
at org.testng.SuiteRunner.privateRun(SuiteRunner.java:305)
at org.testng.SuiteRunner.run(SuiteRunner.java:254)
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:115)
at org.testng.remote.RemoteTestNG.initAndRun(RemoteTestNG.java:207)
at org.testng.remote.RemoteTestNG.main(RemoteTestNG.java:178)
--
You received this message because you are subscribed to the Google Groups "REST assured" group.
To unsubscribe from this group and stop receiving emails from it, send an email to rest-assured...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
@Test(groups = { "ci" }, enabled = true)
public void testCreateBundleItemBody() {
Map<String, Object> jsonAsMap = new HashMap<>();
RestAssured.defaultParser = Parser.JSON;
jsonAsMap.put("$type", "/items/Bundle");
jsonAsMap.put("id", "djQ6MTIzNDovaXRlbXMvQnVuZGxlOg:-734003741");
jsonAsMap.put("name", "BundleTest");
given().spec(requestSpec).body(jsonAsMap).contentType(ContentType.JSON).when().post().then().assertThat().statusCode(201);
}
Request method: POST
Request path: https://ci-develop.qbo-itemservice-ppd.a.intuit.com/sp-tomcat-samples-hello-world-service/entities
Proxy: <none>
Request params: <none>
Query params: <none>
Form params: <none>
Path params: <none>
Multiparts: <none>
Headers: Accept=*/*
Content-Type=application/json; charset=ISO-8859-1
Cookies: <none>
Body:
{
"name": "BundleTest",
"id": "djQ6MTIzNDovaXRlbXMvQnVuZGxlOg:-734003741",
"$type": "/items/Bundle"
}
HTTP/1.1 400 Bad Request
Server: nginx
Date: Wed, 03 Feb 2016 16:21:53 GMT
Content-Type: application/json
Content-Length: 247
Connection: keep-alive
intuit_tid: 124350cc-8aaf-4de2-b0b0-6d83077dd0f4
Content-Encoding: gzip
{
"$type": "/common/Error",
"type": "input",
"message": "Error decoding JSON input: com.fasterxml.jackson.databind.JsonMappingException: Can not deserialize instance of com.intuit.v4.interaction.Interaction out of START_OBJECT token\n at [Source: java.io.ByteArrayInputStream@5eb09f48; line: 1, column: 1]"
}
FAILED: testCreateBundleItemBody
at com.intuit.sb.sbg.qboitemservice.tests.service.BundleServiceTest.testCreateBundleItemBody(BundleServiceTest.java:36)