org.springframework.hateoas.Links Java Examples

The following examples show how to use org.springframework.hateoas.Links. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: ApplicationInstanceHealthWatcherTests.java    From microservices-dashboard with Apache License 2.0 6 votes vote down vote up
@Test
public void shouldOnlyRetrieveHealthDataForInstancesWithAHealthActuatorEndpoint() {
	ApplicationInstance firstInstance = ApplicationInstanceMother.instance("a-1", "a");
	ApplicationInstance secondInstance = ApplicationInstanceMother.instance("a-2", "a",
			URI.create("http://localhost:8080"),
			new Links(new Link("http://localhost:8080/actuator/health", "health")));
	List<ApplicationInstance> applicationInstances = Arrays.asList(firstInstance, secondInstance);

	when(this.applicationInstanceService.getApplicationInstances()).thenReturn(applicationInstances);
	when(this.responseSpec.bodyToMono(ApplicationInstanceHealthWatcher.HealthWrapper.class))
			.thenReturn(Mono.just(new ApplicationInstanceHealthWatcher.HealthWrapper(Status.UP, new HashMap<>())));

	this.healthWatcher.retrieveHealthDataForAllApplicationInstances();

	assertHealthInfoRetrievalSucceeded(Collections.singletonList(secondInstance));
}
 
Example #2
Source File: ActuatorEndpointsDiscovererServiceTests.java    From microservices-dashboard with Apache License 2.0 6 votes vote down vote up
@Test
public void shouldReturnMonoWithDiscoveredEndpointsWhenWeOnlyHaveTheHalDiscoverer() {
	this.service = new ActuatorEndpointsDiscovererService(this.halActuatorEndpointsDiscoverer,
			Collections.emptyList());

	when(this.halActuatorEndpointsDiscoverer.findActuatorEndpoints(this.applicationInstance))
			.thenReturn(Mono.just(new Links(new Link("http://localhost:8080/actuator/health", "health"))));

	this.service.findActuatorEndpoints(this.applicationInstance)
			.subscribe(actuatorEndpoints -> {
				verify(this.halActuatorEndpointsDiscoverer).findActuatorEndpoints(this.applicationInstance);
				verifyNoMoreInteractions(this.halActuatorEndpointsDiscoverer);

				assertThat(actuatorEndpoints).isNotEmpty();
				assertThat(actuatorEndpoints.hasLink("health")).isTrue();
				assertThat(actuatorEndpoints.getLink("health").getHref()).isEqualTo("http://localhost:8080/actuator/health");
			});
}
 
Example #3
Source File: ActuatorEndpointsDiscovererServiceTests.java    From microservices-dashboard with Apache License 2.0 6 votes vote down vote up
@Test
public void shouldReturnMergedMapOfDiscoveredEndpointsWithHalTakingPrecedence() {
	when(this.otherActuatorEndpointsDiscoverer.findActuatorEndpoints(this.applicationInstance))
			.thenReturn(Mono.just(new Links(new Link("http://localhost:8081/actuator/health", "health"),
					new Link("http://localhost:8081/actuator/info", "info"))));
	when(this.halActuatorEndpointsDiscoverer.findActuatorEndpoints(this.applicationInstance))
			.thenReturn(Mono.just(new Links(new Link("http://localhost:8080/actuator/health", "health"))));

	this.service.findActuatorEndpoints(this.applicationInstance)
			.subscribe(actuatorEndpoints -> {

				verify(this.otherActuatorEndpointsDiscoverer).findActuatorEndpoints(this.applicationInstance);
				verifyNoMoreInteractions(this.otherActuatorEndpointsDiscoverer);

				verify(this.halActuatorEndpointsDiscoverer).findActuatorEndpoints(this.applicationInstance);
				verifyNoMoreInteractions(this.halActuatorEndpointsDiscoverer);

				assertThat(actuatorEndpoints).isNotEmpty();
				assertThat(actuatorEndpoints).hasSize(2);
				assertThat(actuatorEndpoints.hasLink("info")).isTrue();
				assertThat(actuatorEndpoints.getLink("info").getHref()).isEqualTo("http://localhost:8081/actuator/info");
				assertThat(actuatorEndpoints.hasLink("health")).isTrue();
				assertThat(actuatorEndpoints.getLink("health").getHref()).isEqualTo("http://localhost:8080/actuator/health");
			});
}
 
