@Test
public void shouldReturnDependencies() throws Exception {

    when(externalDependencies.getDependencies()).thenReturn(asList(
            mongoDependency(singletonList(datasource("foo:42/bar"))).withName("test").build(),
            restServiceDependency("foobar:4711").build()
    ));
    mockMvc.perform(get("/internal/dependencies").accept(APPLICATION_JSON))
            .andExpect(status().is2xxSuccessful())
            .andExpect(
                    jsonPath("@.dependencies").isArray()
            )
            .andExpect(
                    jsonPath("@.dependencies[0].datasources").isArray()
            )
            .andExpect(
                    jsonPath("@.dependencies[0].datasources[0]").value("foo:42/bar")
            )
            .andExpect(
                    jsonPath("@.dependencies[0].url").doesNotExist()
            )
            .andExpect(
                    jsonPath("@.dependencies[0].name").value("test")
            )
            .andExpect(
                    jsonPath("@.dependencies[0].type").value("db")
            )
            .andExpect(
                    jsonPath("@.dependencies[0].subtype").value("MongoDB")
            )
            .andExpect(
                    jsonPath("@.dependencies[1].url").value("foobar:4711")
            )
            .andExpect(
                    jsonPath("@.dependencies[1].type").value("service")
            )
            .andExpect(
                    jsonPath("@.dependencies[1].subtype").value("REST")
            )
            .andExpect(
                    jsonPath("@.dependencies[1].datasources").doesNotExist()
            )
    ;
}