#1098 - Institute checks for client-only setups.

Gather client- and server-side settings into one "stack". Move all logic of checking this into the enum itself.
This commit is contained in:
Greg Turnquist
2019-10-21 15:57:39 -05:00
parent f45aabe8ac
commit cf0c606ef4
8 changed files with 213 additions and 110 deletions

View File

@@ -18,13 +18,12 @@ package org.springframework.hateoas.config;
import static org.assertj.core.api.Assertions.*;
import static org.springframework.hateoas.support.ContextTester.*;
import reactor.test.StepVerifier;
import java.net.URI;
import org.junit.jupiter.api.AfterEach;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
import reactor.test.StepVerifier;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.core.ParameterizedTypeReference;
@@ -40,7 +39,7 @@ import org.springframework.hateoas.server.core.TypeReferences.EntityModelType;
import org.springframework.web.reactive.function.client.WebClient;
/**
* Tests registration of proper decoders by the {@link HypermediaWebClientBeanPostProcessor}.
* Tests registration of proper decoders by the {@link org.springframework.hateoas.config.WebClientHateoasConfiguration.HypermediaWebClientBeanPostProcessor}.
*
* @author Greg Turnquist
*/

View File

@@ -17,6 +17,9 @@ package org.springframework.hateoas.config;
import static org.assertj.core.api.Assertions.*;
import java.util.ArrayList;
import java.util.List;
import org.junit.jupiter.api.Test;
import org.springframework.beans.factory.NoSuchBeanDefinitionException;
import org.springframework.context.ConfigurableApplicationContext;
@@ -40,8 +43,11 @@ class WebStackImportSelectorUnitTest {
AnnotationMetadata metadata = AnnotationMetadata.introspect(DefaultHypermedia.class);
assertThat(selector.selectImports(metadata))
.containsExactlyInAnyOrderElementsOf(WebStackImportSelector.CONFIGS.values());
List<String> configs = new ArrayList<>();
configs.addAll(WebStack.WEBMVC.getAvailableConfigurations());
configs.addAll(WebStack.WEBFLUX.getAvailableConfigurations());
assertThat(selector.selectImports(metadata)).containsExactlyInAnyOrderElementsOf(configs);
}
@Test // #973
@@ -49,7 +55,7 @@ class WebStackImportSelectorUnitTest {
AnnotationMetadata metadata = AnnotationMetadata.introspect(WebMvcHypermedia.class);
assertThat(selector.selectImports(metadata)).containsExactly(WebStackImportSelector.CONFIGS.get(WebStack.WEBMVC));
assertThat(selector.selectImports(metadata)).containsExactlyInAnyOrderElementsOf(WebStack.WEBMVC.getAvailableConfigurations());
}
@Test // #973
@@ -57,7 +63,7 @@ class WebStackImportSelectorUnitTest {
AnnotationMetadata metadata = AnnotationMetadata.introspect(WebFluxHypermedia.class);
assertThat(selector.selectImports(metadata)).containsExactly(WebStackImportSelector.CONFIGS.get(WebStack.WEBFLUX));
assertThat(selector.selectImports(metadata)).containsExactlyInAnyOrderElementsOf(WebStack.WEBFLUX.getAvailableConfigurations());
}
@Test // #973