Example #4
Source File: ActuatorEndpointsDiscovererServiceTests.java    From microservices-dashboard with Apache License 2.0 6 votes vote down vote up
@Test
public void shouldReturnAnEmptyMonoWhenSomethingGoesWrong() {
	when(this.otherActuatorEndpointsDiscoverer.findActuatorEndpoints(this.applicationInstance))
			.thenReturn(Mono.just(new Links(new Link("http://localhost:8081/actuator/health", "health"),
					new Link("http://localhost:8081/actuator/info", "info"))));
	when(this.halActuatorEndpointsDiscoverer.findActuatorEndpoints(this.applicationInstance))
			.thenReturn(Mono.error(new RuntimeException("OOPSIE")));

	this.service.findActuatorEndpoints(this.applicationInstance)
			.subscribe(actuatorEndpoints -> {

				verify(this.otherActuatorEndpointsDiscoverer).findActuatorEndpoints(this.applicationInstance);
				verifyNoMoreInteractions(this.otherActuatorEndpointsDiscoverer);

				verify(this.halActuatorEndpointsDiscoverer).findActuatorEndpoints(this.applicationInstance);
				verifyNoMoreInteractions(this.halActuatorEndpointsDiscoverer);

				assertThat(actuatorEndpoints).isEmpty();
			});
}
 
Example #5
Source File: ApplicationInstanceServiceTests.java    From microservices-dashboard with Apache License 2.0 6 votes vote down vote up
@Test
public void shouldUpdateTheActuatorEndpointsOfAnApplicationInstance() {
	when(this.repository.getById("a-1")).thenReturn(ApplicationInstanceMother.instance("a-1", "a"));
	when(this.repository.save(any(ApplicationInstance.class)))
			.thenAnswer((Answer<ApplicationInstance>) invocation -> invocation.getArgument(0));

	Links links = new Links(new Link("http://localhost:8080/actuator/health", "health"));
	UpdateActuatorEndpoints command = new UpdateActuatorEndpoints("a-1", links);
	this.service.updateActuatorEndpoints(command);

	verify(this.repository).save(this.applicationInstanceArgumentCaptor.capture());
	ApplicationInstance applicationInstance = this.applicationInstanceArgumentCaptor.getValue();
	assertThat(applicationInstance.getId()).isEqualTo("a-1");
	assertThat(applicationInstance.getActuatorEndpoints()).hasSize(1);
	assertThat(applicationInstance.getActuatorEndpoint("health")).get().isInstanceOfSatisfying(Link.class,
			link -> assertThat(link.getHref()).isEqualTo("http://localhost:8080/actuator/health"));
}
 
Example #6
Source File: ApplicationInstanceUpdaterTests.java    From microservices-dashboard with Apache License 2.0 6 votes vote down vote up
@Test
public void shouldUpdateActuatorEndpointsAfterDiscovery() {
	Links links = new Links();
	when(this.actuatorEndpointsDiscovererService.findActuatorEndpoints(any(ApplicationInstance.class)))
			.thenReturn(Mono.just(links));
	ApplicationInstanceCreated event =
			ApplicationInstanceEventMother.applicationInstanceCreated("a-1", "a");
	this.applicationInstanceUpdater.discoverActuatorEndpoints(event);
	ArgumentCaptor<ApplicationInstance> applicationInstanceArgumentCaptor =
			ArgumentCaptor.forClass(ApplicationInstance.class);
	verify(this.actuatorEndpointsDiscovererService).findActuatorEndpoints(
			applicationInstanceArgumentCaptor.capture());
	ApplicationInstance applicationInstance = applicationInstanceArgumentCaptor.getValue();
	assertThat(applicationInstance.getId()).isEqualTo("a-1");
	verifyNoMoreInteractions(this.actuatorEndpointsDiscovererService);
	ArgumentCaptor<UpdateActuatorEndpoints> commandCaptor = ArgumentCaptor.forClass(UpdateActuatorEndpoints.class);
	verify(this.applicationInstanceService).updateActuatorEndpoints(commandCaptor.capture());
	UpdateActuatorEndpoints command = commandCaptor.getValue();
	assertThat(command.getId()).isEqualTo("a-1");
	assertThat(command.getActuatorEndpoints()).isEqualTo(links);
	verifyNoMoreInteractions(this.applicationInstanceService);
}
 
