use of com.lonepulse.robozombie.model.User in project RoboZombie by sahan.
the class SerializerEndpointTest method testSimpleXmlUnavailable.
/**
* <p>Test for integration with the Simple-XML library when it's not detected on the classpath.</p>
*
* @since 1.3.0
*/
@Test
public final void testSimpleXmlUnavailable() {
Robolectric.getFakeHttpLayer().interceptHttpRequests(false);
String subpath = "/simplexmlunavailable";
stubFor(put(urlEqualTo(subpath)).willReturn(aResponse().withStatus(200)));
expectedException.expect(Is.isA(InvocationException.class));
serializerEndpoint.simpleXmlUnavailable(new User(1, "Emiya", "Kiritsugu", 31, false));
}
use of com.lonepulse.robozombie.model.User in project RoboZombie by sahan.
the class RequestParamEndpointTest method testFormParamsFail.
/**
* <p>Test for a {@link Request} having illegal {@link FormParam}s.</p>
*
* @since 1.3.0
*/
@Test
public final void testFormParamsFail() {
Robolectric.getFakeHttpLayer().interceptHttpRequests(false);
String subpath = "/formparamsfail";
stubFor(post(urlMatching(subpath)).willReturn(aResponse().withStatus(200)));
expectedException.expect(Is.isA(InvocationException.class));
requestEndpoint.formParamsFail(new User(1, "Ra's", "al Ghul", 47, false));
}
use of com.lonepulse.robozombie.model.User in project RoboZombie by sahan.
the class RequestParamEndpointTest method testFormParamsMultivaluedFail.
/**
* <p>Test for a {@link Request} having illegal multivalued query parameters.</p>
*
* @since 1.3.0
*/
@Test
public final void testFormParamsMultivaluedFail() {
Robolectric.getFakeHttpLayer().interceptHttpRequests(false);
String subpath = "/formparamsmultivaluedfail";
Map<String, List<User>> params = new HashMap<String, List<User>>();
List<User> subjects = new ArrayList<User>();
subjects.add(new User(1, "(En) Sabah", "Nur", 5236, true));
subjects.add(new User(2, "Stephen", "Strange", 41, false));
params.put("subjects", subjects);
stubFor(post(urlMatching(subpath)).willReturn(aResponse().withStatus(200)));
expectedException.expect(Is.isA(InvocationException.class));
requestEndpoint.formParamsMultivaluedFail(params);
}
use of com.lonepulse.robozombie.model.User in project RoboZombie by sahan.
the class RequestParamEndpointTest method testQueryParamsMultivaluedFail.
/**
* <p>Test for a {@link Request} having illegal multivalued query parameters.</p>
*
* @since 1.3.0
*/
@Test
public final void testQueryParamsMultivaluedFail() {
Robolectric.getFakeHttpLayer().interceptHttpRequests(false);
String subpath = "/queryparamsmultivaluedfail";
Map<String, List<User>> params = new HashMap<String, List<User>>();
List<User> subjects = new ArrayList<User>();
subjects.add(new User(1, "(En) Sabah", "Nur", 5236, true));
subjects.add(new User(2, "Stephen", "Strange", 41, false));
params.put("subjects", subjects);
stubFor(get(urlMatching(subpath)).willReturn(aResponse().withStatus(200)));
expectedException.expect(Is.isA(InvocationException.class));
requestEndpoint.queryParamsMultivaluedFail(params);
}
use of com.lonepulse.robozombie.model.User in project RoboZombie by sahan.
the class RequestParamEndpointTest method testSerializableEntity.
/**
* <p>Test for a {@link Request} with a {@link Serializable} entity.</p>
*
* @since 1.3.0
*/
@Test
public final void testSerializableEntity() throws ParseException, IOException {
Robolectric.getFakeHttpLayer().interceptHttpRequests(false);
String subpath = "/serializableentity";
User entity = new User(1L, "Eren", "Yeager", 15, false);
SerializableEntity se = new SerializableEntity(entity, true);
stubFor(put(urlEqualTo(subpath)).willReturn(aResponse().withStatus(200)));
requestEndpoint.serializableEntity(entity);
verify(putRequestedFor(urlEqualTo(subpath)).withRequestBody(equalTo(EntityUtils.toString(se))));
}
Aggregations