I am trying to the following for a sample GET Call with URL . i am getting the Error mentioned belwo ., i am trying to resolve but could not .
Any help would be appreciated .
PROGRAM DETAILS & ERROR Details
-----------------------------------------------------------------
package com.sample;
import org.junit.Test;
import static com.jayway.restassured.module.jsv.JsonSchemaValidator.*;
import static com.jayway.restassured.RestAssured.*;
import static com.jayway.restassured.matcher.RestAssuredMatchers.*;
import static org.hamcrest.Matchers.*;
public class SampleTest{
@Test
public void getUserData() {
given().
contentType("application/json").
contentType("X-Killbill-CreatedBy: sdp").
contentType("Authorization: Basic YWRtaW46cGFzc3dvcmQ=").
contentType("X-Killbill-ApiSecret: sharma").
contentType("X-Killbill-ApiKey: suraj").
when().
then().
statusCode(200);
}
}
with pom.xml
<modelVersion>4.0.0</modelVersion>
<groupId>com.sample</groupId>
<artifactId>RestAssured</artifactId>
<packaging>jar</packaging>
<version>1.0.0.SNAPSHOT</version>
<name>RestAssured</name>
<dependencies>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.11</version>
</dependency>
<dependency>
<groupId>com.jayway.restassured</groupId>
<artifactId>rest-assured</artifactId>
<version>2.8.0</version>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-log4j12</artifactId>
<version>1.6.6</version>
</dependency>
<dependency>
<groupId>org.hamcrest</groupId>
<artifactId>hamcrest-all</artifactId>
<version>1.3</version>
</dependency>
<dependency>
<groupId>com.jayway.restassured</groupId>
<artifactId>json-schema-validator</artifactId>
<version>2.1.0</version>
</dependency>
</dependencies>
<build>
<finalName>apitest</finalName>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.0</version>
<configuration>
<source>1.7</source>
<target>1.7</target>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-war-plugin</artifactId>
<version>2.0.2</version>
<configuration>
<archive>
<manifest>
<addDefaultImplementationEntries>true</addDefaultImplementationEntries>
</manifest>
<manifestEntries>
<Implementation-Version>${buildNumber}</Implementation-Version>
</manifestEntries>
</archive>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-report-plugin</artifactId>
<version>2.19.1</version>
</plugin>
</plugins>
</build>
</project>
----------------
mvn clean install -U . Getting the following Error
"<error message="Expected response body to be verified as JSON, HTML or XML but no content-type was defined in the response. Try registering a default parser using: RestAssured.defaultParser(<parser type>); Content was: " type="java.lang.IllegalStateException">java.lang.IllegalStateException: Expected response body to be verified as JSON, HTML or XML but no content-type was defined in the response.
Try registering a default parser using:
RestAssured.defaultParser(<parser type>);
Content was:
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62) ...........
Thanks,
Aha
----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------