Example #7
Source File: DefaultTypeResolver.java    From bowman with Apache License 2.0 6 votes vote down vote up
@Override
public <T> Class<? extends T> resolveType(Class<T> declaredType, Links resourceLinks, Configuration configuration) {
	
	ResourceTypeInfo info = AnnotationUtils.findAnnotation(declaredType, ResourceTypeInfo.class);
	
	if (info == null) {
		return declaredType;
	}
	
	boolean customTypeResolverIsSpecified = info.typeResolver() != ResourceTypeInfo.NullTypeResolver.class;
	
	if (!(info.subtypes().length > 0 ^ customTypeResolverIsSpecified)) {
		throw new ClientProxyException("one of subtypes or typeResolver must be specified");
	}
	
	TypeResolver delegateTypeResolver = customTypeResolverIsSpecified
		? BeanUtils.instantiateClass(info.typeResolver())
		: new SelfLinkTypeResolver(info.subtypes());
	
	return delegateTypeResolver.resolveType(declaredType, resourceLinks, configuration);
}
 
Example #8
Source File: ApplicationInstanceHealthWatcherTests.java    From microservices-dashboard with Apache License 2.0 6 votes vote down vote up
@Test
public void shouldOnlyRetrieveHealthDataForInstancesThatAreNotDeleted() {
	ApplicationInstance firstInstance = ApplicationInstanceMother.instance("a-1", "a");
	firstInstance.delete();
	ApplicationInstance secondInstance = ApplicationInstanceMother.instance("a-2", "a",
			URI.create("http://localhost:8080"),
			new Links(new Link("http://localhost:8080/actuator/health", "health")));
	List<ApplicationInstance> applicationInstances = Arrays.asList(firstInstance, secondInstance);

	when(this.applicationInstanceService.getApplicationInstances()).thenReturn(applicationInstances);
	when(this.responseSpec.bodyToMono(ApplicationInstanceHealthWatcher.HealthWrapper.class))
			.thenReturn(Mono.just(new ApplicationInstanceHealthWatcher.HealthWrapper(Status.UP, new HashMap<>())));

	this.healthWatcher.retrieveHealthDataForAllApplicationInstances();

	assertHealthInfoRetrievalSucceeded(Collections.singletonList(secondInstance));
}
 
Example #9
Source File: HalActuatorEndpointsDiscoverer.java    From microservices-dashboard with Apache License 2.0 5 votes vote down vote up
private Links discoverLinks(ResponseEntity<String> response) {
	Links links = new Links();
	if (!response.getStatusCode().isError()
			&& response.hasBody()
			&& !StringUtils.isEmpty(response.getBody())) {
		MediaType mediaType = Optional.ofNullable(response.getHeaders().getContentType())
				.orElse(MediaTypes.HAL_JSON_UTF8);
		links = createLinksFrom(response.getBody(), mediaType);
	}
	return links;
}
 
Example #10
Source File: HalActuatorEndpointsDiscoverer.java    From microservices-dashboard with Apache License 2.0 5 votes vote down vote up
@Override
public Mono<Links> findActuatorEndpoints(ApplicationInstance applicationInstance) {
	URI actuatorBaseUri = applicationInstance.getBaseUri().resolve("/actuator");
	return this.webClient.get().uri(actuatorBaseUri)
			.exchange()
			.flatMap(c -> c.toEntity(String.class))
			.map(this::discoverLinks)
			.onErrorResume(ex -> {
				logger.error("Could not discover the actuator endpoints, skipping the HAL discoverer", ex);
				return Mono.just(new Links());
			});
}
 
Example #11
Source File: HalActuatorEndpointsDiscoverer.java    From microservices-dashboard with Apache License 2.0 5 votes vote down vote up
private Links createLinksFrom(String body, MediaType mediaType) {
	Links links = new Links();
	try {
		Object parseResult = JsonPath.read(body, LINK_PATH);

		if (parseResult instanceof Map) {
			Set<String> rels = ((Map<String, Object>) parseResult).keySet();
			links = extractActuatorEndpoints(body, mediaType, rels);
		}
	}
	catch (PathNotFoundException pnfe) {
		logger.debug("{} not found in response", LINK_PATH, pnfe);
	}
	return links;
}
 
