use of com.eclipsesource.restfuse.RequestContext in project restfuse by eclipsesource.
the class RequestConfiguration_Test method testPathWithNonExistingSegments.
@Test(expected = IllegalStateException.class)
public void testPathWithNonExistingSegments() {
Description method = mock(Description.class);
HttpTest annotation = createAnnotation("/people/{invalid}/name");
when(method.getAnnotation(HttpTest.class)).thenReturn(annotation);
RequestConfiguration config = new RequestConfiguration("http://www.fake.com", method, new Object());
RequestContext context = new RequestContext();
context.addPathSegment("id", "12345");
config.createRequest(context);
}
use of com.eclipsesource.restfuse.RequestContext in project restfuse by eclipsesource.
the class DynamicPathTest method getDestination.
private Destination getDestination() {
Destination destination = new Destination(this, "http://search.maven.org/remotecontent?filepath=" + "com/restfuse/com.eclipsesource.restfuse/{version}/");
RequestContext context = destination.getRequestContext();
context.addPathSegment("file", "com.eclipsesource.restfuse-1.1.1").addPathSegment("version", "1.1.1");
return destination;
}
use of com.eclipsesource.restfuse.RequestContext in project restfuse by eclipsesource.
the class RequestConfiguration_Test method testPathWithSegments.
@Test
public void testPathWithSegments() {
Description description = mock(Description.class);
HttpTest annotation = createAnnotation("/people/{id}/{name}");
when(description.getAnnotation(HttpTest.class)).thenReturn(annotation);
RequestConfiguration config = new RequestConfiguration("http://www.fake.com", description, new Object());
RequestContext context = new RequestContext();
context.addPathSegment("id", "12345");
context.addPathSegment("name", "name");
InternalRequest request = config.createRequest(context);
assertEquals("http://www.fake.com/people/12345/name", request.getUrl());
}
Aggregations