use of org.neo4j.test.server.EntityOutputFormat in project neo4j by neo4j.
the class UserServiceTest method shouldReturn400IfPayloadIsInvalid.
@Test
public void shouldReturn400IfPayloadIsInvalid() throws Exception {
// Given
HttpServletRequest req = mock(HttpServletRequest.class);
when(req.getUserPrincipal()).thenReturn(neo4jPrinciple);
OutputFormat outputFormat = new EntityOutputFormat(new JsonFormat(), new URI("http://www.example.com"), null);
UserService userService = new UserService(mock(BasicAuthManager.class), new JsonFormat(), outputFormat);
// When
Response response = userService.setPassword("neo4j", req, "xxx");
// Then
assertThat(response.getStatus(), equalTo(400));
String json = new String((byte[]) response.getEntity());
assertNotNull(json);
assertThat(json, containsString("\"code\" : \"Neo.ClientError.Request.InvalidFormat\""));
}
use of org.neo4j.test.server.EntityOutputFormat in project neo4j by neo4j.
the class RestfulGraphDatabasePagedTraversalTest method startDatabase.
@Before
public void startDatabase() throws IOException {
graph = (GraphDatabaseFacade) new TestGraphDatabaseFactory().newImpermanentDatabase();
database = new WrappedDatabase(graph);
helper = new GraphDbHelper(database);
output = new EntityOutputFormat(new JsonFormat(), URI.create(BASE_URI), null);
leaseManager = new LeaseManager(Clocks.fakeClock());
service = new RestfulGraphDatabase(new JsonFormat(), output, new DatabaseActions(leaseManager, true, database.getGraph()), null);
service = new TransactionWrappingRestfulGraphDatabase(graph, service);
}
Aggregations