Example #12
Source File: HalActuatorEndpointsDiscoverer.java    From microservices-dashboard with Apache License 2.0 5 votes vote down vote up
private Links extractActuatorEndpoints(String body, MediaType mediaType, Set<String> rels) {
	return rels.parallelStream()
			.map(rel ->
					this.linkDiscoverers.getLinkDiscovererFor(mediaType)
							.findLinkWithRel(rel, body)
			)
			.collect(Collectors.collectingAndThen(Collectors.toList(), Links::new));
}
 
Example #13
Source File: EmployeeController.java    From spring-hateoas-examples with Apache License 2.0 5 votes vote down vote up
/**
 * Find an {@link Employee}'s {@link Manager} based upon employee id. Turn it into a context-based link.
 *
 * @param id
 * @return
 */
@GetMapping("/managers/{id}/employees")
public ResponseEntity<CollectionModel<EntityModel<Employee>>> findEmployees(@PathVariable long id) {

	CollectionModel<EntityModel<Employee>> collectionModel = assembler
			.toCollectionModel(repository.findByManagerId(id));

	Links newLinks = collectionModel.getLinks().merge(Links.MergeMode.REPLACE_BY_REL,
			linkTo(methodOn(EmployeeController.class).findEmployees(id)).withSelfRel());

	return ResponseEntity.ok(new CollectionModel<>(collectionModel.getContent(), newLinks));
}
 
Example #14
Source File: ApplicationInstanceTests.java    From microservices-dashboard with Apache License 2.0 5 votes vote down vote up
@Test
public void newlyCreatedInstanceWithActuatorEndpointsShouldReturnListWithEndpoints() {
	ApplicationInstance applicationInstance = ApplicationInstanceMother.instance("a-1", "a",
			URI.create("http://localhost:8080"),
			new Links(new Link("http://localhost:8080/actuator/health", "health")));

	assertThat(applicationInstance.getActuatorEndpoints()).hasSize(1);
}
 
Example #15
Source File: ApplicationInstanceTests.java    From microservices-dashboard with Apache License 2.0 5 votes vote down vote up
@Test
public void undefinedActuatorEndpointWillReturnEmptyOptional() {
	ApplicationInstance applicationInstance = ApplicationInstanceMother.instance("a-1", "a",
			URI.create("http://localhost:8080"),
			new Links(new Link("http://localhost:8080/actuator/health", "health")));

	assertThat(applicationInstance.hasActuatorEndpointFor("not-defined-endpoint")).isFalse();
	assertThat(applicationInstance.getActuatorEndpoint("not-defined-endpoint")).isEmpty();
}
 
Example #16
Source File: ActuatorEndpointsDiscovererService.java    From microservices-dashboard with Apache License 2.0 5 votes vote down vote up
private BiFunction<Links, Links, Links> reduceActuatorEndpoints() {
	return (links, links2) -> {
		List<Link> newLinks = new ArrayList<>();
		links2.forEach(newLinks::add);
		links.forEach(link -> {
			if (!links2.hasLink(link.getRel())) {
				newLinks.add(link);
			}
		});
		return new Links(newLinks);
	};
}
 
Example #17
Source File: ApplicationInstanceTests.java    From microservices-dashboard with Apache License 2.0 5 votes vote down vote up
@Test
public void definedActuatorEndpointWillReturnLink() {
	ApplicationInstance applicationInstance = ApplicationInstanceMother.instance("a-1", "a",
			URI.create("http://localhost:8080"),
			new Links(new Link("http://localhost:8080/actuator/health", "health")));

	assertThat(applicationInstance.hasActuatorEndpointFor("health")).isTrue();
	assertThat(applicationInstance.getActuatorEndpoint("health")).isNotEmpty();
	assertThat(applicationInstance.getActuatorEndpoint("health"))
			.get().extracting(Link::getHref).isEqualTo("http://localhost:8080/actuator/health");
}
 
Example #18
Source File: ApplicationInstanceTests.java    From microservices-dashboard with Apache License 2.0 5 votes vote down vote up
@Test
public void sameActuatorEndpointsWillNotBeMarkedAsChanged() {
	Links newLinks = new Links(new Link("http://localhost:8080/actuator/health", "health"));
	ApplicationInstance applicationInstance = ApplicationInstanceMother.instance("a-1", "a",
			URI.create("http://localhost:8080"),
			new Links(new Link("http://localhost:8080/actuator/health", "health")));
	applicationInstance.markChangesAsCommitted();

	applicationInstance.updateActuatorEndpoints(newLinks);

	assertThat(applicationInstance.getUncommittedChanges()).isEmpty();
}
 
Example #19
Source File: ActuatorEndpointsDiscovererServiceTests.java    From microservices-dashboard with Apache License 2.0 5 votes vote down vote up
@Before
public void setup() {
	this.applicationInstance = ApplicationInstanceMother.instance("a-1", "a");
	this.service = new ActuatorEndpointsDiscovererService(this.halActuatorEndpointsDiscoverer,
			Collections.singletonList(this.otherActuatorEndpointsDiscoverer));
	when(this.halActuatorEndpointsDiscoverer.findActuatorEndpoints(this.applicationInstance))
			.thenReturn(Mono.just(new Links()));
	when(this.otherActuatorEndpointsDiscoverer.findActuatorEndpoints(this.applicationInstance))
			.thenReturn(Mono.just(new Links()));
}
 
Example #20
Source File: ActuatorEndpointsDiscovererServiceTests.java    From microservices-dashboard with Apache License 2.0 5 votes vote down vote up
@Test
public void shouldReturnMapOfDiscoveredEndpointsByHalDiscoverer() {
	when(this.halActuatorEndpointsDiscoverer.findActuatorEndpoints(this.applicationInstance))
			.thenReturn(Mono.just(new Links(new Link("http://localhost:8080/actuator/health", "health"))));

	this.service.findActuatorEndpoints(this.applicationInstance)
			.subscribe(actuatorEndpoints -> {
				verify(this.halActuatorEndpointsDiscoverer).findActuatorEndpoints(this.applicationInstance);
				verifyNoMoreInteractions(this.halActuatorEndpointsDiscoverer);

				assertThat(actuatorEndpoints).isNotEmpty();
				assertThat(actuatorEndpoints.hasLink("health")).isTrue();
				assertThat(actuatorEndpoints.getLink("health").getHref()).isEqualTo("http://localhost:8080/actuator/health");
			});
}
 
Example #21
Source File: ActuatorEndpointsDiscovererServiceTests.java    From microservices-dashboard with Apache License 2.0 5 votes vote down vote up
@Test
public void shouldReturnMapOfDiscoveredEndpointsByAnotherDiscovererThanDefault() {
	when(this.otherActuatorEndpointsDiscoverer.findActuatorEndpoints(this.applicationInstance))
			.thenReturn(Mono.just(new Links(new Link("http://localhost:8081/actuator/health", "health"))));

	this.service.findActuatorEndpoints(this.applicationInstance)
			.subscribe(actuatorEndpoints -> {
				verify(this.halActuatorEndpointsDiscoverer).findActuatorEndpoints(this.applicationInstance);
				verifyNoMoreInteractions(this.halActuatorEndpointsDiscoverer);

				assertThat(actuatorEndpoints).isNotEmpty();
				assertThat(actuatorEndpoints.hasLink("health")).isTrue();
				assertThat(actuatorEndpoints.getLink("health").getHref()).isEqualTo("http://localhost:8081/actuator/health");
			});
}
 
Example #22
Source File: ApplicationInstanceMother.java    From microservices-dashboard with Apache License 2.0 5 votes vote down vote up
public static ApplicationInstance instance(String id, String application, URI baseUri, Links actuatorEndpoints) {
	ApplicationInstance applicationInstance = ApplicationInstance.Builder.forApplicationWithId(application, id)
			.baseUri(baseUri)
			.build();
	applicationInstance.updateActuatorEndpoints(actuatorEndpoints);
	return applicationInstance;
}
 
Example #23
Source File: ApplicationInstanceEventMother.java    From microservices-dashboard with Apache License 2.0 5 votes vote down vote up
public static ActuatorEndpointsUpdated actuatorEndpointsUpdated(String id, String application, Links actuatorEndpoints) {
	ApplicationInstance applicationInstance = ApplicationInstance.Builder
			.forApplicationWithId(application, id)
			.baseUri(URI.create("http://localhost:8080"))
			.build().markChangesAsCommitted();
	applicationInstance.updateActuatorEndpoints(actuatorEndpoints);
	return (ActuatorEndpointsUpdated) applicationInstance
			.getUncommittedChanges().get(0);
}
 
Example #24
Source File: ApplicationInstanceHealthWatcherTests.java    From microservices-dashboard with Apache License 2.0 5 votes vote down vote up
@Test
public void shouldNotRetrieveTheHealthDataAfterActuatorEndpointsHaveBeenUpdatedWithoutHealthLink() {
	ActuatorEndpointsUpdated event =
			ApplicationInstanceEventMother.actuatorEndpointsUpdated("a-1", "a",
					new Links(new Link("http://localhost:8080/actuator/info", "info")));

	this.healthWatcher.retrieveHealthData(event);

	verifyZeroInteractions(this.webClient);
	verifyZeroInteractions(this.requestHeadersUriSpec);
	verifyZeroInteractions(this.requestHeadersSpec);
	verifyZeroInteractions(this.responseSpec);
	verifyZeroInteractions(this.applicationInstanceService);
}
 
Example #25
Source File: ApplicationInstanceHealthWatcherTests.java    From microservices-dashboard with Apache License 2.0 5 votes vote down vote up
@Test
public void shouldRetrieveTheHealthDataAfterActuatorEndpointsHaveBeenUpdatedWithHealthLink() {
	ActuatorEndpointsUpdated event =
			ApplicationInstanceEventMother.actuatorEndpointsUpdated("a-1", "a",
					new Links(new Link("http://localhost:8080/actuator/health", "health")));

	when(this.responseSpec.bodyToMono(ApplicationInstanceHealthWatcher.HealthWrapper.class)).thenReturn(Mono
			.just(new ApplicationInstanceHealthWatcher.HealthWrapper(Status.UP, null)));

	this.healthWatcher.retrieveHealthData(event);

	assertHealthInfoRetrievalSucceeded((ApplicationInstance) event.getSource());
}
 
Example #26
Source File: ApplicationInstanceHealthWatcherTests.java    From microservices-dashboard with Apache License 2.0 5 votes vote down vote up
@Test
public void shouldHandleApplicationInstanceEventHandlesError() {
	URI healthActuatorEndpoint = URI.create("http://localhost:8080/actuator/health");
	ActuatorEndpointsUpdated event =
			ApplicationInstanceEventMother.actuatorEndpointsUpdated("a-1", "a",
			new Links(new Link(healthActuatorEndpoint.toString(), "health")));

	when(this.responseSpec.bodyToMono(ApplicationInstanceHealthWatcher.HealthWrapper.class))
			.thenReturn(Mono.error(new RuntimeException("OOPSIE!")));

	this.healthWatcher.retrieveHealthData(event);

	assertHealthInfoRetrievalFailed((ApplicationInstance) event.getSource(), healthActuatorEndpoint);
}
 
Example #27
Source File: ResourceIdMethodHandlerTest.java    From bowman with Apache License 2.0 5 votes vote down vote up
@Test
public void invokeWithResourceWithNoSelfLinkReturnsNull() {
	EntityModel<Object> resource = new EntityModel<>(new Object(), Links.of(new Link("http://www.example.com/1",
		"some-other-rel")));
	
	Object result = new ResourceIdMethodHandler(resource).invoke(null, null, null, null);
	
	assertThat(result, is(nullValue()));
}
 
Example #28
Source File: DefaultTypeResolverTest.java    From bowman with Apache License 2.0 5 votes vote down vote up
@Test
public void resolveTypeWithUnderspecifiedResourceTypeInfoThrowsException() {
	thrown.expect(ClientProxyException.class);
	thrown.expectMessage("one of subtypes or typeResolver must be specified");

	resolver.resolveType(TypeWithUnderspecifiedInfo.class, Links.of(), Configuration.build());
}
 
Example #29
Source File: DefaultTypeResolverTest.java    From bowman with Apache License 2.0 5 votes vote down vote up
@Test
public void resolveTypeWithOverspecifiedResourceTypeInfoThrowsException() {
	thrown.expect(ClientProxyException.class);
	thrown.expectMessage("one of subtypes or typeResolver must be specified");
	
	resolver.resolveType(TypeWithOverspecifiedInfo.class, Links.of(), Configuration.build());
}
 
Example #30
Source File: DefaultTypeResolverTest.java    From bowman with Apache License 2.0 5 votes vote down vote up
@Test
public void resolveTypeWithNoResourceTypeInfoReturnsDeclaredType() {
	Class<?> type = resolver.resolveType(TypeWithoutInfo.class,
		Links.of(new Link("http://x", IanaLinkRelations.SELF)), Configuration.build());
	
	assertThat(type, Matchers.<Class<?>>equalTo(TypeWithoutInfo.class));
}