#980 - Reduce test visibility.
This commit is contained in:
2
pom.xml
2
pom.xml
@@ -752,7 +752,7 @@
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-surefire-plugin</artifactId>
|
||||
<version>2.19.1</version>
|
||||
<version>3.0.0-M3</version>
|
||||
<configuration>
|
||||
<useSystemClassLoader>false</useSystemClassLoader>
|
||||
</configuration>
|
||||
|
||||
@@ -34,7 +34,7 @@ public abstract class AbstractJackson2MarshallingIntegrationTest {
|
||||
protected ObjectMapper mapper;
|
||||
|
||||
@BeforeEach
|
||||
public void setUp() {
|
||||
void setUp() {
|
||||
mapper = new ObjectMapper();
|
||||
}
|
||||
|
||||
|
||||
@@ -29,14 +29,14 @@ import com.tngtech.archunit.library.dependencies.SlicesRuleDefinition;
|
||||
*
|
||||
* @author Oliver Gierke
|
||||
*/
|
||||
public class ArchitectureTest {
|
||||
class ArchitectureTest {
|
||||
|
||||
ImportOptions options = new ImportOptions().with(ImportOption.Predefined.DONT_INCLUDE_TESTS);
|
||||
JavaClasses classes = new ClassFileImporter(options) //
|
||||
.importPackages("org.springframework.hateoas");
|
||||
|
||||
@Test
|
||||
public void assertNoCyclicPackageDependencies() {
|
||||
void assertNoCyclicPackageDependencies() {
|
||||
|
||||
SliceRule rule = SlicesRuleDefinition.slices() //
|
||||
.matching("org.springframework.hateoas.(**)..") //
|
||||
|
||||
@@ -27,20 +27,20 @@ import org.junit.jupiter.api.Test;
|
||||
*
|
||||
* @author Oliver Gierke
|
||||
*/
|
||||
public class CollectionModelUnitTest {
|
||||
class CollectionModelUnitTest {
|
||||
|
||||
Set<EntityModel<String>> foo = Collections.singleton(new EntityModel<>("foo"));
|
||||
Set<EntityModel<String>> bar = Collections.singleton(new EntityModel<>("bar"));
|
||||
|
||||
@Test
|
||||
public void equalsForSelfReference() {
|
||||
void equalsForSelfReference() {
|
||||
|
||||
CollectionModel<EntityModel<String>> resource = new CollectionModel<>(foo);
|
||||
assertThat(resource).isEqualTo(resource);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void equalsWithEqualContent() {
|
||||
void equalsWithEqualContent() {
|
||||
|
||||
CollectionModel<EntityModel<String>> left = new CollectionModel<>(foo);
|
||||
CollectionModel<EntityModel<String>> right = new CollectionModel<>(foo);
|
||||
@@ -50,7 +50,7 @@ public class CollectionModelUnitTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void notEqualForDifferentContent() {
|
||||
void notEqualForDifferentContent() {
|
||||
|
||||
CollectionModel<EntityModel<String>> left = new CollectionModel<>(foo);
|
||||
CollectionModel<EntityModel<String>> right = new CollectionModel<>(bar);
|
||||
@@ -60,7 +60,7 @@ public class CollectionModelUnitTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void notEqualForDifferentLinks() {
|
||||
void notEqualForDifferentLinks() {
|
||||
|
||||
CollectionModel<EntityModel<String>> left = new CollectionModel<>(foo);
|
||||
CollectionModel<EntityModel<String>> right = new CollectionModel<>(bar);
|
||||
|
||||
@@ -28,12 +28,12 @@ import com.fasterxml.jackson.annotation.JsonAutoDetect.Visibility;
|
||||
* @author Oliver Gierke
|
||||
* @author Greg Turnquist
|
||||
*/
|
||||
public class EntityModelIntegrationTest extends AbstractJackson2MarshallingIntegrationTest {
|
||||
class EntityModelIntegrationTest extends AbstractJackson2MarshallingIntegrationTest {
|
||||
|
||||
static final String REFERENCE = "{\"firstname\":\"Dave\",\"lastname\":\"Matthews\",\"links\":[{\"rel\":\"self\",\"href\":\"localhost\"}]}";
|
||||
|
||||
@Test
|
||||
public void inlinesContent() throws Exception {
|
||||
void inlinesContent() throws Exception {
|
||||
|
||||
Person person = new Person();
|
||||
person.firstname = "Dave";
|
||||
@@ -49,7 +49,7 @@ public class EntityModelIntegrationTest extends AbstractJackson2MarshallingInteg
|
||||
* @see #14
|
||||
*/
|
||||
@Test
|
||||
public void readsResourceSupportCorrectly() throws Exception {
|
||||
void readsResourceSupportCorrectly() throws Exception {
|
||||
|
||||
PersonModel result = read(REFERENCE, PersonModel.class);
|
||||
|
||||
|
||||
@@ -26,17 +26,17 @@ import org.junit.jupiter.api.Test;
|
||||
*
|
||||
* @author Oliver Gierke
|
||||
*/
|
||||
public class EntityModelUnitTest {
|
||||
class EntityModelUnitTest {
|
||||
|
||||
@Test
|
||||
public void equalsForSelfReference() {
|
||||
void equalsForSelfReference() {
|
||||
|
||||
EntityModel<String> resource = new EntityModel<>("foo");
|
||||
assertThat(resource).isEqualTo(resource);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void equalsWithEqualContent() {
|
||||
void equalsWithEqualContent() {
|
||||
|
||||
EntityModel<String> left = new EntityModel<>("foo");
|
||||
EntityModel<String> right = new EntityModel<>("foo");
|
||||
@@ -46,7 +46,7 @@ public class EntityModelUnitTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void notEqualForDifferentContent() {
|
||||
void notEqualForDifferentContent() {
|
||||
|
||||
EntityModel<String> left = new EntityModel<>("foo");
|
||||
EntityModel<String> right = new EntityModel<>("bar");
|
||||
@@ -56,7 +56,7 @@ public class EntityModelUnitTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void notEqualForDifferentLinks() {
|
||||
void notEqualForDifferentLinks() {
|
||||
|
||||
EntityModel<String> left = new EntityModel<>("foo");
|
||||
EntityModel<String> right = new EntityModel<>("foo");
|
||||
@@ -67,7 +67,7 @@ public class EntityModelUnitTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void rejectsCollectionContent() {
|
||||
void rejectsCollectionContent() {
|
||||
|
||||
assertThatIllegalArgumentException().isThrownBy(() -> {
|
||||
new EntityModel<Object>(Collections.emptyList());
|
||||
|
||||
@@ -24,13 +24,13 @@ import org.junit.jupiter.api.Test;
|
||||
/**
|
||||
* @author Greg Turnquist
|
||||
*/
|
||||
public class IanaLinkRelationUnitTest {
|
||||
class IanaLinkRelationUnitTest {
|
||||
|
||||
/**
|
||||
* @see #778
|
||||
*/
|
||||
@Test
|
||||
public void extractingValueOfIanaLinkRelationShouldWork() {
|
||||
void extractingValueOfIanaLinkRelationShouldWork() {
|
||||
assertThat(IanaLinkRelations.ABOUT.value()).isEqualTo("about");
|
||||
}
|
||||
|
||||
@@ -38,7 +38,7 @@ public class IanaLinkRelationUnitTest {
|
||||
* @see #778
|
||||
*/
|
||||
@Test
|
||||
public void testingForOfficialIanaLinkRelation() {
|
||||
void testingForOfficialIanaLinkRelation() {
|
||||
|
||||
assertThatIllegalArgumentException().isThrownBy(() -> IanaLinkRelations.isIanaRel((String) null));
|
||||
assertThatIllegalArgumentException().isThrownBy(() -> IanaLinkRelations.isIanaRel((LinkRelation) null));
|
||||
@@ -53,7 +53,7 @@ public class IanaLinkRelationUnitTest {
|
||||
* @see #778
|
||||
*/
|
||||
@Test
|
||||
public void parsingIanaLinkRelationsShouldWork() {
|
||||
void parsingIanaLinkRelationsShouldWork() {
|
||||
|
||||
assertThat(IanaLinkRelations.parse("about")).isEqualTo(IanaLinkRelations.ABOUT);
|
||||
assertThat(IanaLinkRelations.parse("ABOUT")).isEqualTo(IanaLinkRelations.ABOUT);
|
||||
@@ -65,12 +65,12 @@ public class IanaLinkRelationUnitTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testIanaLinkRelationShouldPass() {
|
||||
void testIanaLinkRelationShouldPass() {
|
||||
assertThat(IanaLinkRelations.isIanaRel(IanaLinkRelations.ABOUT)).isTrue();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void comparingNonIanaLinkRelationsToIanaLinkRelationsDontGuaranteeAMatch() {
|
||||
void comparingNonIanaLinkRelationsToIanaLinkRelationsDontGuaranteeAMatch() {
|
||||
|
||||
assertThat(IanaLinkRelations.isIanaRel(new CustomLinkRelation("about"))).isTrue();
|
||||
assertThat(IanaLinkRelations.isIanaRel(new CustomLinkRelation("ABOUT"))).isTrue();
|
||||
|
||||
@@ -25,7 +25,7 @@ import org.junit.jupiter.api.Test;
|
||||
* @author Oliver Gierke
|
||||
* @author Jon Brisbin
|
||||
*/
|
||||
public class Jackson2LinkIntegrationTest extends AbstractJackson2MarshallingIntegrationTest {
|
||||
class Jackson2LinkIntegrationTest extends AbstractJackson2MarshallingIntegrationTest {
|
||||
|
||||
private static final String REFERENCE = "{\"rel\":\"something\",\"href\":\"location\"}";
|
||||
|
||||
@@ -33,7 +33,7 @@ public class Jackson2LinkIntegrationTest extends AbstractJackson2MarshallingInte
|
||||
* @see #27
|
||||
*/
|
||||
@Test
|
||||
public void writesLinkCorrectly() throws Exception {
|
||||
void writesLinkCorrectly() throws Exception {
|
||||
assertThat(write(new Link("location", "something"))).isEqualTo(REFERENCE);
|
||||
}
|
||||
|
||||
@@ -41,7 +41,7 @@ public class Jackson2LinkIntegrationTest extends AbstractJackson2MarshallingInte
|
||||
* @see #27
|
||||
*/
|
||||
@Test
|
||||
public void readsLinkCorrectly() throws Exception {
|
||||
void readsLinkCorrectly() throws Exception {
|
||||
Link result = read(REFERENCE, Link.class);
|
||||
assertThat(result.getHref()).isEqualTo("location");
|
||||
assertThat(result.getRel()).isEqualTo(LinkRelation.of("something"));
|
||||
|
||||
@@ -38,7 +38,7 @@ import org.springframework.util.ReflectionUtils;
|
||||
*
|
||||
* @author Oliver Gierke
|
||||
*/
|
||||
public class Jackson2PagedResourcesIntegrationTest {
|
||||
class Jackson2PagedResourcesIntegrationTest {
|
||||
|
||||
private static String REFERENCE = "{\"links\":[],\"content\":[{\"firstname\":\"Dave\",\"lastname\":\"Matthews\"}],\"page\":{\"size\":1,\"totalElements\":2,\"totalPages\":2,\"number\":0}}";
|
||||
|
||||
@@ -56,7 +56,7 @@ public class Jackson2PagedResourcesIntegrationTest {
|
||||
* @see SPR-13318
|
||||
*/
|
||||
@Test
|
||||
public void serializesPagedResourcesCorrectly() throws Exception {
|
||||
void serializesPagedResourcesCorrectly() throws Exception {
|
||||
|
||||
assumeThat(SPRING_4_2_WRITE_METHOD).isNotNull();
|
||||
|
||||
|
||||
@@ -12,7 +12,7 @@ import com.fasterxml.jackson.annotation.JsonAutoDetect;
|
||||
* @author Oliver Gierke
|
||||
* @author Jon Brisbin
|
||||
*/
|
||||
public class Jackson2ResourceIntegrationTest extends AbstractJackson2MarshallingIntegrationTest {
|
||||
class Jackson2ResourceIntegrationTest extends AbstractJackson2MarshallingIntegrationTest {
|
||||
|
||||
static final String REFERENCE = "{\"firstname\":\"Dave\",\"lastname\":\"Matthews\",\"links\":[{\"rel\":\"self\",\"href\":\"localhost\"}]}";
|
||||
|
||||
@@ -21,7 +21,7 @@ public class Jackson2ResourceIntegrationTest extends AbstractJackson2Marshalling
|
||||
* @throws Exception
|
||||
*/
|
||||
@Test
|
||||
public void inlinesContent() throws Exception {
|
||||
void inlinesContent() throws Exception {
|
||||
|
||||
Person person = new Person();
|
||||
person.firstname = "Dave";
|
||||
@@ -37,7 +37,7 @@ public class Jackson2ResourceIntegrationTest extends AbstractJackson2Marshalling
|
||||
* @see #27
|
||||
*/
|
||||
@Test
|
||||
public void readsResourceSupportCorrectly() throws Exception {
|
||||
void readsResourceSupportCorrectly() throws Exception {
|
||||
|
||||
PersonResource result = read(REFERENCE, PersonResource.class);
|
||||
|
||||
|
||||
@@ -24,7 +24,7 @@ import org.junit.jupiter.api.Test;
|
||||
*
|
||||
* @author Oliver Gierke
|
||||
*/
|
||||
public class Jackson2ResourceSupportIntegrationTest extends AbstractJackson2MarshallingIntegrationTest {
|
||||
class Jackson2ResourceSupportIntegrationTest extends AbstractJackson2MarshallingIntegrationTest {
|
||||
|
||||
static final String REFERENCE = "{\"links\":[{\"rel\":\"self\",\"href\":\"localhost\"}]}";
|
||||
|
||||
@@ -32,7 +32,7 @@ public class Jackson2ResourceSupportIntegrationTest extends AbstractJackson2Mars
|
||||
* @see #27
|
||||
*/
|
||||
@Test
|
||||
public void doesNotRenderId() throws Exception {
|
||||
void doesNotRenderId() throws Exception {
|
||||
|
||||
RepresentationModel<?> resourceSupport = new RepresentationModel<>();
|
||||
resourceSupport.add(new Link("localhost"));
|
||||
@@ -44,7 +44,7 @@ public class Jackson2ResourceSupportIntegrationTest extends AbstractJackson2Mars
|
||||
* @see #27
|
||||
*/
|
||||
@Test
|
||||
public void readResourceSupportCorrectly() throws Exception {
|
||||
void readResourceSupportCorrectly() throws Exception {
|
||||
|
||||
RepresentationModel<?> result = read(REFERENCE, RepresentationModel.class);
|
||||
|
||||
|
||||
@@ -24,7 +24,7 @@ import org.junit.jupiter.api.Test;
|
||||
*
|
||||
* @author Oliver Gierke
|
||||
*/
|
||||
public class LinkIntegrationTest extends AbstractJackson2MarshallingIntegrationTest {
|
||||
class LinkIntegrationTest extends AbstractJackson2MarshallingIntegrationTest {
|
||||
|
||||
private static final String REFERENCE = "{\"rel\":\"something\",\"href\":\"location\"}";
|
||||
|
||||
@@ -32,7 +32,7 @@ public class LinkIntegrationTest extends AbstractJackson2MarshallingIntegrationT
|
||||
* @see #14
|
||||
*/
|
||||
@Test
|
||||
public void writesLinkCorrectly() throws Exception {
|
||||
void writesLinkCorrectly() throws Exception {
|
||||
assertThat(write(new Link("location", "something"))).isEqualTo(REFERENCE);
|
||||
}
|
||||
|
||||
@@ -40,7 +40,7 @@ public class LinkIntegrationTest extends AbstractJackson2MarshallingIntegrationT
|
||||
* @see #14
|
||||
*/
|
||||
@Test
|
||||
public void readsLinkCorrectly() throws Exception {
|
||||
void readsLinkCorrectly() throws Exception {
|
||||
|
||||
Link result = read(REFERENCE, Link.class);
|
||||
assertThat(result.getHref()).isEqualTo("location");
|
||||
|
||||
@@ -28,17 +28,17 @@ import org.junit.jupiter.api.Test;
|
||||
/**
|
||||
* @author Greg Turnquist
|
||||
*/
|
||||
public class LinkRelationUnitTest {
|
||||
class LinkRelationUnitTest {
|
||||
|
||||
@Test
|
||||
public void customLinkRelationShouldWork() {
|
||||
void customLinkRelationShouldWork() {
|
||||
|
||||
LinkRelation linkRelation = new CustomLinkRelation("customer");
|
||||
assertThat(linkRelation.value()).isEqualTo("customer");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void customEnumBasedLinkRelationShouldWork() {
|
||||
void customEnumBasedLinkRelationShouldWork() {
|
||||
|
||||
assertThat(MyOwnLinkRelation.FOO.value()).isEqualTo("foo");
|
||||
assertThat(MyOwnLinkRelation.BAR.value()).isEqualTo("bar");
|
||||
@@ -49,7 +49,7 @@ public class LinkRelationUnitTest {
|
||||
}
|
||||
|
||||
@Test // #825
|
||||
public void verifyRFC8288CaseInsensitiveMatching() {
|
||||
void verifyRFC8288CaseInsensitiveMatching() {
|
||||
|
||||
assertThat(LinkRelation.of("self")).isEqualTo(LinkRelation.of("SELF"));
|
||||
assertThat(LinkRelation.of("SeLf")).isEqualTo(IanaLinkRelations.SELF);
|
||||
|
||||
@@ -36,18 +36,18 @@ import org.springframework.http.HttpMethod;
|
||||
* @author Greg Turnquist
|
||||
* @author Jens Schauder
|
||||
*/
|
||||
public class LinkUnitTest {
|
||||
class LinkUnitTest {
|
||||
|
||||
private static final Affordance TEST_AFFORDANCE = new Affordance(null, null, HttpMethod.GET, null,
|
||||
Collections.emptyList(), null);
|
||||
|
||||
@Test
|
||||
public void linkWithHrefOnlyBecomesSelfLink() {
|
||||
void linkWithHrefOnlyBecomesSelfLink() {
|
||||
assertThat(new Link("foo").hasRel(IanaLinkRelations.SELF)).isTrue();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void createsLinkFromRelAndHref() {
|
||||
void createsLinkFromRelAndHref() {
|
||||
|
||||
Link link = new Link("foo", IanaLinkRelations.SELF);
|
||||
|
||||
@@ -60,7 +60,7 @@ public class LinkUnitTest {
|
||||
|
||||
@SuppressWarnings("null")
|
||||
@Test
|
||||
public void rejectsNullHref() {
|
||||
void rejectsNullHref() {
|
||||
|
||||
assertThatIllegalArgumentException().isThrownBy(() -> {
|
||||
new Link(null);
|
||||
@@ -69,7 +69,7 @@ public class LinkUnitTest {
|
||||
|
||||
@SuppressWarnings("null")
|
||||
@Test
|
||||
public void rejectsNullRel() {
|
||||
void rejectsNullRel() {
|
||||
|
||||
assertThatIllegalArgumentException().isThrownBy(() -> {
|
||||
new Link("foo", (String) null);
|
||||
@@ -77,7 +77,7 @@ public class LinkUnitTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void rejectsEmptyHref() {
|
||||
void rejectsEmptyHref() {
|
||||
|
||||
assertThatIllegalArgumentException().isThrownBy(() -> {
|
||||
new Link("");
|
||||
@@ -85,7 +85,7 @@ public class LinkUnitTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void rejectsEmptyRel() {
|
||||
void rejectsEmptyRel() {
|
||||
|
||||
assertThatIllegalArgumentException().isThrownBy(() -> {
|
||||
new Link("foo", "");
|
||||
@@ -93,7 +93,7 @@ public class LinkUnitTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void sameRelAndHrefMakeSameLink() {
|
||||
void sameRelAndHrefMakeSameLink() {
|
||||
|
||||
Link left = new Link("foo", IanaLinkRelations.SELF);
|
||||
Link right = new Link("foo", IanaLinkRelations.SELF);
|
||||
@@ -102,7 +102,7 @@ public class LinkUnitTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void differentRelMakesDifferentLink() {
|
||||
void differentRelMakesDifferentLink() {
|
||||
|
||||
Link left = new Link("foo", IanaLinkRelations.PREV);
|
||||
Link right = new Link("foo", IanaLinkRelations.NEXT);
|
||||
@@ -111,7 +111,7 @@ public class LinkUnitTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void differentHrefMakesDifferentLink() {
|
||||
void differentHrefMakesDifferentLink() {
|
||||
|
||||
Link left = new Link("foo", IanaLinkRelations.SELF);
|
||||
Link right = new Link("bar", IanaLinkRelations.SELF);
|
||||
@@ -120,7 +120,7 @@ public class LinkUnitTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void differentTypeDoesNotEqual() {
|
||||
void differentTypeDoesNotEqual() {
|
||||
assertThat(new Link("foo")).isNotEqualTo(new RepresentationModel<>());
|
||||
}
|
||||
|
||||
@@ -130,7 +130,7 @@ public class LinkUnitTest {
|
||||
* @see #678
|
||||
*/
|
||||
@Test
|
||||
public void parsesRFC5988HeaderIntoLink() {
|
||||
void parsesRFC5988HeaderIntoLink() {
|
||||
|
||||
assertSoftly(softly -> {
|
||||
|
||||
@@ -161,7 +161,7 @@ public class LinkUnitTest {
|
||||
* @see #100
|
||||
*/
|
||||
@Test
|
||||
public void ignoresUnrecognizedAttributes() {
|
||||
void ignoresUnrecognizedAttributes() {
|
||||
|
||||
Link link = Link.valueOf("</something>;rel=\"foo\";unknown=\"should fail\"");
|
||||
|
||||
@@ -173,7 +173,7 @@ public class LinkUnitTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void rejectsMissingRelAttribute() {
|
||||
void rejectsMissingRelAttribute() {
|
||||
|
||||
assertThatIllegalArgumentException().isThrownBy(() -> {
|
||||
Link.valueOf("</something>;title=\"title\"");
|
||||
@@ -181,7 +181,7 @@ public class LinkUnitTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void rejectsLinkWithoutAttributesAtAll() {
|
||||
void rejectsLinkWithoutAttributesAtAll() {
|
||||
|
||||
assertThatIllegalArgumentException().isThrownBy(() -> {
|
||||
Link.valueOf("</something>");
|
||||
@@ -189,7 +189,7 @@ public class LinkUnitTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void rejectsNonRFC5988String() {
|
||||
void rejectsNonRFC5988String() {
|
||||
|
||||
assertThatIllegalArgumentException().isThrownBy(() -> {
|
||||
Link.valueOf("foo");
|
||||
@@ -200,7 +200,7 @@ public class LinkUnitTest {
|
||||
* @see #137
|
||||
*/
|
||||
@Test
|
||||
public void isTemplatedIfSourceContainsTemplateVariables() {
|
||||
void isTemplatedIfSourceContainsTemplateVariables() {
|
||||
|
||||
Link link = new Link("/foo{?page}");
|
||||
|
||||
@@ -217,7 +217,7 @@ public class LinkUnitTest {
|
||||
* @see #137
|
||||
*/
|
||||
@Test
|
||||
public void isntTemplatedIfSourceDoesNotContainTemplateVariables() {
|
||||
void isntTemplatedIfSourceDoesNotContainTemplateVariables() {
|
||||
|
||||
Link link = new Link("/foo");
|
||||
|
||||
@@ -232,7 +232,7 @@ public class LinkUnitTest {
|
||||
* @see #172
|
||||
*/
|
||||
@Test
|
||||
public void serializesCorrectly() throws IOException {
|
||||
void serializesCorrectly() throws IOException {
|
||||
|
||||
Link link = new Link("https://foobar{?foo,bar}");
|
||||
|
||||
@@ -245,7 +245,7 @@ public class LinkUnitTest {
|
||||
* @see #312
|
||||
*/
|
||||
@Test
|
||||
public void keepsCompleteBaseUri() {
|
||||
void keepsCompleteBaseUri() {
|
||||
|
||||
Link link = new Link("/customer/{customerId}/programs", "programs");
|
||||
assertThat(link.getHref()).isEqualTo("/customer/{customerId}/programs");
|
||||
@@ -255,7 +255,7 @@ public class LinkUnitTest {
|
||||
* @see #504
|
||||
*/
|
||||
@Test
|
||||
public void parsesLinkRelationWithDotAndMinus() {
|
||||
void parsesLinkRelationWithDotAndMinus() {
|
||||
|
||||
assertThat(Link.valueOf("<http://localhost>; rel=\"rel-with-minus-and-.\"").hasRel("rel-with-minus-and-."))
|
||||
.isTrue();
|
||||
@@ -265,7 +265,7 @@ public class LinkUnitTest {
|
||||
* @see #504
|
||||
*/
|
||||
@Test
|
||||
public void parsesUriLinkRelations() {
|
||||
void parsesUriLinkRelations() {
|
||||
|
||||
assertThat(Link.valueOf("<http://localhost>; rel=\"https://acme.com/rels/foo-bar\"").getRel()) //
|
||||
.isEqualTo(LinkRelation.of("https://acme.com/rels/foo-bar"));
|
||||
@@ -275,7 +275,7 @@ public class LinkUnitTest {
|
||||
* @see #340
|
||||
*/
|
||||
@Test
|
||||
public void linkWithAffordancesShouldWorkProperly() {
|
||||
void linkWithAffordancesShouldWorkProperly() {
|
||||
|
||||
Link originalLink = new Link("/foo");
|
||||
Link linkWithAffordance = originalLink.andAffordance(TEST_AFFORDANCE);
|
||||
@@ -299,7 +299,7 @@ public class LinkUnitTest {
|
||||
* @see #671
|
||||
*/
|
||||
@Test
|
||||
public void exposesLinkRelation() {
|
||||
void exposesLinkRelation() {
|
||||
|
||||
Link link = new Link("/", "foo");
|
||||
|
||||
@@ -311,7 +311,7 @@ public class LinkUnitTest {
|
||||
* @see #671
|
||||
*/
|
||||
@Test
|
||||
public void rejectsInvalidRelationsOnHasRel() {
|
||||
void rejectsInvalidRelationsOnHasRel() {
|
||||
|
||||
Link link = new Link("/");
|
||||
|
||||
@@ -320,7 +320,7 @@ public class LinkUnitTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void affordanceConvenienceMethodChainsExistingLink() {
|
||||
void affordanceConvenienceMethodChainsExistingLink() {
|
||||
|
||||
Link link = new Link("/").andAffordance("name", HttpMethod.POST, ResolvableType.forClass(Employee.class),
|
||||
Collections.emptyList(), ResolvableType.forClass(Employee.class));
|
||||
@@ -362,7 +362,7 @@ public class LinkUnitTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void affordanceConvenienceMethodDefaultsNameBasedOnHttpVerb() {
|
||||
void affordanceConvenienceMethodDefaultsNameBasedOnHttpVerb() {
|
||||
|
||||
Link link = new Link("/").andAffordance(HttpMethod.POST, ResolvableType.forClass(Employee.class),
|
||||
Collections.emptyList(), ResolvableType.forClass(Employee.class));
|
||||
@@ -407,7 +407,7 @@ public class LinkUnitTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void affordanceConvenienceMethodHandlesBareClasses() {
|
||||
void affordanceConvenienceMethodHandlesBareClasses() {
|
||||
|
||||
Link link = new Link("/").andAffordance(HttpMethod.POST, Employee.class, Collections.emptyList(), Employee.class);
|
||||
|
||||
@@ -450,17 +450,17 @@ public class LinkUnitTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void createsUriForSimpleLink() {
|
||||
void createsUriForSimpleLink() {
|
||||
assertThat(new Link("/something").toUri()).isEqualTo(URI.create("/something"));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void createsUriForTemplateWithOptionalParameters() {
|
||||
void createsUriForTemplateWithOptionalParameters() {
|
||||
assertThat(new Link("/something{?parameter}").toUri()).isEqualTo(URI.create("/something"));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void uriCreationRejectsLinkWithUnresolvedMandatoryParameters() {
|
||||
void uriCreationRejectsLinkWithUnresolvedMandatoryParameters() {
|
||||
assertThatExceptionOfType(IllegalStateException.class).isThrownBy(() -> new Link("/{segment}/path").toUri());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -29,7 +29,7 @@ import org.springframework.util.StringUtils;
|
||||
* @author Oliver Gierke
|
||||
* @author Greg Turnquist
|
||||
*/
|
||||
public class LinksUnitTest {
|
||||
class LinksUnitTest {
|
||||
|
||||
static final String FIRST = "</something>;rel=\"foo\"";
|
||||
static final String SECOND = "</somethingElse>;rel=\"bar\"";
|
||||
@@ -48,7 +48,7 @@ public class LinksUnitTest {
|
||||
new Link("/somethingElse", "bar").withHreflang("de"));
|
||||
|
||||
@Test
|
||||
public void parsesLinkHeaderLinks() {
|
||||
void parsesLinkHeaderLinks() {
|
||||
|
||||
assertThat(Links.parse(LINKS)).isEqualTo(reference);
|
||||
assertThat(Links.parse(LINKS2)).isEqualTo(reference2);
|
||||
@@ -57,13 +57,13 @@ public class LinksUnitTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void skipsEmptyLinkElements() {
|
||||
void skipsEmptyLinkElements() {
|
||||
assertThat(Links.parse(LINKS + ",,,")).isEqualTo(reference);
|
||||
assertThat(Links.parse(LINKS2 + ",,,")).isEqualTo(reference2);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void returnsNullForNullOrEmptySource() {
|
||||
void returnsNullForNullOrEmptySource() {
|
||||
|
||||
assertThat(Links.parse(null)).isEqualTo(Links.NONE);
|
||||
assertThat(Links.parse("")).isEqualTo(Links.NONE);
|
||||
@@ -74,7 +74,7 @@ public class LinksUnitTest {
|
||||
* @see #100
|
||||
*/
|
||||
@Test
|
||||
public void getSingleLinkByRel() {
|
||||
void getSingleLinkByRel() {
|
||||
assertThat(reference.getLink("bar")).hasValue(new Link("/somethingElse", "bar"));
|
||||
assertThat(reference2.getLink("bar")).hasValue(new Link("/somethingElse", "bar").withHreflang("de"));
|
||||
}
|
||||
@@ -83,7 +83,7 @@ public class LinksUnitTest {
|
||||
* @see #440
|
||||
*/
|
||||
@Test
|
||||
public void parsesLinkWithComma() {
|
||||
void parsesLinkWithComma() {
|
||||
|
||||
Link withComma = new Link("http://localhost:8080/test?page=0&filter=foo,bar", "foo");
|
||||
|
||||
@@ -99,12 +99,12 @@ public class LinksUnitTest {
|
||||
* @see https://tools.ietf.org/html/rfc5988#section-5.5
|
||||
*/
|
||||
@Test
|
||||
public void parsesLinksWithWhitespace() {
|
||||
void parsesLinksWithWhitespace() {
|
||||
assertThat(Links.parse(WITH_WHITESPACE)).isEqualTo(reference);
|
||||
}
|
||||
|
||||
@Test // #805
|
||||
public void returnsRequiredLink() {
|
||||
void returnsRequiredLink() {
|
||||
|
||||
Link reference = new Link("http://localhost", "someRel");
|
||||
Links links = Links.of(reference);
|
||||
@@ -113,7 +113,7 @@ public class LinksUnitTest {
|
||||
}
|
||||
|
||||
@Test // #805
|
||||
public void rejectsMissingLinkWithIllegalArgumentException() {
|
||||
void rejectsMissingLinkWithIllegalArgumentException() {
|
||||
|
||||
Links links = Links.of();
|
||||
|
||||
@@ -123,7 +123,7 @@ public class LinksUnitTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void detectsContainedLinks() {
|
||||
void detectsContainedLinks() {
|
||||
|
||||
Link first = new Link("http://localhost", "someRel");
|
||||
Link second = new Link("http://localhost", "someOtherRel");
|
||||
|
||||
@@ -28,19 +28,19 @@ import org.springframework.hateoas.PagedModel.PageMetadata;
|
||||
*
|
||||
* @author Oliver Gierke
|
||||
*/
|
||||
public class PagedModelUnitTest {
|
||||
class PagedModelUnitTest {
|
||||
|
||||
static final PageMetadata metadata = new PagedModel.PageMetadata(10, 1, 200);
|
||||
|
||||
PagedModel<Object> resources;
|
||||
|
||||
@BeforeEach
|
||||
public void setUp() {
|
||||
void setUp() {
|
||||
resources = new PagedModel<>(Collections.emptyList(), metadata);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void discoversNextLink() {
|
||||
void discoversNextLink() {
|
||||
|
||||
resources.add(new Link("foo", IanaLinkRelations.NEXT.value()));
|
||||
|
||||
@@ -48,7 +48,7 @@ public class PagedModelUnitTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void discoversPreviousLink() {
|
||||
void discoversPreviousLink() {
|
||||
|
||||
resources.add(new Link("custom", IanaLinkRelations.PREV.value()));
|
||||
|
||||
@@ -59,7 +59,7 @@ public class PagedModelUnitTest {
|
||||
* @see #89
|
||||
*/
|
||||
@Test
|
||||
public void preventsNegativePageSize() {
|
||||
void preventsNegativePageSize() {
|
||||
|
||||
assertThatIllegalArgumentException().isThrownBy(() -> {
|
||||
new PageMetadata(-1, 0, 0);
|
||||
@@ -70,7 +70,7 @@ public class PagedModelUnitTest {
|
||||
* @see #89
|
||||
*/
|
||||
@Test
|
||||
public void preventsNegativePageNumber() {
|
||||
void preventsNegativePageNumber() {
|
||||
|
||||
assertThatIllegalArgumentException().isThrownBy(() -> {
|
||||
new PageMetadata(0, -1, 0);
|
||||
@@ -81,7 +81,7 @@ public class PagedModelUnitTest {
|
||||
* @see #89
|
||||
*/
|
||||
@Test
|
||||
public void preventsNegativeTotalElements() {
|
||||
void preventsNegativeTotalElements() {
|
||||
|
||||
assertThatIllegalArgumentException().isThrownBy(() -> {
|
||||
new PageMetadata(0, 0, -1);
|
||||
@@ -92,7 +92,7 @@ public class PagedModelUnitTest {
|
||||
* @see #89
|
||||
*/
|
||||
@Test
|
||||
public void preventsNegativeTotalPages() {
|
||||
void preventsNegativeTotalPages() {
|
||||
|
||||
assertThatIllegalArgumentException().isThrownBy(() -> {
|
||||
new PageMetadata(0, 0, 0, -1);
|
||||
@@ -103,7 +103,7 @@ public class PagedModelUnitTest {
|
||||
* @see #89
|
||||
*/
|
||||
@Test
|
||||
public void allowsOneIndexedPages() {
|
||||
void allowsOneIndexedPages() {
|
||||
new PageMetadata(10, 1, 0);
|
||||
}
|
||||
|
||||
@@ -111,7 +111,7 @@ public class PagedModelUnitTest {
|
||||
* @see #309
|
||||
*/
|
||||
@Test
|
||||
public void calculatesTotalPagesCorrectly() {
|
||||
void calculatesTotalPagesCorrectly() {
|
||||
assertThat(new PageMetadata(5, 0, 16).getTotalPages()).isEqualTo(4L);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -24,12 +24,12 @@ import org.junit.jupiter.api.Test;
|
||||
*
|
||||
* @author Oliver Gierke
|
||||
*/
|
||||
public class RepresentationModelIntegrationTest extends AbstractJackson2MarshallingIntegrationTest {
|
||||
class RepresentationModelIntegrationTest extends AbstractJackson2MarshallingIntegrationTest {
|
||||
|
||||
static final String REFERENCE = "{\"links\":[{\"rel\":\"self\",\"href\":\"localhost\"}]}";
|
||||
|
||||
@Test // #7
|
||||
public void doesNotRenderId() throws Exception {
|
||||
void doesNotRenderId() throws Exception {
|
||||
|
||||
RepresentationModel<?> model = new RepresentationModel<>();
|
||||
model.add(new Link("localhost"));
|
||||
@@ -38,7 +38,7 @@ public class RepresentationModelIntegrationTest extends AbstractJackson2Marshall
|
||||
}
|
||||
|
||||
@Test // #14
|
||||
public void readResourceSupportCorrectly() throws Exception {
|
||||
void readResourceSupportCorrectly() throws Exception {
|
||||
|
||||
RepresentationModel<?> model = read(REFERENCE, RepresentationModel.class);
|
||||
|
||||
|
||||
@@ -26,10 +26,10 @@ import org.junit.jupiter.api.Test;
|
||||
*
|
||||
* @author Oliver Gierke
|
||||
*/
|
||||
public class RepresentationModelUnitTest {
|
||||
class RepresentationModelUnitTest {
|
||||
|
||||
@Test
|
||||
public void setsUpWithEmptyLinkList() {
|
||||
void setsUpWithEmptyLinkList() {
|
||||
|
||||
RepresentationModel<?> support = new RepresentationModel<>();
|
||||
|
||||
@@ -40,7 +40,7 @@ public class RepresentationModelUnitTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void addsLinkCorrectly() {
|
||||
void addsLinkCorrectly() {
|
||||
|
||||
Link link = new Link("foo", IanaLinkRelations.NEXT.value());
|
||||
RepresentationModel<?> support = new RepresentationModel<>();
|
||||
@@ -53,7 +53,7 @@ public class RepresentationModelUnitTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void addsMultipleLinkRelationsCorrectly() {
|
||||
void addsMultipleLinkRelationsCorrectly() {
|
||||
|
||||
Link link = new Link("/customers/1", "customers");
|
||||
Link link2 = new Link("/orders/1/customer", "customers");
|
||||
@@ -67,7 +67,7 @@ public class RepresentationModelUnitTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void addsLinksCorrectly() {
|
||||
void addsLinksCorrectly() {
|
||||
|
||||
Link first = new Link("foo", IanaLinkRelations.PREV.value());
|
||||
Link second = new Link("bar", IanaLinkRelations.NEXT.value());
|
||||
@@ -83,7 +83,7 @@ public class RepresentationModelUnitTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void preventsNullLinkBeingAdded() {
|
||||
void preventsNullLinkBeingAdded() {
|
||||
|
||||
RepresentationModel<?> support = new RepresentationModel<>();
|
||||
|
||||
@@ -93,7 +93,7 @@ public class RepresentationModelUnitTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void preventsNullLinksBeingAdded() {
|
||||
void preventsNullLinksBeingAdded() {
|
||||
|
||||
RepresentationModel<?> support = new RepresentationModel<>();
|
||||
|
||||
@@ -103,7 +103,7 @@ public class RepresentationModelUnitTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void sameLinkListMeansSameResource() {
|
||||
void sameLinkListMeansSameResource() {
|
||||
|
||||
RepresentationModel<?> first = new RepresentationModel<>();
|
||||
RepresentationModel<?> second = new RepresentationModel<>();
|
||||
@@ -118,7 +118,7 @@ public class RepresentationModelUnitTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void differentLinkListsNotEqual() {
|
||||
void differentLinkListsNotEqual() {
|
||||
|
||||
RepresentationModel<?> first = new RepresentationModel<>();
|
||||
RepresentationModel<?> second = new RepresentationModel<>();
|
||||
@@ -129,7 +129,7 @@ public class RepresentationModelUnitTest {
|
||||
|
||||
@Test
|
||||
@SuppressWarnings("rawtypes")
|
||||
public void subclassNotEquals() {
|
||||
void subclassNotEquals() {
|
||||
|
||||
RepresentationModel<?> left = new RepresentationModel<>();
|
||||
RepresentationModel<?> right = new RepresentationModel() {
|
||||
@@ -152,7 +152,7 @@ public class RepresentationModelUnitTest {
|
||||
* @see #178
|
||||
*/
|
||||
@Test
|
||||
public void doesNotEqualNull() {
|
||||
void doesNotEqualNull() {
|
||||
|
||||
RepresentationModel<?> support = new RepresentationModel<>();
|
||||
assertThat(support.equals(null)).isFalse();
|
||||
@@ -162,7 +162,7 @@ public class RepresentationModelUnitTest {
|
||||
* @see #267
|
||||
*/
|
||||
@Test
|
||||
public void addsLinksViaVarargs() {
|
||||
void addsLinksViaVarargs() {
|
||||
|
||||
RepresentationModel<?> support = new RepresentationModel<>();
|
||||
support.add(new Link("/self", "self"), new Link("/another", "another"));
|
||||
|
||||
@@ -28,13 +28,13 @@ import org.springframework.hateoas.server.SimpleRepresentationModelAssembler;
|
||||
/**
|
||||
* @author Greg Turnquist
|
||||
*/
|
||||
public class SimpleRepresentationModelAssemblerTest {
|
||||
class SimpleRepresentationModelAssemblerTest {
|
||||
|
||||
/**
|
||||
* @see #572
|
||||
*/
|
||||
@Test
|
||||
public void convertingToResourceShouldWork() {
|
||||
void convertingToResourceShouldWork() {
|
||||
|
||||
TestResourceAssembler assembler = new TestResourceAssembler();
|
||||
EntityModel<Employee> resource = assembler.toModel(new Employee("Frodo"));
|
||||
@@ -47,7 +47,7 @@ public class SimpleRepresentationModelAssemblerTest {
|
||||
* @see #572
|
||||
*/
|
||||
@Test
|
||||
public void convertingToResourcesShouldWork() {
|
||||
void convertingToResourcesShouldWork() {
|
||||
|
||||
TestResourceAssembler assembler = new TestResourceAssembler();
|
||||
CollectionModel<EntityModel<Employee>> resources = assembler
|
||||
@@ -61,7 +61,7 @@ public class SimpleRepresentationModelAssemblerTest {
|
||||
* @see #572
|
||||
*/
|
||||
@Test
|
||||
public void convertingToResourceWithCustomLinksShouldWork() {
|
||||
void convertingToResourceWithCustomLinksShouldWork() {
|
||||
|
||||
ResourceAssemblerWithCustomLink assembler = new ResourceAssemblerWithCustomLink();
|
||||
EntityModel<Employee> resource = assembler.toModel(new Employee("Frodo"));
|
||||
@@ -74,7 +74,7 @@ public class SimpleRepresentationModelAssemblerTest {
|
||||
* @see #572
|
||||
*/
|
||||
@Test
|
||||
public void convertingToResourcesWithCustomLinksShouldWork() {
|
||||
void convertingToResourcesWithCustomLinksShouldWork() {
|
||||
|
||||
ResourceAssemblerWithCustomLink assembler = new ResourceAssemblerWithCustomLink();
|
||||
CollectionModel<EntityModel<Employee>> resources = assembler
|
||||
|
||||
@@ -28,10 +28,10 @@ import com.fasterxml.jackson.databind.ObjectMapper;
|
||||
*
|
||||
* @author Oliver Gierke
|
||||
*/
|
||||
public class StringLinkRelationUnitTests {
|
||||
class StringLinkRelationUnitTests {
|
||||
|
||||
@Test
|
||||
public void serializesAsPlainString() throws Exception {
|
||||
void serializesAsPlainString() throws Exception {
|
||||
|
||||
Sample sample = new Sample();
|
||||
sample.relation = StringLinkRelation.of("foo");
|
||||
@@ -42,7 +42,7 @@ public class StringLinkRelationUnitTests {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void deserializesUsingFactoryMethod() throws Exception {
|
||||
void deserializesUsingFactoryMethod() throws Exception {
|
||||
|
||||
ObjectMapper mapper = new ObjectMapper();
|
||||
|
||||
|
||||
@@ -28,13 +28,13 @@ import org.springframework.hateoas.TemplateVariable.VariableType;
|
||||
*
|
||||
* @author Oliver Gierke
|
||||
*/
|
||||
public class TemplateVariablesUnitTest {
|
||||
class TemplateVariablesUnitTest {
|
||||
|
||||
/**
|
||||
* @see #137
|
||||
*/
|
||||
@Test
|
||||
public void rendersNoTempalteVariablesAsEmptyString() {
|
||||
void rendersNoTempalteVariablesAsEmptyString() {
|
||||
assertThat(TemplateVariables.NONE.toString()).isEqualTo("");
|
||||
}
|
||||
|
||||
@@ -42,7 +42,7 @@ public class TemplateVariablesUnitTest {
|
||||
* @see #137
|
||||
*/
|
||||
@Test
|
||||
public void rendersSingleVariableCorrectly() {
|
||||
void rendersSingleVariableCorrectly() {
|
||||
|
||||
TemplateVariables variables = new TemplateVariables(new TemplateVariable("foo", SEGMENT));
|
||||
assertThat(variables.toString()).isEqualTo("{/foo}");
|
||||
@@ -52,7 +52,7 @@ public class TemplateVariablesUnitTest {
|
||||
* @see #137
|
||||
*/
|
||||
@Test
|
||||
public void combinesMultipleVariablesOfTheSameType() {
|
||||
void combinesMultipleVariablesOfTheSameType() {
|
||||
|
||||
TemplateVariable first = new TemplateVariable("foo", REQUEST_PARAM);
|
||||
TemplateVariable second = new TemplateVariable("bar", REQUEST_PARAM);
|
||||
@@ -66,7 +66,7 @@ public class TemplateVariablesUnitTest {
|
||||
* @see #137
|
||||
*/
|
||||
@Test
|
||||
public void combinesMultipleVariablesOfTheDifferentType() {
|
||||
void combinesMultipleVariablesOfTheDifferentType() {
|
||||
|
||||
TemplateVariable first = new TemplateVariable("foo", SEGMENT);
|
||||
TemplateVariable second = new TemplateVariable("bar", REQUEST_PARAM);
|
||||
@@ -80,7 +80,7 @@ public class TemplateVariablesUnitTest {
|
||||
* @see #137
|
||||
*/
|
||||
@Test
|
||||
public void concatsVariables() {
|
||||
void concatsVariables() {
|
||||
|
||||
TemplateVariables variables = new TemplateVariables(new TemplateVariable("foo", SEGMENT));
|
||||
variables = variables.concat(new TemplateVariable("bar", REQUEST_PARAM));
|
||||
@@ -92,7 +92,7 @@ public class TemplateVariablesUnitTest {
|
||||
* @see #137
|
||||
*/
|
||||
@Test
|
||||
public void combinesContinuedParamWithParam() {
|
||||
void combinesContinuedParamWithParam() {
|
||||
|
||||
TemplateVariable first = new TemplateVariable("foo", REQUEST_PARAM);
|
||||
TemplateVariable second = new TemplateVariable("bar", REQUEST_PARAM_CONTINUED);
|
||||
@@ -106,7 +106,7 @@ public class TemplateVariablesUnitTest {
|
||||
* @see #137
|
||||
*/
|
||||
@Test
|
||||
public void combinesContinuedParameterWithParameter() {
|
||||
void combinesContinuedParameterWithParameter() {
|
||||
|
||||
TemplateVariable first = new TemplateVariable("foo", REQUEST_PARAM_CONTINUED);
|
||||
TemplateVariable second = new TemplateVariable("bar", REQUEST_PARAM);
|
||||
@@ -120,7 +120,7 @@ public class TemplateVariablesUnitTest {
|
||||
* @see #198
|
||||
*/
|
||||
@Test
|
||||
public void dropsDuplicateTemplateVariable() {
|
||||
void dropsDuplicateTemplateVariable() {
|
||||
|
||||
TemplateVariable variable = new TemplateVariable("foo", REQUEST_PARAM);
|
||||
TemplateVariables variables = new TemplateVariables(variable);
|
||||
@@ -135,7 +135,7 @@ public class TemplateVariablesUnitTest {
|
||||
* @see #217
|
||||
*/
|
||||
@Test
|
||||
public void considersRequestParameterVariablesEquivalent() {
|
||||
void considersRequestParameterVariablesEquivalent() {
|
||||
|
||||
TemplateVariable parameter = new TemplateVariable("foo", REQUEST_PARAM);
|
||||
TemplateVariable continued = new TemplateVariable("foo", REQUEST_PARAM_CONTINUED);
|
||||
@@ -150,7 +150,7 @@ public class TemplateVariablesUnitTest {
|
||||
* @see #217
|
||||
*/
|
||||
@Test
|
||||
public void considersFragementVariable() {
|
||||
void considersFragementVariable() {
|
||||
|
||||
assertThat(new TemplateVariable("foo", VariableType.FRAGMENT).isFragment()).isTrue();
|
||||
assertThat(new TemplateVariable("foo", VariableType.REQUEST_PARAM).isFragment()).isFalse();
|
||||
@@ -160,7 +160,7 @@ public class TemplateVariablesUnitTest {
|
||||
* @see #217
|
||||
*/
|
||||
@Test
|
||||
public void doesNotAddEquivalentVariable() {
|
||||
void doesNotAddEquivalentVariable() {
|
||||
|
||||
TemplateVariable parameter = new TemplateVariable("foo", VariableType.REQUEST_PARAM);
|
||||
TemplateVariable parameterContinued = new TemplateVariable("foo", VariableType.REQUEST_PARAM_CONTINUED);
|
||||
@@ -175,7 +175,7 @@ public class TemplateVariablesUnitTest {
|
||||
* @see #228
|
||||
*/
|
||||
@Test
|
||||
public void variableRejectsEmptyName() {
|
||||
void variableRejectsEmptyName() {
|
||||
|
||||
assertThatIllegalArgumentException().isThrownBy(() -> {
|
||||
new TemplateVariable("", PATH_VARIABLE);
|
||||
@@ -186,7 +186,7 @@ public class TemplateVariablesUnitTest {
|
||||
* @see #228
|
||||
*/
|
||||
@Test
|
||||
public void variableRejectsNullName() {
|
||||
void variableRejectsNullName() {
|
||||
|
||||
assertThatIllegalArgumentException().isThrownBy(() -> {
|
||||
new TemplateVariable(null, PATH_VARIABLE);
|
||||
@@ -197,7 +197,7 @@ public class TemplateVariablesUnitTest {
|
||||
* @see #228
|
||||
*/
|
||||
@Test
|
||||
public void variableRejectsNullType() {
|
||||
void variableRejectsNullType() {
|
||||
|
||||
assertThatIllegalArgumentException().isThrownBy(() -> {
|
||||
new TemplateVariable("foo", null);
|
||||
@@ -208,7 +208,7 @@ public class TemplateVariablesUnitTest {
|
||||
* @see #228
|
||||
*/
|
||||
@Test
|
||||
public void variableRejectsNullDescription() {
|
||||
void variableRejectsNullDescription() {
|
||||
|
||||
assertThatIllegalArgumentException().isThrownBy(() -> {
|
||||
new TemplateVariable("foo", PATH_VARIABLE, null);
|
||||
|
||||
@@ -35,13 +35,13 @@ import org.springframework.hateoas.TemplateVariable.VariableType;
|
||||
* @author Oliver Gierke
|
||||
* @author JamesE Richardson
|
||||
*/
|
||||
public class UriTemplateUnitTest {
|
||||
class UriTemplateUnitTest {
|
||||
|
||||
/**
|
||||
* @see #137
|
||||
*/
|
||||
@Test
|
||||
public void discoversTemplate() {
|
||||
void discoversTemplate() {
|
||||
|
||||
assertThat(UriTemplate.isTemplate("/foo{?bar}")).isTrue();
|
||||
assertThat(UriTemplate.isTemplate("/foo")).isFalse();
|
||||
@@ -53,7 +53,7 @@ public class UriTemplateUnitTest {
|
||||
* @see #137
|
||||
*/
|
||||
@Test
|
||||
public void discoversRequestParam() {
|
||||
void discoversRequestParam() {
|
||||
|
||||
UriTemplate template = UriTemplate.of("/foo{?bar}");
|
||||
|
||||
@@ -64,7 +64,7 @@ public class UriTemplateUnitTest {
|
||||
* @see #137
|
||||
*/
|
||||
@Test
|
||||
public void discoversRequestParamCntinued() {
|
||||
void discoversRequestParamCntinued() {
|
||||
|
||||
UriTemplate template = UriTemplate.of("/foo?bar{&foobar}");
|
||||
|
||||
@@ -75,7 +75,7 @@ public class UriTemplateUnitTest {
|
||||
* @see #137
|
||||
*/
|
||||
@Test
|
||||
public void discoversOptionalPathVariable() {
|
||||
void discoversOptionalPathVariable() {
|
||||
|
||||
UriTemplate template = UriTemplate.of("/foo{/bar}");
|
||||
|
||||
@@ -86,7 +86,7 @@ public class UriTemplateUnitTest {
|
||||
* @see #137
|
||||
*/
|
||||
@Test
|
||||
public void discoversPathVariable() {
|
||||
void discoversPathVariable() {
|
||||
|
||||
UriTemplate template = UriTemplate.of("/foo/{bar}");
|
||||
|
||||
@@ -97,7 +97,7 @@ public class UriTemplateUnitTest {
|
||||
* @see #137
|
||||
*/
|
||||
@Test
|
||||
public void discoversFragment() {
|
||||
void discoversFragment() {
|
||||
|
||||
UriTemplate template = UriTemplate.of("/foo{#bar}");
|
||||
|
||||
@@ -108,7 +108,7 @@ public class UriTemplateUnitTest {
|
||||
* @see #137
|
||||
*/
|
||||
@Test
|
||||
public void discoversMultipleRequestParam() {
|
||||
void discoversMultipleRequestParam() {
|
||||
|
||||
UriTemplate template = UriTemplate.of("/foo{?bar,foobar}");
|
||||
|
||||
@@ -120,7 +120,7 @@ public class UriTemplateUnitTest {
|
||||
* @see #137
|
||||
*/
|
||||
@Test
|
||||
public void expandsRequestParameter() {
|
||||
void expandsRequestParameter() {
|
||||
|
||||
UriTemplate template = UriTemplate.of("/foo{?bar}");
|
||||
|
||||
@@ -132,7 +132,7 @@ public class UriTemplateUnitTest {
|
||||
* @see #137
|
||||
*/
|
||||
@Test
|
||||
public void expandsMultipleRequestParameters() {
|
||||
void expandsMultipleRequestParameters() {
|
||||
|
||||
Map<String, Object> parameters = new HashMap<>();
|
||||
parameters.put("bar", "myBar");
|
||||
@@ -148,7 +148,7 @@ public class UriTemplateUnitTest {
|
||||
* @see #137
|
||||
*/
|
||||
@Test
|
||||
public void rejectsMissingRequiredPathVariable() {
|
||||
void rejectsMissingRequiredPathVariable() {
|
||||
|
||||
UriTemplate template = UriTemplate.of("/foo/{bar}");
|
||||
|
||||
@@ -161,7 +161,7 @@ public class UriTemplateUnitTest {
|
||||
* @see #137
|
||||
*/
|
||||
@Test
|
||||
public void expandsMultipleVariablesViaArray() {
|
||||
void expandsMultipleVariablesViaArray() {
|
||||
|
||||
UriTemplate template = UriTemplate.of("/foo{/bar}{?firstname,lastname}{#anchor}");
|
||||
URI uri = template.expand("path", "Dave", "Matthews", "discography");
|
||||
@@ -172,7 +172,7 @@ public class UriTemplateUnitTest {
|
||||
* @see #137
|
||||
*/
|
||||
@Test
|
||||
public void expandsTemplateWithoutVariablesCorrectly() {
|
||||
void expandsTemplateWithoutVariablesCorrectly() {
|
||||
assertThat(UriTemplate.of("/foo").expand().toString()).isEqualTo("/foo");
|
||||
}
|
||||
|
||||
@@ -180,7 +180,7 @@ public class UriTemplateUnitTest {
|
||||
* @see #137
|
||||
*/
|
||||
@Test
|
||||
public void correctlyExpandsFullUri() {
|
||||
void correctlyExpandsFullUri() {
|
||||
assertThat(UriTemplate.of("http://localhost:8080/foo{?bar}").expand().toString())
|
||||
.isEqualTo("http://localhost:8080/foo");
|
||||
}
|
||||
@@ -189,7 +189,7 @@ public class UriTemplateUnitTest {
|
||||
* @see #137
|
||||
*/
|
||||
@Test
|
||||
public void rendersUriTempalteWithPathVariable() {
|
||||
void rendersUriTempalteWithPathVariable() {
|
||||
|
||||
UriTemplate template = UriTemplate.of("/{foo}/bar{?page}");
|
||||
assertThat(template.toString()).isEqualTo("/{foo}/bar{?page}");
|
||||
@@ -199,7 +199,7 @@ public class UriTemplateUnitTest {
|
||||
* #@see 137
|
||||
*/
|
||||
@Test
|
||||
public void addsTemplateVariables() {
|
||||
void addsTemplateVariables() {
|
||||
|
||||
UriTemplate source = UriTemplate.of("/{foo}/bar{?page}");
|
||||
List<TemplateVariable> toAdd = Arrays.asList(new TemplateVariable("bar", VariableType.REQUEST_PARAM));
|
||||
@@ -215,7 +215,7 @@ public class UriTemplateUnitTest {
|
||||
* @see #217
|
||||
*/
|
||||
@Test
|
||||
public void doesNotAddVariablesForAlreadyExistingRequestParameters() {
|
||||
void doesNotAddVariablesForAlreadyExistingRequestParameters() {
|
||||
|
||||
UriTemplate template = UriTemplate.of("/?page=2");
|
||||
UriTemplate result = template.with(new TemplateVariables(new TemplateVariable("page", VariableType.REQUEST_PARAM)));
|
||||
@@ -229,7 +229,7 @@ public class UriTemplateUnitTest {
|
||||
* @see #217
|
||||
*/
|
||||
@Test
|
||||
public void doesNotAddVariablesForAlreadyExistingFragment() {
|
||||
void doesNotAddVariablesForAlreadyExistingFragment() {
|
||||
|
||||
UriTemplate template = UriTemplate.of("/#fragment");
|
||||
UriTemplate result = template.with(new TemplateVariables(new TemplateVariable("fragment", VariableType.FRAGMENT)));
|
||||
@@ -240,7 +240,7 @@ public class UriTemplateUnitTest {
|
||||
* @see #271
|
||||
*/
|
||||
@Test
|
||||
public void expandASimplePathVariable() {
|
||||
void expandASimplePathVariable() {
|
||||
|
||||
UriTemplate template = UriTemplate.of("/foo/{id}");
|
||||
assertThat(template.expand(2).toString()).isEqualTo("/foo/2");
|
||||
@@ -250,7 +250,7 @@ public class UriTemplateUnitTest {
|
||||
* @see #273
|
||||
*/
|
||||
@Test
|
||||
public void rejectsEmptyBaseUri() {
|
||||
void rejectsEmptyBaseUri() {
|
||||
|
||||
assertThatIllegalArgumentException().isThrownBy(() -> {
|
||||
new UriTemplate(null, TemplateVariables.NONE);
|
||||
@@ -261,7 +261,7 @@ public class UriTemplateUnitTest {
|
||||
* @see #281
|
||||
*/
|
||||
@Test
|
||||
public void allowsAddingTemplateVariable() {
|
||||
void allowsAddingTemplateVariable() {
|
||||
|
||||
UriTemplate template = UriTemplate.of("/").with("q", VariableType.REQUEST_PARAM);
|
||||
|
||||
@@ -272,7 +272,7 @@ public class UriTemplateUnitTest {
|
||||
* @see #483
|
||||
*/
|
||||
@Test
|
||||
public void compositveValuesAreRecognisedAsVariableType() {
|
||||
void compositveValuesAreRecognisedAsVariableType() {
|
||||
|
||||
UriTemplate template = UriTemplate.of("/foo{&bar,foobar*}");
|
||||
|
||||
@@ -285,7 +285,7 @@ public class UriTemplateUnitTest {
|
||||
*/
|
||||
@Test
|
||||
@SuppressWarnings("serial")
|
||||
public void expandsCompositeValueAsAssociativeArray() {
|
||||
void expandsCompositeValueAsAssociativeArray() {
|
||||
|
||||
UriTemplate template = UriTemplate.of("/foo{&bar,foobar*}");
|
||||
|
||||
@@ -309,7 +309,7 @@ public class UriTemplateUnitTest {
|
||||
*/
|
||||
@Test
|
||||
@SuppressWarnings("serial")
|
||||
public void expandsCompositeValueAsList() {
|
||||
void expandsCompositeValueAsList() {
|
||||
|
||||
UriTemplate template = UriTemplate.of("/foo{&bar,foobar*}");
|
||||
|
||||
@@ -328,7 +328,7 @@ public class UriTemplateUnitTest {
|
||||
*/
|
||||
@Test
|
||||
@SuppressWarnings("serial")
|
||||
public void handlesCompositeValueAsSingleValue() {
|
||||
void handlesCompositeValueAsSingleValue() {
|
||||
|
||||
UriTemplate template = UriTemplate.of("/foo{&bar,foobar*}");
|
||||
|
||||
|
||||
@@ -28,13 +28,13 @@ import org.junit.jupiter.api.Test;
|
||||
* @author Oliver Gierke
|
||||
* @soundtrack Dave Matthews Band - The Stone (Before These Crowded Streets)
|
||||
*/
|
||||
public class HopUnitTest {
|
||||
class HopUnitTest {
|
||||
|
||||
/**
|
||||
* @see #346
|
||||
*/
|
||||
@Test
|
||||
public void rejectsNullRelationName() {
|
||||
void rejectsNullRelationName() {
|
||||
|
||||
assertThatIllegalArgumentException().isThrownBy(() -> {
|
||||
Hop.rel(null);
|
||||
@@ -45,7 +45,7 @@ public class HopUnitTest {
|
||||
* @see #346
|
||||
*/
|
||||
@Test
|
||||
public void rejectsEmptyRelationName() {
|
||||
void rejectsEmptyRelationName() {
|
||||
|
||||
assertThatIllegalArgumentException().isThrownBy(() -> {
|
||||
Hop.rel("");
|
||||
@@ -56,7 +56,7 @@ public class HopUnitTest {
|
||||
* @see #346
|
||||
*/
|
||||
@Test
|
||||
public void hasNoParametersByDefault() {
|
||||
void hasNoParametersByDefault() {
|
||||
assertThat(Hop.rel("rel").getParameters()).isEmpty();
|
||||
}
|
||||
|
||||
@@ -64,7 +64,7 @@ public class HopUnitTest {
|
||||
* @see #346
|
||||
*/
|
||||
@Test
|
||||
public void addsParameterForSingluarWither() {
|
||||
void addsParameterForSingluarWither() {
|
||||
|
||||
Hop hop = Hop.rel("rel").withParameter("key", "value");
|
||||
|
||||
@@ -76,7 +76,7 @@ public class HopUnitTest {
|
||||
* @see #346
|
||||
*/
|
||||
@Test
|
||||
public void replacesParametersForWither() {
|
||||
void replacesParametersForWither() {
|
||||
|
||||
Hop hop = Hop.rel("rel").withParameter("key", "value").withParameters(Collections.singletonMap("foo", "bar"));
|
||||
|
||||
@@ -88,7 +88,7 @@ public class HopUnitTest {
|
||||
* @see #346
|
||||
*/
|
||||
@Test
|
||||
public void mergesGlobalParameters() {
|
||||
void mergesGlobalParameters() {
|
||||
|
||||
Hop hop = Hop.rel("rel").withParameter("key", "value");
|
||||
|
||||
@@ -101,7 +101,7 @@ public class HopUnitTest {
|
||||
* @see #346
|
||||
*/
|
||||
@Test
|
||||
public void localParameterOverridesGlobalOnMerging() {
|
||||
void localParameterOverridesGlobalOnMerging() {
|
||||
|
||||
Hop hop = Hop.rel("rel").withParameter("key", "value");
|
||||
|
||||
|
||||
@@ -19,7 +19,7 @@ import com.fasterxml.jackson.annotation.JsonAutoDetect;
|
||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
|
||||
@JsonAutoDetect(fieldVisibility = JsonAutoDetect.Visibility.ANY)
|
||||
public class Item {
|
||||
class Item {
|
||||
|
||||
String image;
|
||||
String description;
|
||||
|
||||
@@ -35,7 +35,7 @@ import org.springframework.hateoas.Links;
|
||||
public abstract class LinkDiscovererUnitTest {
|
||||
|
||||
@Test
|
||||
public void findsSingleLink() {
|
||||
void findsSingleLink() {
|
||||
|
||||
assertThat(getDiscoverer().findLinkWithRel("self", getInputString())) //
|
||||
.hasValue(new Link("selfHref"));
|
||||
@@ -47,14 +47,14 @@ public abstract class LinkDiscovererUnitTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void findsFirstLink() {
|
||||
void findsFirstLink() {
|
||||
|
||||
assertThat(getDiscoverer().findLinkWithRel("relation", getInputString()))
|
||||
.hasValue(new Link("firstHref", "relation"));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void findsAllLinks() {
|
||||
void findsAllLinks() {
|
||||
|
||||
Links links = getDiscoverer().findLinksWithRel("relation", getInputString());
|
||||
|
||||
@@ -63,26 +63,26 @@ public abstract class LinkDiscovererUnitTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void returnsForInexistingLink() {
|
||||
void returnsForInexistingLink() {
|
||||
assertThat(getDiscoverer().findLinkWithRel("something", getInputString())).isEmpty();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void returnsForInexistingLinkFromInputStream() throws Exception {
|
||||
void returnsForInexistingLinkFromInputStream() throws Exception {
|
||||
|
||||
InputStream inputStream = new ByteArrayInputStream(getInputString().getBytes("UTF-8"));
|
||||
assertThat(getDiscoverer().findLinkWithRel("something", inputStream)).isEmpty();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void returnsNullForNonExistingLinkContainer() {
|
||||
void returnsNullForNonExistingLinkContainer() {
|
||||
|
||||
assertThat(getDiscoverer().findLinksWithRel("something", getInputStringWithoutLinkContainer())).isEmpty();
|
||||
assertThat(getDiscoverer().findLinkWithRel("something", getInputStringWithoutLinkContainer())).isEmpty();
|
||||
}
|
||||
|
||||
@Test // #840
|
||||
public void throwsExceptionForRequiredLinkNotFoundInString() {
|
||||
void throwsExceptionForRequiredLinkNotFoundInString() {
|
||||
|
||||
LinkDiscoverer discoverer = getDiscoverer();
|
||||
|
||||
@@ -91,7 +91,7 @@ public abstract class LinkDiscovererUnitTest {
|
||||
}
|
||||
|
||||
@Test // #840
|
||||
public void throwsExceptionForRequiredLinkNotFoundInInputStream() throws IOException {
|
||||
void throwsExceptionForRequiredLinkNotFoundInInputStream() throws IOException {
|
||||
|
||||
LinkDiscoverer discoverer = getDiscoverer();
|
||||
|
||||
|
||||
@@ -28,10 +28,10 @@ import org.springframework.plugin.core.PluginRegistry;
|
||||
* @author Oliver Gierke
|
||||
* @author Greg Turnquist
|
||||
*/
|
||||
public class LinkDiscoverersUnitTest {
|
||||
class LinkDiscoverersUnitTest {
|
||||
|
||||
@Test
|
||||
public void rejectsNullPluginRegistry() {
|
||||
void rejectsNullPluginRegistry() {
|
||||
|
||||
assertThatIllegalArgumentException().isThrownBy(() -> {
|
||||
new LinkDiscoverers(null);
|
||||
@@ -39,7 +39,7 @@ public class LinkDiscoverersUnitTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void favorsCustomLinkDiscovererOverDefault() {
|
||||
void favorsCustomLinkDiscovererOverDefault() {
|
||||
|
||||
LinkDiscoverer low = new LowPriorityLinkDiscoverer();
|
||||
LinkDiscoverer high = new HighPriorityLinkDiscoverer();
|
||||
|
||||
@@ -58,7 +58,7 @@ import org.springframework.web.client.RestTemplate;
|
||||
* @author Michael Wirth
|
||||
* @since 0.11
|
||||
*/
|
||||
public class TraversonTest {
|
||||
class TraversonTest {
|
||||
|
||||
static URI baseUri;
|
||||
static Server server;
|
||||
@@ -75,7 +75,7 @@ public class TraversonTest {
|
||||
}
|
||||
|
||||
@BeforeEach
|
||||
public void setUp() {
|
||||
void setUp() {
|
||||
this.traverson = new Traverson(baseUri, MediaTypes.HAL_JSON_UTF8, MediaTypes.HAL_JSON);
|
||||
|
||||
}
|
||||
@@ -92,7 +92,7 @@ public class TraversonTest {
|
||||
* @see #131
|
||||
*/
|
||||
@Test
|
||||
public void rejectsNullBaseUri() {
|
||||
void rejectsNullBaseUri() {
|
||||
|
||||
assertThatIllegalArgumentException().isThrownBy(() -> {
|
||||
new Traverson(null, MediaTypes.HAL_JSON);
|
||||
@@ -103,7 +103,7 @@ public class TraversonTest {
|
||||
* @see #131
|
||||
*/
|
||||
@Test
|
||||
public void rejectsEmptyMediaTypes() {
|
||||
void rejectsEmptyMediaTypes() {
|
||||
|
||||
assertThatIllegalArgumentException().isThrownBy(() -> {
|
||||
new Traverson(baseUri);
|
||||
@@ -114,7 +114,7 @@ public class TraversonTest {
|
||||
* @see #131
|
||||
*/
|
||||
@Test
|
||||
public void sendsConfiguredMediaTypesInAcceptHeader() {
|
||||
void sendsConfiguredMediaTypesInAcceptHeader() {
|
||||
|
||||
traverson.follow().toObject(String.class);
|
||||
|
||||
@@ -127,7 +127,7 @@ public class TraversonTest {
|
||||
* @see #131
|
||||
*/
|
||||
@Test
|
||||
public void readsTraversalIntoJsonPathExpression() {
|
||||
void readsTraversalIntoJsonPathExpression() {
|
||||
assertThat(traverson.follow("movies", "movie", "actor").<String> toObject("$.name")).isEqualTo("Keanu Reaves");
|
||||
}
|
||||
|
||||
@@ -135,7 +135,7 @@ public class TraversonTest {
|
||||
* @see #131
|
||||
*/
|
||||
@Test
|
||||
public void readsJsonPathTraversalIntoJsonPathExpression() {
|
||||
void readsJsonPathTraversalIntoJsonPathExpression() {
|
||||
|
||||
assertThat(traverson.follow(//
|
||||
"$._links.movies.href", //
|
||||
@@ -148,7 +148,7 @@ public class TraversonTest {
|
||||
* @see #131
|
||||
*/
|
||||
@Test
|
||||
public void readsTraversalIntoResourceInstance() {
|
||||
void readsTraversalIntoResourceInstance() {
|
||||
|
||||
ParameterizedTypeReference<EntityModel<Actor>> typeReference = new ParameterizedTypeReference<EntityModel<Actor>>() {};
|
||||
EntityModel<Actor> result = traverson.follow("movies", "movie", "actor").toObject(typeReference);
|
||||
@@ -160,7 +160,7 @@ public class TraversonTest {
|
||||
* @see #187
|
||||
*/
|
||||
@Test
|
||||
public void sendsConfiguredHeadersForJsonPathExpression() {
|
||||
void sendsConfiguredHeadersForJsonPathExpression() {
|
||||
|
||||
String expectedHeader = "<https://www.example.com>;rel=\"home\"";
|
||||
|
||||
@@ -179,7 +179,7 @@ public class TraversonTest {
|
||||
* @see #187
|
||||
*/
|
||||
@Test
|
||||
public void sendsConfiguredHeadersForToEntity() {
|
||||
void sendsConfiguredHeadersForToEntity() {
|
||||
|
||||
String expectedHeader = "<https://www.example.com>;rel=\"home\"";
|
||||
|
||||
@@ -198,7 +198,7 @@ public class TraversonTest {
|
||||
* @see #201, #203
|
||||
*/
|
||||
@Test
|
||||
public void allowsCustomizingRestTemplate() {
|
||||
void allowsCustomizingRestTemplate() {
|
||||
|
||||
CountingInterceptor interceptor = new CountingInterceptor();
|
||||
|
||||
@@ -216,7 +216,7 @@ public class TraversonTest {
|
||||
* @see #185
|
||||
*/
|
||||
@Test
|
||||
public void usesCustomLinkDiscoverer() {
|
||||
void usesCustomLinkDiscoverer() {
|
||||
|
||||
this.traverson = new Traverson(URI.create(server.rootResource() + "/github"), MediaType.APPLICATION_JSON);
|
||||
this.traverson.setLinkDiscoverers(Arrays.asList(new GitHubLinkDiscoverer()));
|
||||
@@ -229,7 +229,7 @@ public class TraversonTest {
|
||||
* @see #212
|
||||
*/
|
||||
@Test
|
||||
public void shouldReturnLastLinkFound() {
|
||||
void shouldReturnLastLinkFound() {
|
||||
|
||||
Link result = traverson.follow("movies").asLink();
|
||||
|
||||
@@ -241,7 +241,7 @@ public class TraversonTest {
|
||||
* @see #307
|
||||
*/
|
||||
@Test
|
||||
public void returnsTemplatedLinkIfRequested() {
|
||||
void returnsTemplatedLinkIfRequested() {
|
||||
|
||||
TraversalBuilder follow = new Traverson(URI.create(server.rootResource().concat("/link")), MediaTypes.HAL_JSON)
|
||||
.follow("self");
|
||||
@@ -257,7 +257,7 @@ public class TraversonTest {
|
||||
}
|
||||
|
||||
@Test // #971
|
||||
public void returnsTemplatedRequiredLinkIfRequested() {
|
||||
void returnsTemplatedRequiredLinkIfRequested() {
|
||||
|
||||
Link templatedLink = new Traverson(URI.create(server.rootResource() + "/github-with-template"), MediaTypes.HAL_JSON) //
|
||||
.follow("rel_to_templated_link") //
|
||||
@@ -276,7 +276,7 @@ public class TraversonTest {
|
||||
* @see #258
|
||||
*/
|
||||
@Test
|
||||
public void returnsDefaultMessageConvertersForHal() {
|
||||
void returnsDefaultMessageConvertersForHal() {
|
||||
|
||||
List<HttpMessageConverter<?>> converters = Traverson.getDefaultMessageConverters(MediaTypes.HAL_JSON);
|
||||
|
||||
@@ -295,7 +295,7 @@ public class TraversonTest {
|
||||
* @see #258
|
||||
*/
|
||||
@Test
|
||||
public void returnsDefaultMessageConverters() {
|
||||
void returnsDefaultMessageConverters() {
|
||||
|
||||
List<HttpMessageConverter<?>> converters = Traverson.getDefaultMessageConverters();
|
||||
|
||||
@@ -307,7 +307,7 @@ public class TraversonTest {
|
||||
* @see #346
|
||||
*/
|
||||
@Test
|
||||
public void chainMultipleFollowOperations() {
|
||||
void chainMultipleFollowOperations() {
|
||||
|
||||
ParameterizedTypeReference<EntityModel<Actor>> typeReference = new ParameterizedTypeReference<EntityModel<Actor>>() {};
|
||||
EntityModel<Actor> result = traverson.follow("movies").follow("movie").follow("actor").toObject(typeReference);
|
||||
@@ -319,7 +319,7 @@ public class TraversonTest {
|
||||
* @see #346
|
||||
*/
|
||||
@Test
|
||||
public void allowAlteringTheDetailsOfASingleHop() {
|
||||
void allowAlteringTheDetailsOfASingleHop() {
|
||||
|
||||
this.traverson = new Traverson(URI.create(server.rootResource() + "/springagram"), MediaTypes.HAL_JSON);
|
||||
|
||||
@@ -345,7 +345,7 @@ public class TraversonTest {
|
||||
* @see #346
|
||||
*/
|
||||
@Test
|
||||
public void allowAlteringTheDetailsOfASingleHopByMapOperations() {
|
||||
void allowAlteringTheDetailsOfASingleHopByMapOperations() {
|
||||
|
||||
this.traverson = new Traverson(URI.create(server.rootResource() + "/springagram"), MediaTypes.HAL_JSON);
|
||||
|
||||
@@ -373,7 +373,7 @@ public class TraversonTest {
|
||||
* @see #346
|
||||
*/
|
||||
@Test
|
||||
public void allowGlobalsToImpactSingleHops() {
|
||||
void allowGlobalsToImpactSingleHops() {
|
||||
|
||||
this.traverson = new Traverson(URI.create(server.rootResource() + "/springagram"), MediaTypes.HAL_JSON);
|
||||
|
||||
@@ -398,7 +398,7 @@ public class TraversonTest {
|
||||
* @see #337
|
||||
*/
|
||||
@Test
|
||||
public void doesNotDoubleEncodeURI() {
|
||||
void doesNotDoubleEncodeURI() {
|
||||
|
||||
this.traverson = new Traverson(URI.create(server.rootResource() + "/springagram"), MediaTypes.HAL_JSON);
|
||||
|
||||
@@ -412,7 +412,7 @@ public class TraversonTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void customHeaders() {
|
||||
void customHeaders() {
|
||||
|
||||
String customHeaderName = "X-CustomHeader";
|
||||
|
||||
|
||||
@@ -40,12 +40,12 @@ import org.springframework.web.reactive.config.EnableWebFlux;
|
||||
/**
|
||||
* @author Greg Turnquist
|
||||
*/
|
||||
public class CustomHypermediaWebFluxTest {
|
||||
class CustomHypermediaWebFluxTest {
|
||||
|
||||
WebTestClient testClient;
|
||||
|
||||
@BeforeEach
|
||||
public void setUp() {
|
||||
void setUp() {
|
||||
|
||||
AnnotationConfigApplicationContext ctx = new AnnotationConfigApplicationContext();
|
||||
ctx.register(TestConfig.class);
|
||||
@@ -60,7 +60,7 @@ public class CustomHypermediaWebFluxTest {
|
||||
}
|
||||
|
||||
@Test // #833
|
||||
public void getUsingCustomMediaType() throws IOException {
|
||||
void getUsingCustomMediaType() throws IOException {
|
||||
|
||||
this.testClient.get().uri("http://localhost/employees/1") //
|
||||
.accept(FRODO_MEDIATYPE) //
|
||||
|
||||
@@ -52,18 +52,18 @@ import org.springframework.web.servlet.config.annotation.EnableWebMvc;
|
||||
@ExtendWith(SpringExtension.class)
|
||||
@WebAppConfiguration
|
||||
@ContextConfiguration
|
||||
public class CustomHypermediaWebMvcTest {
|
||||
class CustomHypermediaWebMvcTest {
|
||||
|
||||
private @Autowired WebApplicationContext context;
|
||||
private MockMvc mockMvc;
|
||||
|
||||
@BeforeEach
|
||||
public void setUp() {
|
||||
void setUp() {
|
||||
this.mockMvc = webAppContextSetup(this.context).build();
|
||||
}
|
||||
|
||||
@Test // #833
|
||||
public void getUsingCustomMediaType() throws Exception {
|
||||
void getUsingCustomMediaType() throws Exception {
|
||||
|
||||
String results = this.mockMvc.perform(get("/employees/1").accept(FRODO_MEDIATYPE)) //
|
||||
.andExpect(header().string(HttpHeaders.CONTENT_TYPE, FRODO_MEDIATYPE.toString() + ";charset=UTF-8")) //
|
||||
|
||||
@@ -36,7 +36,7 @@ import org.springframework.web.bind.annotation.RequestMapping;
|
||||
*/
|
||||
@ExtendWith(SpringExtension.class)
|
||||
@ContextConfiguration
|
||||
public class EnableEntityLinksIntegrationTest {
|
||||
class EnableEntityLinksIntegrationTest {
|
||||
|
||||
@Configuration
|
||||
@EnableEntityLinks
|
||||
@@ -51,7 +51,7 @@ public class EnableEntityLinksIntegrationTest {
|
||||
@Autowired DelegatingEntityLinks builder;
|
||||
|
||||
@Test
|
||||
public void initializesDelegatingEntityLinks() {
|
||||
void initializesDelegatingEntityLinks() {
|
||||
|
||||
assertThat(builder).isNotNull();
|
||||
assertThat(builder.supports(Person.class)).isTrue();
|
||||
|
||||
@@ -71,30 +71,30 @@ import com.fasterxml.jackson.databind.ObjectMapper;
|
||||
* @author Greg Turnquist
|
||||
*/
|
||||
@ExtendWith(MockitoExtension.class)
|
||||
public class EnableHypermediaSupportIntegrationTest {
|
||||
class EnableHypermediaSupportIntegrationTest {
|
||||
|
||||
@Test
|
||||
public void bootstrapHalConfiguration() {
|
||||
void bootstrapHalConfiguration() {
|
||||
assertHalSetupForConfigClass(HalConfig.class);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void bootstrapHalFormsConfiguration() {
|
||||
void bootstrapHalFormsConfiguration() {
|
||||
assertHalFormsSetupForConfigClass(HalFormsConfig.class);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void bootstrapJsonCollectionConfiguration() {
|
||||
void bootstrapJsonCollectionConfiguration() {
|
||||
assertCollectionJsonSetupForConfigClass(CollectionJsonConfig.class);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void bootstrapUberConfiguration() {
|
||||
void bootstrapUberConfiguration() {
|
||||
assertUberSetupForConfigClass(UberConfig.class);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void registersHalLinkDiscoverers() {
|
||||
void registersHalLinkDiscoverers() {
|
||||
|
||||
withServletContext(HalConfig.class, context -> {
|
||||
|
||||
@@ -110,7 +110,7 @@ public class EnableHypermediaSupportIntegrationTest {
|
||||
}
|
||||
|
||||
@Test // #833
|
||||
public void registersHalFormsLinkDiscoverers() {
|
||||
void registersHalFormsLinkDiscoverers() {
|
||||
|
||||
withServletContext(HalFormsConfig.class, context -> {
|
||||
|
||||
@@ -124,7 +124,7 @@ public class EnableHypermediaSupportIntegrationTest {
|
||||
}
|
||||
|
||||
@Test // #833
|
||||
public void registersHalAndHalFormsLinkDiscoverers() {
|
||||
void registersHalAndHalFormsLinkDiscoverers() {
|
||||
|
||||
withServletContext(HalAndHalFormsConfig.class, context -> {
|
||||
|
||||
@@ -144,7 +144,7 @@ public class EnableHypermediaSupportIntegrationTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void registersCollectionJsonLinkDiscoverers() {
|
||||
void registersCollectionJsonLinkDiscoverers() {
|
||||
|
||||
withServletContext(CollectionJsonConfig.class, context -> {
|
||||
|
||||
@@ -158,7 +158,7 @@ public class EnableHypermediaSupportIntegrationTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void registersUberLinkDiscoverers() {
|
||||
void registersUberLinkDiscoverers() {
|
||||
|
||||
withServletContext(UberConfig.class, context -> {
|
||||
|
||||
@@ -172,22 +172,22 @@ public class EnableHypermediaSupportIntegrationTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void bootstrapsHalConfigurationForSubclass() {
|
||||
void bootstrapsHalConfigurationForSubclass() {
|
||||
assertHalSetupForConfigClass(ExtendedHalConfig.class);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void bootstrapsHalFormsConfigurationForSubclass() {
|
||||
void bootstrapsHalFormsConfigurationForSubclass() {
|
||||
assertHalFormsSetupForConfigClass(ExtendedHalFormsConfig.class);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void bootstrapsCollectionJsonConfigurationForSubclass() {
|
||||
void bootstrapsCollectionJsonConfigurationForSubclass() {
|
||||
assertCollectionJsonSetupForConfigClass(ExtendedCollectionJsonConfig.class);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void bootstrapsUberConfigurationForSubclass() {
|
||||
void bootstrapsUberConfigurationForSubclass() {
|
||||
assertUberSetupForConfigClass(ExtendedUberConfig.class);
|
||||
}
|
||||
|
||||
@@ -196,7 +196,7 @@ public class EnableHypermediaSupportIntegrationTest {
|
||||
*/
|
||||
@Test
|
||||
@SuppressWarnings("unchecked")
|
||||
public void halSetupIsAppliedToAllTransitiveComponentsInRequestMappingHandlerAdapter() {
|
||||
void halSetupIsAppliedToAllTransitiveComponentsInRequestMappingHandlerAdapter() {
|
||||
|
||||
withServletContext(HalConfig.class, context -> {
|
||||
|
||||
@@ -228,7 +228,7 @@ public class EnableHypermediaSupportIntegrationTest {
|
||||
|
||||
@Test
|
||||
@SuppressWarnings("unchecked")
|
||||
public void halFormsSetupIsAppliedToAllTransitiveComponentsInRequestMappingHandlerAdapter() {
|
||||
void halFormsSetupIsAppliedToAllTransitiveComponentsInRequestMappingHandlerAdapter() {
|
||||
|
||||
withServletContext(HalFormsConfig.class, context -> {
|
||||
|
||||
@@ -260,7 +260,7 @@ public class EnableHypermediaSupportIntegrationTest {
|
||||
|
||||
@Test
|
||||
@SuppressWarnings("unchecked")
|
||||
public void collectionJsonSetupIsAppliedToAllTransitiveComponentsInRequestMappingHandlerAdapter() {
|
||||
void collectionJsonSetupIsAppliedToAllTransitiveComponentsInRequestMappingHandlerAdapter() {
|
||||
|
||||
withServletContext(CollectionJsonConfig.class, context -> {
|
||||
|
||||
@@ -292,7 +292,7 @@ public class EnableHypermediaSupportIntegrationTest {
|
||||
|
||||
@Test
|
||||
@SuppressWarnings("unchecked")
|
||||
public void uberSetupIsAppliedToAllTransitiveComponentsInRequestMappingHandlerAdapter() {
|
||||
void uberSetupIsAppliedToAllTransitiveComponentsInRequestMappingHandlerAdapter() {
|
||||
|
||||
withServletContext(UberConfig.class, context -> {
|
||||
|
||||
@@ -329,7 +329,7 @@ public class EnableHypermediaSupportIntegrationTest {
|
||||
* @see #293
|
||||
*/
|
||||
@Test
|
||||
public void registersHalHttpMessageConvertersForRestTemplate() {
|
||||
void registersHalHttpMessageConvertersForRestTemplate() {
|
||||
|
||||
withServletContext(HalConfig.class, context -> {
|
||||
|
||||
@@ -341,7 +341,7 @@ public class EnableHypermediaSupportIntegrationTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void registersHalFormsHttpMessageConvertersForRestTemplate() {
|
||||
void registersHalFormsHttpMessageConvertersForRestTemplate() {
|
||||
|
||||
withServletContext( //
|
||||
HalFormsConfig.class, //
|
||||
@@ -394,7 +394,7 @@ public class EnableHypermediaSupportIntegrationTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void registersCollectionJsonHttpMessageConvertersForRestTemplate() {
|
||||
void registersCollectionJsonHttpMessageConvertersForRestTemplate() {
|
||||
|
||||
withServletContext(CollectionJsonConfig.class, context -> {
|
||||
RestTemplate template = context.getBean(RestTemplate.class);
|
||||
@@ -405,7 +405,7 @@ public class EnableHypermediaSupportIntegrationTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void registersUberHttpMessageConvertersForRestTemplate() {
|
||||
void registersUberHttpMessageConvertersForRestTemplate() {
|
||||
|
||||
withServletContext(UberConfig.class, context -> {
|
||||
RestTemplate template = context.getBean(RestTemplate.class);
|
||||
@@ -420,7 +420,7 @@ public class EnableHypermediaSupportIntegrationTest {
|
||||
* @see #341
|
||||
*/
|
||||
@Test
|
||||
public void configuresDefaultObjectMapperForHalToIgnoreUnknownProperties() {
|
||||
void configuresDefaultObjectMapperForHalToIgnoreUnknownProperties() {
|
||||
|
||||
withServletContext( //
|
||||
HalConfig.class, //
|
||||
@@ -437,7 +437,7 @@ public class EnableHypermediaSupportIntegrationTest {
|
||||
* @see #341
|
||||
*/
|
||||
@Test
|
||||
public void configuresDefaultObjectMapperForHalFormsToIgnoreUnknownProperties() {
|
||||
void configuresDefaultObjectMapperForHalFormsToIgnoreUnknownProperties() {
|
||||
|
||||
withServletContext( //
|
||||
HalFormsConfig.class, //
|
||||
@@ -451,7 +451,7 @@ public class EnableHypermediaSupportIntegrationTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void configuresDefaultObjectMapperForCollectionJsonToIgnoreUnknownProperties() {
|
||||
void configuresDefaultObjectMapperForCollectionJsonToIgnoreUnknownProperties() {
|
||||
|
||||
withServletContext( //
|
||||
CollectionJsonConfig.class, //
|
||||
@@ -465,7 +465,7 @@ public class EnableHypermediaSupportIntegrationTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void configuresDefaultObjectMapperForUberToIgnoreUnknownProperties() {
|
||||
void configuresDefaultObjectMapperForUberToIgnoreUnknownProperties() {
|
||||
|
||||
withServletContext( //
|
||||
UberConfig.class, //
|
||||
@@ -479,7 +479,7 @@ public class EnableHypermediaSupportIntegrationTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void verifyDefaultHalConfigurationRendersSingleItemAsSingleItem() throws JsonProcessingException {
|
||||
void verifyDefaultHalConfigurationRendersSingleItemAsSingleItem() throws JsonProcessingException {
|
||||
|
||||
withServletContext(HalConfig.class, context -> {
|
||||
|
||||
@@ -505,7 +505,7 @@ public class EnableHypermediaSupportIntegrationTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void verifyRenderSingleLinkAsArrayViaOverridingBean() {
|
||||
void verifyRenderSingleLinkAsArrayViaOverridingBean() {
|
||||
|
||||
withServletContext( //
|
||||
RenderLinkAsSingleLinksConfig.class, //
|
||||
|
||||
@@ -33,10 +33,10 @@ import org.springframework.hateoas.mediatype.uber.UberLinkDiscoverer;
|
||||
*
|
||||
* @author Greg Turnquist
|
||||
*/
|
||||
public class HypermediaConfigurationImportSelectorUnitTest {
|
||||
class HypermediaConfigurationImportSelectorUnitTest {
|
||||
|
||||
@Test // #833
|
||||
public void testHalImportConfiguration() {
|
||||
void testHalImportConfiguration() {
|
||||
|
||||
withContext(HalConfig.class, context -> {
|
||||
|
||||
@@ -48,7 +48,7 @@ public class HypermediaConfigurationImportSelectorUnitTest {
|
||||
}
|
||||
|
||||
@Test // #833
|
||||
public void testHalFormsImportConfiguration() {
|
||||
void testHalFormsImportConfiguration() {
|
||||
|
||||
withContext(HalFormsConfig.class, context -> {
|
||||
|
||||
@@ -60,7 +60,7 @@ public class HypermediaConfigurationImportSelectorUnitTest {
|
||||
}
|
||||
|
||||
@Test // #833
|
||||
public void testHalAndHalFormsImportConfigurations() {
|
||||
void testHalAndHalFormsImportConfigurations() {
|
||||
|
||||
withContext(HalAndHalFormsConfig.class, context -> {
|
||||
|
||||
@@ -74,7 +74,7 @@ public class HypermediaConfigurationImportSelectorUnitTest {
|
||||
}
|
||||
|
||||
@Test // #833
|
||||
public void testAllImportConfigurations() {
|
||||
void testAllImportConfigurations() {
|
||||
|
||||
withContext(AllConfig.class, context -> {
|
||||
|
||||
|
||||
@@ -39,13 +39,13 @@ import org.springframework.web.client.RestTemplate;
|
||||
*
|
||||
* @author Greg Turnquist
|
||||
*/
|
||||
public class HypermediaRestTemplateBeanPostProcessorTest {
|
||||
class HypermediaRestTemplateBeanPostProcessorTest {
|
||||
|
||||
/**
|
||||
* @see #728
|
||||
*/
|
||||
@Test
|
||||
public void shouldRegisterJustHal() {
|
||||
void shouldRegisterJustHal() {
|
||||
|
||||
withContext(HalConfig.class, context -> {
|
||||
|
||||
@@ -62,7 +62,7 @@ public class HypermediaRestTemplateBeanPostProcessorTest {
|
||||
* @see #728
|
||||
*/
|
||||
@Test
|
||||
public void shouldRegisterHalAndCollectionJsonMessageConverters() {
|
||||
void shouldRegisterHalAndCollectionJsonMessageConverters() {
|
||||
|
||||
withContext(HalAndCollectionJsonConfig.class, context -> {
|
||||
|
||||
@@ -80,7 +80,7 @@ public class HypermediaRestTemplateBeanPostProcessorTest {
|
||||
* @see #728
|
||||
*/
|
||||
@Test
|
||||
public void shouldRegisterHypermediaMessageConverters() {
|
||||
void shouldRegisterHypermediaMessageConverters() {
|
||||
|
||||
withContext(AllHypermediaConfig.class, context -> {
|
||||
|
||||
@@ -97,7 +97,7 @@ public class HypermediaRestTemplateBeanPostProcessorTest {
|
||||
}
|
||||
|
||||
@Test // #833
|
||||
public void shouldRegisterCustomHypermediaMessageConverters() {
|
||||
void shouldRegisterCustomHypermediaMessageConverters() {
|
||||
|
||||
withContext(CustomHypermediaConfig.class, context -> {
|
||||
|
||||
|
||||
@@ -44,13 +44,13 @@ import org.springframework.web.reactive.function.client.WebClient;
|
||||
*
|
||||
* @author Greg Turnquist
|
||||
*/
|
||||
public class HypermediaWebClientBeanPostProcessorTest {
|
||||
class HypermediaWebClientBeanPostProcessorTest {
|
||||
|
||||
private URI baseUri;
|
||||
private Server server;
|
||||
|
||||
@BeforeEach
|
||||
public void setUp() {
|
||||
void setUp() {
|
||||
|
||||
this.server = new Server();
|
||||
|
||||
@@ -68,7 +68,7 @@ public class HypermediaWebClientBeanPostProcessorTest {
|
||||
}
|
||||
|
||||
@AfterEach
|
||||
public void tearDown() {
|
||||
void tearDown() {
|
||||
|
||||
if (this.server != null) {
|
||||
this.server.close();
|
||||
@@ -79,7 +79,7 @@ public class HypermediaWebClientBeanPostProcessorTest {
|
||||
* @see #728
|
||||
*/
|
||||
@Test
|
||||
public void shouldHandleRootHalDocument() {
|
||||
void shouldHandleRootHalDocument() {
|
||||
|
||||
withContext(HalConfig.class, context -> {
|
||||
|
||||
@@ -103,7 +103,7 @@ public class HypermediaWebClientBeanPostProcessorTest {
|
||||
* @see #728
|
||||
*/
|
||||
@Test
|
||||
public void shouldHandleNavigatingToAResourceObject() {
|
||||
void shouldHandleNavigatingToAResourceObject() {
|
||||
|
||||
ParameterizedTypeReference<EntityModel<Actor>> typeReference = new EntityModelType<Actor>() {};
|
||||
|
||||
|
||||
@@ -54,7 +54,7 @@ import org.springframework.web.reactive.config.EnableWebFlux;
|
||||
/**
|
||||
* @author Greg Turnquist
|
||||
*/
|
||||
public class HypermediaWebFluxConfigurerTest {
|
||||
class HypermediaWebFluxConfigurerTest {
|
||||
|
||||
EntityModelType<Employee> resourceEmployeeType = new EntityModelType<Employee>() {};
|
||||
CollectionModelType<EntityModel<Employee>> resourcesEmployeeType = new CollectionModelType<EntityModel<Employee>>() {};
|
||||
@@ -77,7 +77,7 @@ public class HypermediaWebFluxConfigurerTest {
|
||||
* @see #728
|
||||
*/
|
||||
@Test
|
||||
public void registeringHalShouldServeHal() {
|
||||
void registeringHalShouldServeHal() {
|
||||
|
||||
setUp(HalWebFluxConfig.class);
|
||||
|
||||
@@ -93,7 +93,7 @@ public class HypermediaWebFluxConfigurerTest {
|
||||
* @see #728
|
||||
*/
|
||||
@Test
|
||||
public void registeringHalFormsShouldServeHalForms() {
|
||||
void registeringHalFormsShouldServeHalForms() {
|
||||
|
||||
setUp(HalFormsWebFluxConfig.class);
|
||||
|
||||
@@ -109,7 +109,7 @@ public class HypermediaWebFluxConfigurerTest {
|
||||
* @see #728
|
||||
*/
|
||||
@Test
|
||||
public void registeringCollectionJsonShouldServerCollectionJson() {
|
||||
void registeringCollectionJsonShouldServerCollectionJson() {
|
||||
|
||||
setUp(CollectionJsonWebFluxConfig.class);
|
||||
|
||||
@@ -125,7 +125,7 @@ public class HypermediaWebFluxConfigurerTest {
|
||||
* @see #728
|
||||
*/
|
||||
@Test
|
||||
public void registeringUberShouldServerUber() {
|
||||
void registeringUberShouldServerUber() {
|
||||
|
||||
setUp(UberWebFluxConfig.class);
|
||||
|
||||
@@ -141,7 +141,7 @@ public class HypermediaWebFluxConfigurerTest {
|
||||
* @see #728
|
||||
*/
|
||||
@Test
|
||||
public void registeringHalAndHalFormsShouldServerHalAndHalForms() {
|
||||
void registeringHalAndHalFormsShouldServerHalAndHalForms() {
|
||||
|
||||
setUp(AllHalWebFluxConfig.class);
|
||||
|
||||
@@ -158,7 +158,7 @@ public class HypermediaWebFluxConfigurerTest {
|
||||
* @see #728
|
||||
*/
|
||||
@Test
|
||||
public void registeringHalAndHalFormsShouldAllowCreatingViaHalAndHalForms() {
|
||||
void registeringHalAndHalFormsShouldAllowCreatingViaHalAndHalForms() {
|
||||
|
||||
setUp(AllHalWebFluxConfig.class);
|
||||
|
||||
@@ -173,7 +173,7 @@ public class HypermediaWebFluxConfigurerTest {
|
||||
* @see #728
|
||||
*/
|
||||
@Test
|
||||
public void registeringHalAndCollectionJsonShouldServerHalAndCollectionJson() {
|
||||
void registeringHalAndCollectionJsonShouldServerHalAndCollectionJson() {
|
||||
|
||||
setUp(HalAndCollectionJsonWebFluxConfig.class);
|
||||
|
||||
@@ -194,7 +194,7 @@ public class HypermediaWebFluxConfigurerTest {
|
||||
* @see #728
|
||||
*/
|
||||
@Test
|
||||
public void registeringHalAndCollectionJsonShouldAllowCreatingViaHalAndCollectionJson() {
|
||||
void registeringHalAndCollectionJsonShouldAllowCreatingViaHalAndCollectionJson() {
|
||||
|
||||
setUp(HalAndCollectionJsonWebFluxConfig.class);
|
||||
|
||||
@@ -212,7 +212,7 @@ public class HypermediaWebFluxConfigurerTest {
|
||||
* @see #728
|
||||
*/
|
||||
@Test
|
||||
public void registeringAllHypermediaTypesShouldServerThemAll() {
|
||||
void registeringAllHypermediaTypesShouldServerThemAll() {
|
||||
|
||||
setUp(AllHypermediaTypesWebFluxConfig.class);
|
||||
|
||||
@@ -237,7 +237,7 @@ public class HypermediaWebFluxConfigurerTest {
|
||||
* @see #728
|
||||
*/
|
||||
@Test
|
||||
public void registeringAllHypermediaTypesShouldAllowCreatingThroughAllFormats() {
|
||||
void registeringAllHypermediaTypesShouldAllowCreatingThroughAllFormats() {
|
||||
|
||||
setUp(AllHypermediaTypesWebFluxConfig.class);
|
||||
|
||||
@@ -258,7 +258,7 @@ public class HypermediaWebFluxConfigurerTest {
|
||||
* @see #728
|
||||
*/
|
||||
@Test
|
||||
public void callingForUnregisteredMediaTypeShouldFail() {
|
||||
void callingForUnregisteredMediaTypeShouldFail() {
|
||||
|
||||
setUp(HalWebFluxConfig.class);
|
||||
|
||||
@@ -270,7 +270,7 @@ public class HypermediaWebFluxConfigurerTest {
|
||||
* @see #728
|
||||
*/
|
||||
@Test
|
||||
public void reactorTypesShouldWork() {
|
||||
void reactorTypesShouldWork() {
|
||||
|
||||
setUp(HalWebFluxConfig.class);
|
||||
|
||||
|
||||
@@ -28,12 +28,12 @@ import org.springframework.hateoas.support.WebStack;
|
||||
*
|
||||
* @author Oliver Drotbohm
|
||||
*/
|
||||
public class WebStackImportSelectorUnitTest {
|
||||
class WebStackImportSelectorUnitTest {
|
||||
|
||||
WebStackImportSelector selector = new WebStackImportSelector();
|
||||
|
||||
@Test // #973
|
||||
public void activatesAllWebStacksByDefault() {
|
||||
void activatesAllWebStacksByDefault() {
|
||||
|
||||
AnnotationMetadata metadata = new StandardAnnotationMetadata(DefaultHypermedia.class);
|
||||
|
||||
@@ -42,7 +42,7 @@ public class WebStackImportSelectorUnitTest {
|
||||
}
|
||||
|
||||
@Test // #973
|
||||
public void activatesWebMvcOnlyifConfigured() {
|
||||
void activatesWebMvcOnlyifConfigured() {
|
||||
|
||||
AnnotationMetadata metadata = new StandardAnnotationMetadata(WebMvcHypermedia.class);
|
||||
|
||||
@@ -50,7 +50,7 @@ public class WebStackImportSelectorUnitTest {
|
||||
}
|
||||
|
||||
@Test // #973
|
||||
public void activatesWebFluxOnlyIfConfigured() {
|
||||
void activatesWebFluxOnlyIfConfigured() {
|
||||
|
||||
AnnotationMetadata metadata = new StandardAnnotationMetadata(WebFluxHypermedia.class);
|
||||
|
||||
@@ -58,7 +58,7 @@ public class WebStackImportSelectorUnitTest {
|
||||
}
|
||||
|
||||
@Test // #973
|
||||
public void rejectsNoStacksSelected() {
|
||||
void rejectsNoStacksSelected() {
|
||||
|
||||
AnnotationMetadata metadata = new StandardAnnotationMetadata(NoStacksHypermedia.class);
|
||||
|
||||
|
||||
@@ -29,13 +29,13 @@ import org.springframework.hateoas.server.LinkRelationProvider;
|
||||
*
|
||||
* @author Oliver Gierke
|
||||
*/
|
||||
public class XmlConfigurationIntegrationTest {
|
||||
class XmlConfigurationIntegrationTest {
|
||||
|
||||
/**
|
||||
* @see #259
|
||||
*/
|
||||
@Test
|
||||
public void enablesHyperMediaSupportFromXml() {
|
||||
void enablesHyperMediaSupportFromXml() {
|
||||
|
||||
ConfigurableApplicationContext context = new ClassPathXmlApplicationContext("application-context.xml", getClass());
|
||||
|
||||
|
||||
@@ -34,12 +34,12 @@ import org.springframework.util.StreamUtils;
|
||||
* @author Greg Turnquist
|
||||
* @author Oliver Gierke
|
||||
*/
|
||||
public class AlpsLinkDiscoverUnitTest extends LinkDiscovererUnitTest {
|
||||
class AlpsLinkDiscoverUnitTest extends LinkDiscovererUnitTest {
|
||||
|
||||
LinkDiscoverer discoverer = new AlpsLinkDiscoverer();
|
||||
|
||||
@Test
|
||||
public void discoversFullyQualifiedRel() {
|
||||
void discoversFullyQualifiedRel() {
|
||||
|
||||
Optional<Link> link = getDiscoverer().findLinkWithRel("http://www.foo.com/bar", getInputString());
|
||||
|
||||
|
||||
@@ -37,12 +37,12 @@ import com.fasterxml.jackson.databind.SerializationFeature;
|
||||
* @author Oliver Gierke
|
||||
* @author Greg Turnquist
|
||||
*/
|
||||
public class JacksonSerializationTest {
|
||||
class JacksonSerializationTest {
|
||||
|
||||
ObjectMapper mapper;
|
||||
|
||||
@BeforeEach
|
||||
public void setUp() {
|
||||
void setUp() {
|
||||
|
||||
mapper = new ObjectMapper();
|
||||
mapper.setSerializationInclusion(Include.NON_NULL);
|
||||
@@ -53,7 +53,7 @@ public class JacksonSerializationTest {
|
||||
* @see #141
|
||||
*/
|
||||
@Test
|
||||
public void writesSampleDocument() throws Exception {
|
||||
void writesSampleDocument() throws Exception {
|
||||
|
||||
Alps alps = alps().//
|
||||
doc(doc().href("https://example.org/samples/full/doc.html").build()). //
|
||||
|
||||
@@ -33,17 +33,17 @@ import org.springframework.hateoas.support.MappingUtils;
|
||||
* @author Greg Turnquist
|
||||
* @author Oliver Drotbohm
|
||||
*/
|
||||
public class CollectionJsonLinkDiscovererUnitTest {
|
||||
class CollectionJsonLinkDiscovererUnitTest {
|
||||
|
||||
LinkDiscoverer discoverer;
|
||||
|
||||
@BeforeEach
|
||||
public void setUp() {
|
||||
void setUp() {
|
||||
this.discoverer = new CollectionJsonLinkDiscoverer();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void spec1Links() throws IOException {
|
||||
void spec1Links() throws IOException {
|
||||
|
||||
String specBasedJson = MappingUtils.read(new ClassPathResource("spec-part1.json", getClass()));
|
||||
|
||||
@@ -55,7 +55,7 @@ public class CollectionJsonLinkDiscovererUnitTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void spec2Links() throws IOException {
|
||||
void spec2Links() throws IOException {
|
||||
|
||||
String specBasedJson = MappingUtils.read(new ClassPathResource("spec-part2.json", getClass()));
|
||||
|
||||
|
||||
@@ -45,12 +45,12 @@ import com.fasterxml.jackson.databind.SerializationFeature;
|
||||
*
|
||||
* @author Greg Turnquist
|
||||
*/
|
||||
public class CollectionJsonSpecTest {
|
||||
class CollectionJsonSpecTest {
|
||||
|
||||
ObjectMapper mapper;
|
||||
|
||||
@BeforeEach
|
||||
public void setUp() {
|
||||
void setUp() {
|
||||
|
||||
mapper = new ObjectMapper();
|
||||
mapper.disable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES);
|
||||
@@ -63,7 +63,7 @@ public class CollectionJsonSpecTest {
|
||||
* @throws IOException
|
||||
*/
|
||||
@Test
|
||||
public void specPart1() throws IOException {
|
||||
void specPart1() throws IOException {
|
||||
|
||||
String specBasedJson = MappingUtils.read(new ClassPathResource("spec-part1.json", getClass()));
|
||||
|
||||
@@ -78,7 +78,7 @@ public class CollectionJsonSpecTest {
|
||||
* @throws IOException
|
||||
*/
|
||||
@Test
|
||||
public void specPart2() throws IOException {
|
||||
void specPart2() throws IOException {
|
||||
|
||||
String specBasedJson = MappingUtils.read(new ClassPathResource("spec-part2.json", getClass()));
|
||||
|
||||
@@ -124,7 +124,7 @@ public class CollectionJsonSpecTest {
|
||||
* @throws IOException
|
||||
*/
|
||||
@Test
|
||||
public void specPart3() throws IOException {
|
||||
void specPart3() throws IOException {
|
||||
|
||||
String specBasedJson = MappingUtils.read(new ClassPathResource("spec-part3.json", getClass()));
|
||||
|
||||
@@ -150,7 +150,7 @@ public class CollectionJsonSpecTest {
|
||||
* @throws IOException
|
||||
*/
|
||||
@Test
|
||||
public void specPart4() throws IOException {
|
||||
void specPart4() throws IOException {
|
||||
|
||||
String specBasedJson = MappingUtils.read(new ClassPathResource("spec-part4.json", getClass()));
|
||||
|
||||
@@ -168,7 +168,7 @@ public class CollectionJsonSpecTest {
|
||||
* @throws IOException
|
||||
*/
|
||||
@Test
|
||||
public void specPart5() throws IOException {
|
||||
void specPart5() throws IOException {
|
||||
|
||||
String specBasedJson = MappingUtils.read(new ClassPathResource("spec-part5.json", getClass()));
|
||||
|
||||
@@ -186,7 +186,7 @@ public class CollectionJsonSpecTest {
|
||||
* @throws IOException
|
||||
*/
|
||||
@Test
|
||||
public void specPart6() throws IOException {
|
||||
void specPart6() throws IOException {
|
||||
|
||||
String specBasedJson = MappingUtils.read(new ClassPathResource("spec-part6.json", getClass()));
|
||||
|
||||
@@ -204,7 +204,7 @@ public class CollectionJsonSpecTest {
|
||||
* @throws IOException
|
||||
*/
|
||||
@Test
|
||||
public void specPart7() throws IOException {
|
||||
void specPart7() throws IOException {
|
||||
|
||||
String specBasedJson = MappingUtils.read(new ClassPathResource("spec-part7-adjusted.json", getClass()));
|
||||
|
||||
|
||||
@@ -46,12 +46,12 @@ import org.springframework.web.reactive.config.EnableWebFlux;
|
||||
@ExtendWith(SpringExtension.class)
|
||||
@WebAppConfiguration
|
||||
@ContextConfiguration
|
||||
public class CollectionJsonWebFluxIntegrationTest {
|
||||
class CollectionJsonWebFluxIntegrationTest {
|
||||
|
||||
@Autowired WebTestClient testClient;
|
||||
|
||||
@BeforeEach
|
||||
public void setUp() {
|
||||
void setUp() {
|
||||
WebFluxEmployeeController.reset();
|
||||
}
|
||||
|
||||
@@ -59,7 +59,7 @@ public class CollectionJsonWebFluxIntegrationTest {
|
||||
* @see #728
|
||||
*/
|
||||
@Test
|
||||
public void singleEmployee() {
|
||||
void singleEmployee() {
|
||||
|
||||
this.testClient.get().uri("http://localhost/employees/0")
|
||||
.accept(MediaTypes.COLLECTION_JSON)
|
||||
@@ -94,7 +94,7 @@ public class CollectionJsonWebFluxIntegrationTest {
|
||||
* @see #728
|
||||
*/
|
||||
@Test
|
||||
public void collectionOfEmployees() {
|
||||
void collectionOfEmployees() {
|
||||
|
||||
this.testClient.get().uri("http://localhost/employees")
|
||||
.accept(MediaTypes.COLLECTION_JSON)
|
||||
@@ -136,7 +136,7 @@ public class CollectionJsonWebFluxIntegrationTest {
|
||||
* @see #728
|
||||
*/
|
||||
@Test
|
||||
public void createNewEmployee() throws Exception {
|
||||
void createNewEmployee() throws Exception {
|
||||
|
||||
String specBasedJson = read(new ClassPathResource("spec-part7-adjusted.json", getClass()));
|
||||
|
||||
|
||||
@@ -68,21 +68,21 @@ import org.springframework.web.servlet.config.annotation.EnableWebMvc;
|
||||
@ExtendWith(SpringExtension.class)
|
||||
@WebAppConfiguration
|
||||
@ContextConfiguration
|
||||
public class CollectionJsonWebMvcIntegrationTest {
|
||||
class CollectionJsonWebMvcIntegrationTest {
|
||||
|
||||
@Autowired WebApplicationContext context;
|
||||
|
||||
MockMvc mockMvc;
|
||||
|
||||
@BeforeEach
|
||||
public void setUp() {
|
||||
void setUp() {
|
||||
|
||||
this.mockMvc = webAppContextSetup(this.context).build();
|
||||
WebMvcEmployeeController.reset();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void singleEmployee() throws Exception {
|
||||
void singleEmployee() throws Exception {
|
||||
|
||||
this.mockMvc.perform(get("/employees/0") //
|
||||
.accept(MediaTypes.COLLECTION_JSON_VALUE)) //
|
||||
@@ -113,7 +113,7 @@ public class CollectionJsonWebMvcIntegrationTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void collectionOfEmployees() throws Exception {
|
||||
void collectionOfEmployees() throws Exception {
|
||||
|
||||
this.mockMvc.perform(get("/employees") //
|
||||
.accept(MediaTypes.COLLECTION_JSON_VALUE)) //
|
||||
@@ -149,7 +149,7 @@ public class CollectionJsonWebMvcIntegrationTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void createNewEmployee() throws Exception {
|
||||
void createNewEmployee() throws Exception {
|
||||
|
||||
String specBasedJson = MappingUtils.read(new ClassPathResource("spec-part7-adjusted.json", getClass()));
|
||||
|
||||
|
||||
@@ -47,7 +47,7 @@ import com.fasterxml.jackson.databind.SerializationFeature;
|
||||
* @author Greg Turnquist
|
||||
* @author Oliver Drotbohm
|
||||
*/
|
||||
public class Jackson2CollectionJsonIntegrationTest extends AbstractJackson2MarshallingIntegrationTest {
|
||||
class Jackson2CollectionJsonIntegrationTest extends AbstractJackson2MarshallingIntegrationTest {
|
||||
|
||||
static final Links PAGINATION_LINKS = Links.of( //
|
||||
new Link("localhost", IanaLinkRelations.SELF), //
|
||||
@@ -55,14 +55,14 @@ public class Jackson2CollectionJsonIntegrationTest extends AbstractJackson2Marsh
|
||||
new Link("bar", IanaLinkRelations.PREV));
|
||||
|
||||
@BeforeEach
|
||||
public void setUpModule() {
|
||||
void setUpModule() {
|
||||
|
||||
mapper.registerModule(new Jackson2CollectionJsonModule());
|
||||
mapper.configure(SerializationFeature.INDENT_OUTPUT, true);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void rendersSingleLinkAsObject() throws Exception {
|
||||
void rendersSingleLinkAsObject() throws Exception {
|
||||
|
||||
RepresentationModel<?> resourceSupport = new RepresentationModel<>();
|
||||
resourceSupport.add(new Link("localhost").withSelfRel());
|
||||
@@ -72,7 +72,7 @@ public class Jackson2CollectionJsonIntegrationTest extends AbstractJackson2Marsh
|
||||
}
|
||||
|
||||
@Test
|
||||
public void deserializeSingleLink() throws Exception {
|
||||
void deserializeSingleLink() throws Exception {
|
||||
|
||||
RepresentationModel<?> expected = new RepresentationModel<>();
|
||||
expected.add(new Link("localhost"));
|
||||
@@ -83,7 +83,7 @@ public class Jackson2CollectionJsonIntegrationTest extends AbstractJackson2Marsh
|
||||
}
|
||||
|
||||
@Test
|
||||
public void rendersMultipleLinkAsArray() throws Exception {
|
||||
void rendersMultipleLinkAsArray() throws Exception {
|
||||
|
||||
RepresentationModel<?> resourceSupport = new RepresentationModel<>();
|
||||
resourceSupport.add(new Link("localhost"));
|
||||
@@ -94,7 +94,7 @@ public class Jackson2CollectionJsonIntegrationTest extends AbstractJackson2Marsh
|
||||
}
|
||||
|
||||
@Test
|
||||
public void rendersResourceSupportBasedObject() throws Exception {
|
||||
void rendersResourceSupportBasedObject() throws Exception {
|
||||
|
||||
ResourceWithAttributes resource = new ResourceWithAttributes("test value");
|
||||
resource.add(new Link("localhost").withSelfRel());
|
||||
@@ -104,7 +104,7 @@ public class Jackson2CollectionJsonIntegrationTest extends AbstractJackson2Marsh
|
||||
}
|
||||
|
||||
@Test
|
||||
public void deserializeResourceSupportBasedObject() throws Exception {
|
||||
void deserializeResourceSupportBasedObject() throws Exception {
|
||||
|
||||
ResourceWithAttributes expected = new ResourceWithAttributes("test value");
|
||||
expected.add(new Link("localhost").withSelfRel());
|
||||
@@ -114,7 +114,7 @@ public class Jackson2CollectionJsonIntegrationTest extends AbstractJackson2Marsh
|
||||
}
|
||||
|
||||
@Test
|
||||
public void deserializeMultipleLinks() throws Exception {
|
||||
void deserializeMultipleLinks() throws Exception {
|
||||
|
||||
RepresentationModel<?> expected = new RepresentationModel<>();
|
||||
expected.add(new Link("localhost"));
|
||||
@@ -127,7 +127,7 @@ public class Jackson2CollectionJsonIntegrationTest extends AbstractJackson2Marsh
|
||||
}
|
||||
|
||||
@Test
|
||||
public void rendersSimpleResourcesAsEmbedded() throws Exception {
|
||||
void rendersSimpleResourcesAsEmbedded() throws Exception {
|
||||
|
||||
List<String> content = new ArrayList<>();
|
||||
content.add("first");
|
||||
@@ -140,7 +140,7 @@ public class Jackson2CollectionJsonIntegrationTest extends AbstractJackson2Marsh
|
||||
}
|
||||
|
||||
@Test
|
||||
public void deserializesSimpleResourcesAsEmbedded() throws Exception {
|
||||
void deserializesSimpleResourcesAsEmbedded() throws Exception {
|
||||
|
||||
List<String> content = new ArrayList<>();
|
||||
content.add("first");
|
||||
@@ -157,7 +157,7 @@ public class Jackson2CollectionJsonIntegrationTest extends AbstractJackson2Marsh
|
||||
}
|
||||
|
||||
@Test
|
||||
public void renderResource() throws Exception {
|
||||
void renderResource() throws Exception {
|
||||
|
||||
EntityModel<String> data = new EntityModel<>("first", new Link("localhost"));
|
||||
|
||||
@@ -165,7 +165,7 @@ public class Jackson2CollectionJsonIntegrationTest extends AbstractJackson2Marsh
|
||||
}
|
||||
|
||||
@Test
|
||||
public void deserializeResource() throws Exception {
|
||||
void deserializeResource() throws Exception {
|
||||
|
||||
EntityModel<?> expected = new EntityModel<>("first", new Link("localhost"));
|
||||
|
||||
@@ -177,7 +177,7 @@ public class Jackson2CollectionJsonIntegrationTest extends AbstractJackson2Marsh
|
||||
}
|
||||
|
||||
@Test
|
||||
public void renderComplexStructure() throws Exception {
|
||||
void renderComplexStructure() throws Exception {
|
||||
|
||||
List<EntityModel<String>> data = new ArrayList<>();
|
||||
data.add(new EntityModel<>("first", new Link("localhost"), new Link("orders").withRel("orders")));
|
||||
@@ -193,7 +193,7 @@ public class Jackson2CollectionJsonIntegrationTest extends AbstractJackson2Marsh
|
||||
}
|
||||
|
||||
@Test
|
||||
public void deserializeResources() throws Exception {
|
||||
void deserializeResources() throws Exception {
|
||||
|
||||
List<EntityModel<String>> data = new ArrayList<>();
|
||||
data.add(new EntityModel<>("first", new Link("localhost"), new Link("orders").withRel("orders")));
|
||||
@@ -213,7 +213,7 @@ public class Jackson2CollectionJsonIntegrationTest extends AbstractJackson2Marsh
|
||||
}
|
||||
|
||||
@Test
|
||||
public void renderSimplePojos() throws Exception {
|
||||
void renderSimplePojos() throws Exception {
|
||||
|
||||
List<EntityModel<SimplePojo>> data = new ArrayList<>();
|
||||
data.add(new EntityModel<>(new SimplePojo("text", 1), new Link("localhost"),
|
||||
@@ -230,14 +230,14 @@ public class Jackson2CollectionJsonIntegrationTest extends AbstractJackson2Marsh
|
||||
}
|
||||
|
||||
@Test
|
||||
public void serializesPagedResource() throws Exception {
|
||||
void serializesPagedResource() throws Exception {
|
||||
|
||||
String actual = write(setupAnnotatedPagedResources());
|
||||
assertThat(actual).isEqualTo(MappingUtils.read(new ClassPathResource("paged-resources.json", getClass())));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void deserializesPagedResource() throws Exception {
|
||||
void deserializesPagedResource() throws Exception {
|
||||
|
||||
PagedModel<EntityModel<SimplePojo>> result = mapper.readValue(
|
||||
MappingUtils.read(new ClassPathResource("paged-resources.json", getClass())),
|
||||
|
||||
@@ -33,12 +33,12 @@ import com.fasterxml.jackson.databind.SerializationFeature;
|
||||
/**
|
||||
* @author Greg Turnquist
|
||||
*/
|
||||
public class JacksonSerializationTest {
|
||||
class JacksonSerializationTest {
|
||||
|
||||
ObjectMapper mapper;
|
||||
|
||||
@BeforeEach
|
||||
public void setUp() {
|
||||
void setUp() {
|
||||
|
||||
mapper = new ObjectMapper();
|
||||
mapper.registerModule(new Jackson2CollectionJsonModule());
|
||||
@@ -46,7 +46,7 @@ public class JacksonSerializationTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void createSimpleCollection() throws IOException {
|
||||
void createSimpleCollection() throws IOException {
|
||||
|
||||
CollectionJson<?> collection = new CollectionJson<>().withVersion("1.0").withHref("localhost")
|
||||
.withLinks(Links.of(new Link("foo").withSelfRel())) //
|
||||
|
||||
@@ -38,7 +38,7 @@ import org.springframework.web.context.request.ServletRequestAttributes;
|
||||
* @author Oliver Gierke
|
||||
* @author Greg Turnquist
|
||||
*/
|
||||
public class DefaultCurieProviderUnitTest {
|
||||
class DefaultCurieProviderUnitTest {
|
||||
|
||||
private static final UriTemplate URI_TEMPLATE = UriTemplate.of("http://localhost:8080/rels/{rel}");
|
||||
|
||||
@@ -46,7 +46,7 @@ public class DefaultCurieProviderUnitTest {
|
||||
|
||||
@SuppressWarnings("null")
|
||||
@Test
|
||||
public void preventsNullCurieName() {
|
||||
void preventsNullCurieName() {
|
||||
|
||||
assertThatIllegalArgumentException().isThrownBy(() -> {
|
||||
new DefaultCurieProvider(null, URI_TEMPLATE);
|
||||
@@ -54,7 +54,7 @@ public class DefaultCurieProviderUnitTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void preventsEmptyCurieName() {
|
||||
void preventsEmptyCurieName() {
|
||||
|
||||
assertThatIllegalArgumentException().isThrownBy(() -> {
|
||||
new DefaultCurieProvider("", URI_TEMPLATE);
|
||||
@@ -63,7 +63,7 @@ public class DefaultCurieProviderUnitTest {
|
||||
|
||||
@SuppressWarnings("null")
|
||||
@Test
|
||||
public void preventsNullUriTemplateName() {
|
||||
void preventsNullUriTemplateName() {
|
||||
|
||||
assertThatIllegalArgumentException().isThrownBy(() -> {
|
||||
new DefaultCurieProvider("acme", null);
|
||||
@@ -71,7 +71,7 @@ public class DefaultCurieProviderUnitTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void preventsUriTemplateWithoutVariable() {
|
||||
void preventsUriTemplateWithoutVariable() {
|
||||
|
||||
assertThatIllegalArgumentException().isThrownBy(() -> {
|
||||
new DefaultCurieProvider("acme", UriTemplate.of("http://localhost:8080/rels"));
|
||||
@@ -79,7 +79,7 @@ public class DefaultCurieProviderUnitTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void preventsUriTemplateWithMoreThanOneVariable() {
|
||||
void preventsUriTemplateWithMoreThanOneVariable() {
|
||||
|
||||
assertThatIllegalArgumentException().isThrownBy(() -> {
|
||||
new DefaultCurieProvider("acme", UriTemplate.of("http://localhost:8080/rels/{rel}/{another}"));
|
||||
@@ -87,21 +87,21 @@ public class DefaultCurieProviderUnitTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void doesNotPrefixIanaRels() {
|
||||
void doesNotPrefixIanaRels() {
|
||||
|
||||
assertThat(provider.getNamespacedRelFrom(new Link("https://amazon.com"))) //
|
||||
.isEqualTo(HalLinkRelation.of(IanaLinkRelations.SELF));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void prefixesNormalRels() {
|
||||
void prefixesNormalRels() {
|
||||
|
||||
assertThat(provider.getNamespacedRelFrom(new Link("https://amazon.com", "book"))) //
|
||||
.isEqualTo(HalLinkRelation.curied("acme", "book"));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void doesNotPrefixQualifiedRels() {
|
||||
void doesNotPrefixQualifiedRels() {
|
||||
|
||||
assertThat(provider.getNamespacedRelFrom(new Link("https://amazon.com", "custom:rel")))
|
||||
.isEqualTo(HalLinkRelation.curied("custom", "rel"));
|
||||
@@ -111,7 +111,7 @@ public class DefaultCurieProviderUnitTest {
|
||||
* @see #100
|
||||
*/
|
||||
@Test
|
||||
public void prefixesNormalRelsThatHaveExtraRFC5988Attributes() {
|
||||
void prefixesNormalRelsThatHaveExtraRFC5988Attributes() {
|
||||
|
||||
Link link = new Link("https://amazon.com", "custom:rel") //
|
||||
.withHreflang("en") //
|
||||
@@ -128,7 +128,7 @@ public class DefaultCurieProviderUnitTest {
|
||||
* @see #229
|
||||
*/
|
||||
@Test
|
||||
public void doesNotPrefixIanaRelsForRelAsString() {
|
||||
void doesNotPrefixIanaRelsForRelAsString() {
|
||||
|
||||
assertThat(provider.getNamespacedRelFor(IanaLinkRelations.SELF)) //
|
||||
.isEqualTo(HalLinkRelation.uncuried("self"));
|
||||
@@ -138,7 +138,7 @@ public class DefaultCurieProviderUnitTest {
|
||||
* @see #229
|
||||
*/
|
||||
@Test
|
||||
public void prefixesNormalRelsForRelAsString() {
|
||||
void prefixesNormalRelsForRelAsString() {
|
||||
|
||||
assertThat(provider.getNamespacedRelFor(LinkRelation.of("book"))) //
|
||||
.isEqualTo(HalLinkRelation.curied("acme", "book"));
|
||||
@@ -148,7 +148,7 @@ public class DefaultCurieProviderUnitTest {
|
||||
* @see #229
|
||||
*/
|
||||
@Test
|
||||
public void doesNotPrefixQualifiedRelsForRelAsString() {
|
||||
void doesNotPrefixQualifiedRelsForRelAsString() {
|
||||
|
||||
assertThat(provider.getNamespacedRelFor(HalLinkRelation.curied("custom", "rel")))
|
||||
.isEqualTo(HalLinkRelation.curied("custom", "rel"));
|
||||
@@ -158,7 +158,7 @@ public class DefaultCurieProviderUnitTest {
|
||||
* @see #363
|
||||
*/
|
||||
@Test
|
||||
public void configuresMultipleCuriesWithoutDefaultCorrectly() {
|
||||
void configuresMultipleCuriesWithoutDefaultCorrectly() {
|
||||
|
||||
DefaultCurieProvider provider = new DefaultCurieProvider(getCuries());
|
||||
|
||||
@@ -170,7 +170,7 @@ public class DefaultCurieProviderUnitTest {
|
||||
* @see #363
|
||||
*/
|
||||
@Test
|
||||
public void configuresMultipleCuriesWithDefaultCorrectly() {
|
||||
void configuresMultipleCuriesWithDefaultCorrectly() {
|
||||
|
||||
DefaultCurieProvider provider = new DefaultCurieProvider(getCuries(), "foo");
|
||||
|
||||
@@ -183,7 +183,7 @@ public class DefaultCurieProviderUnitTest {
|
||||
* #421
|
||||
*/
|
||||
@Test
|
||||
public void expandsNonAbsoluteUriWithApplicationUri() {
|
||||
void expandsNonAbsoluteUriWithApplicationUri() {
|
||||
|
||||
DefaultCurieProvider provider = new DefaultCurieProvider("name", UriTemplate.of("/docs/{rel}"));
|
||||
|
||||
|
||||
@@ -27,10 +27,10 @@ import org.springframework.hateoas.mediatype.hal.HalConfiguration.RenderSingleLi
|
||||
* @author Oliver Drotbohm
|
||||
* @soundtrack Port Cities - Montreal (Single)
|
||||
*/
|
||||
public class HalConfigurationUnitTest {
|
||||
class HalConfigurationUnitTest {
|
||||
|
||||
@Test // #811
|
||||
public void registersSimpleArrayLinksPattern() {
|
||||
void registersSimpleArrayLinksPattern() {
|
||||
|
||||
HalConfiguration configuration = new HalConfiguration().withRenderSingleLinksFor("foo", RenderSingleLinks.AS_ARRAY);
|
||||
|
||||
@@ -39,7 +39,7 @@ public class HalConfigurationUnitTest {
|
||||
}
|
||||
|
||||
@Test // #811
|
||||
public void registersWildcardedArrayLinksPattern() {
|
||||
void registersWildcardedArrayLinksPattern() {
|
||||
|
||||
HalConfiguration configuration = new HalConfiguration().withRenderSingleLinksFor("foo*",
|
||||
RenderSingleLinks.AS_ARRAY);
|
||||
@@ -51,7 +51,7 @@ public class HalConfigurationUnitTest {
|
||||
}
|
||||
|
||||
@Test // #811
|
||||
public void registersWildcardedArrayLinksPatternForUri() {
|
||||
void registersWildcardedArrayLinksPatternForUri() {
|
||||
|
||||
HalConfiguration configuration = new HalConfiguration().withRenderSingleLinksFor("https://somehost/foo/**",
|
||||
RenderSingleLinks.AS_ARRAY);
|
||||
|
||||
@@ -37,19 +37,19 @@ import org.springframework.hateoas.server.core.EvoInflectorLinkRelationProvider;
|
||||
* @author Oliver Gierke
|
||||
* @author Dietrich Schulten
|
||||
*/
|
||||
public class HalEmbeddedBuilderUnitTest {
|
||||
class HalEmbeddedBuilderUnitTest {
|
||||
|
||||
LinkRelationProvider provider;
|
||||
CurieProvider curieProvider;
|
||||
|
||||
@BeforeEach
|
||||
public void setUp() {
|
||||
void setUp() {
|
||||
provider = new EvoInflectorLinkRelationProvider();
|
||||
curieProvider = new DefaultCurieProvider("curie", UriTemplate.of("http://localhost/{rel}"));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void rendersSingleElementsWithSingleEntityRel() {
|
||||
void rendersSingleElementsWithSingleEntityRel() {
|
||||
|
||||
Map<HalLinkRelation, Object> map = setUpBuilder(CurieProvider.NONE, "foo", 1L);
|
||||
|
||||
@@ -58,7 +58,7 @@ public class HalEmbeddedBuilderUnitTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void rendersMultipleElementsWithCollectionResourceRel() {
|
||||
void rendersMultipleElementsWithCollectionResourceRel() {
|
||||
|
||||
Map<HalLinkRelation, Object> map = setUpBuilder(CurieProvider.NONE, "foo", "bar", 1L);
|
||||
|
||||
@@ -71,7 +71,7 @@ public class HalEmbeddedBuilderUnitTest {
|
||||
* @see #110
|
||||
*/
|
||||
@Test
|
||||
public void correctlyPilesUpResourcesInCollectionRel() {
|
||||
void correctlyPilesUpResourcesInCollectionRel() {
|
||||
|
||||
Map<HalLinkRelation, Object> map = setUpBuilder(CurieProvider.NONE, "foo", "bar", "foobar", 1L);
|
||||
|
||||
@@ -84,7 +84,7 @@ public class HalEmbeddedBuilderUnitTest {
|
||||
* @see #135
|
||||
*/
|
||||
@Test
|
||||
public void forcesCollectionRelToBeUsedIfConfigured() {
|
||||
void forcesCollectionRelToBeUsedIfConfigured() {
|
||||
|
||||
HalEmbeddedBuilder builder = new HalEmbeddedBuilder(provider, CurieProvider.NONE, true);
|
||||
builder.add("Sample");
|
||||
@@ -97,7 +97,7 @@ public class HalEmbeddedBuilderUnitTest {
|
||||
* @see #195
|
||||
*/
|
||||
@Test
|
||||
public void doesNotPreferCollectionsIfRelAwareWasAdded() {
|
||||
void doesNotPreferCollectionsIfRelAwareWasAdded() {
|
||||
|
||||
EmbeddedWrappers wrappers = new EmbeddedWrappers(false);
|
||||
|
||||
@@ -112,7 +112,7 @@ public class HalEmbeddedBuilderUnitTest {
|
||||
*/
|
||||
@Test
|
||||
@SuppressWarnings("null")
|
||||
public void rejectsNullRelProvider() {
|
||||
void rejectsNullRelProvider() {
|
||||
|
||||
assertThatIllegalArgumentException().isThrownBy(() -> {
|
||||
new HalEmbeddedBuilder(null, CurieProvider.NONE, false);
|
||||
@@ -123,7 +123,7 @@ public class HalEmbeddedBuilderUnitTest {
|
||||
* @see #229
|
||||
*/
|
||||
@Test
|
||||
public void rendersSingleElementsWithSingleEntityRelWithCurieProvider() {
|
||||
void rendersSingleElementsWithSingleEntityRelWithCurieProvider() {
|
||||
|
||||
Map<HalLinkRelation, Object> map = setUpBuilder(curieProvider, "foo", 1L);
|
||||
|
||||
@@ -135,7 +135,7 @@ public class HalEmbeddedBuilderUnitTest {
|
||||
* @see #229
|
||||
*/
|
||||
@Test
|
||||
public void rendersMultipleElementsWithCollectionResourceRelWithCurieProvider() {
|
||||
void rendersMultipleElementsWithCollectionResourceRelWithCurieProvider() {
|
||||
|
||||
Map<HalLinkRelation, Object> map = setUpBuilder(curieProvider, "foo", "bar", 1L);
|
||||
|
||||
@@ -148,7 +148,7 @@ public class HalEmbeddedBuilderUnitTest {
|
||||
* @see #229
|
||||
*/
|
||||
@Test
|
||||
public void correctlyPilesUpResourcesInCollectionRelWithCurieprovider() {
|
||||
void correctlyPilesUpResourcesInCollectionRelWithCurieprovider() {
|
||||
|
||||
Map<HalLinkRelation, Object> map = setUpBuilder(curieProvider, "foo", "bar", "foobar", 1L);
|
||||
|
||||
@@ -161,7 +161,7 @@ public class HalEmbeddedBuilderUnitTest {
|
||||
* @see #229
|
||||
*/
|
||||
@Test
|
||||
public void forcesCollectionRelToBeUsedIfConfiguredWithCurieProvider() {
|
||||
void forcesCollectionRelToBeUsedIfConfiguredWithCurieProvider() {
|
||||
|
||||
HalEmbeddedBuilder builder = new HalEmbeddedBuilder(provider, curieProvider, true);
|
||||
builder.add("Sample");
|
||||
@@ -174,7 +174,7 @@ public class HalEmbeddedBuilderUnitTest {
|
||||
* @see #286
|
||||
*/
|
||||
@Test
|
||||
public void rejectsInvalidEmbeddedWrapper() {
|
||||
void rejectsInvalidEmbeddedWrapper() {
|
||||
|
||||
HalEmbeddedBuilder builder = new HalEmbeddedBuilder(provider, curieProvider, false);
|
||||
|
||||
|
||||
@@ -34,7 +34,7 @@ import org.springframework.hateoas.client.LinkDiscovererUnitTest;
|
||||
* @author Oliver Gierke
|
||||
* @author Greg Turnquist
|
||||
*/
|
||||
public class HalLinkDiscovererUnitTest extends LinkDiscovererUnitTest {
|
||||
class HalLinkDiscovererUnitTest extends LinkDiscovererUnitTest {
|
||||
|
||||
static final LinkDiscoverer discoverer = new HalLinkDiscoverer();
|
||||
|
||||
@@ -42,7 +42,7 @@ public class HalLinkDiscovererUnitTest extends LinkDiscovererUnitTest {
|
||||
* @see #314
|
||||
*/
|
||||
@Test
|
||||
public void discoversFullyQualifiedRel() {
|
||||
void discoversFullyQualifiedRel() {
|
||||
|
||||
assertThat(getDiscoverer().findLinkWithRel("http://www.foo.com/bar", getInputString())) //
|
||||
.map(Link::getHref) //
|
||||
@@ -53,7 +53,7 @@ public class HalLinkDiscovererUnitTest extends LinkDiscovererUnitTest {
|
||||
* @see #787
|
||||
*/
|
||||
@Test
|
||||
public void discoversAllTheLinkAttributes() throws IOException {
|
||||
void discoversAllTheLinkAttributes() throws IOException {
|
||||
|
||||
String linkText = read(new ClassPathResource("hal-link.json", getClass()));
|
||||
|
||||
@@ -75,7 +75,7 @@ public class HalLinkDiscovererUnitTest extends LinkDiscovererUnitTest {
|
||||
* @see #470
|
||||
*/
|
||||
@Test
|
||||
public void supportsHalUtf8() {
|
||||
void supportsHalUtf8() {
|
||||
assertThat(getDiscoverer().supports(MediaTypes.HAL_JSON_UTF8)).isTrue();
|
||||
}
|
||||
|
||||
|
||||
@@ -27,10 +27,10 @@ import org.springframework.hateoas.mediatype.hal.HalLinkRelation.HalLinkRelation
|
||||
*
|
||||
* @author Oliver Drotbohm
|
||||
*/
|
||||
public class HalLinkRelationUnitTest {
|
||||
class HalLinkRelationUnitTest {
|
||||
|
||||
@Test // #841
|
||||
public void createsCuriedLinkRelation() {
|
||||
void createsCuriedLinkRelation() {
|
||||
|
||||
HalLinkRelation relation = HalLinkRelation.curied("curie", "relation");
|
||||
|
||||
@@ -39,7 +39,7 @@ public class HalLinkRelationUnitTest {
|
||||
}
|
||||
|
||||
@Test // #841
|
||||
public void curieBuilderCreatesLinkRelations() {
|
||||
void curieBuilderCreatesLinkRelations() {
|
||||
|
||||
HalLinkRelationBuilder builder = HalLinkRelation.curieBuilder("curie");
|
||||
|
||||
@@ -47,7 +47,7 @@ public class HalLinkRelationUnitTest {
|
||||
}
|
||||
|
||||
@Test // #841
|
||||
public void parsesCuriedLinkRelation() {
|
||||
void parsesCuriedLinkRelation() {
|
||||
|
||||
HalLinkRelation relation = HalLinkRelation.of(LinkRelation.of("already:curied"));
|
||||
|
||||
@@ -56,7 +56,7 @@ public class HalLinkRelationUnitTest {
|
||||
}
|
||||
|
||||
@Test // #841
|
||||
public void parsesUncuriedLinkRelation() {
|
||||
void parsesUncuriedLinkRelation() {
|
||||
|
||||
HalLinkRelation relation = HalLinkRelation.of(LinkRelation.of("uncuried"));
|
||||
|
||||
@@ -65,7 +65,7 @@ public class HalLinkRelationUnitTest {
|
||||
}
|
||||
|
||||
@Test // 841
|
||||
public void returnsHalLinkRelationOnCreation() {
|
||||
void returnsHalLinkRelationOnCreation() {
|
||||
|
||||
HalLinkRelation relation = HalLinkRelation.curied("curie", "relation");
|
||||
|
||||
@@ -73,7 +73,7 @@ public class HalLinkRelationUnitTest {
|
||||
}
|
||||
|
||||
@Test // 841
|
||||
public void curiesLinkRelation() {
|
||||
void curiesLinkRelation() {
|
||||
|
||||
HalLinkRelation relation = HalLinkRelation.of(LinkRelation.of("relation"));
|
||||
|
||||
@@ -84,7 +84,7 @@ public class HalLinkRelationUnitTest {
|
||||
}
|
||||
|
||||
@Test // 841
|
||||
public void skipsCurieIfAlreadyCuried() {
|
||||
void skipsCurieIfAlreadyCuried() {
|
||||
|
||||
HalLinkRelation relation = HalLinkRelation.curied("curie", "relation");
|
||||
|
||||
@@ -92,7 +92,7 @@ public class HalLinkRelationUnitTest {
|
||||
}
|
||||
|
||||
@Test // #841
|
||||
public void skipsCurieForIanaLinkRelation() {
|
||||
void skipsCurieForIanaLinkRelation() {
|
||||
|
||||
HalLinkRelation relation = HalLinkRelation.of(IanaLinkRelations.SELF).curieIfUncuried("curie");
|
||||
|
||||
@@ -100,7 +100,7 @@ public class HalLinkRelationUnitTest {
|
||||
}
|
||||
|
||||
@Test // #841
|
||||
public void exposesValueAndLocalPartAsMessageCode() {
|
||||
void exposesValueAndLocalPartAsMessageCode() {
|
||||
|
||||
HalLinkRelation relation = HalLinkRelation.curied("curie", "relation");
|
||||
|
||||
|
||||
@@ -83,7 +83,7 @@ public class Jackson2HalIntegrationTest extends AbstractJackson2MarshallingInteg
|
||||
MessageSource messageSource = mock(MessageSource.class);
|
||||
|
||||
@BeforeEach
|
||||
public void setUpModule() {
|
||||
void setUpModule() {
|
||||
|
||||
MessageSourceAccessor accessor = new MessageSourceAccessor(messageSource);
|
||||
LinkRelationProvider provider = new DelegatingLinkRelationProvider(new AnnotationLinkRelationProvider(),
|
||||
@@ -98,7 +98,7 @@ public class Jackson2HalIntegrationTest extends AbstractJackson2MarshallingInteg
|
||||
* @see #29
|
||||
*/
|
||||
@Test
|
||||
public void rendersSingleLinkAsObject() throws Exception {
|
||||
void rendersSingleLinkAsObject() throws Exception {
|
||||
|
||||
RepresentationModel<?> resourceSupport = new RepresentationModel<>();
|
||||
resourceSupport.add(new Link("localhost"));
|
||||
@@ -110,7 +110,7 @@ public class Jackson2HalIntegrationTest extends AbstractJackson2MarshallingInteg
|
||||
* @see #100
|
||||
*/
|
||||
@Test
|
||||
public void rendersAllExtraRFC5988Attributes() throws Exception {
|
||||
void rendersAllExtraRFC5988Attributes() throws Exception {
|
||||
|
||||
RepresentationModel<?> resourceSupport = new RepresentationModel<>();
|
||||
resourceSupport.add(new Link("localhost", "self") //
|
||||
@@ -129,7 +129,7 @@ public class Jackson2HalIntegrationTest extends AbstractJackson2MarshallingInteg
|
||||
* @see #699
|
||||
*/
|
||||
@Test
|
||||
public void deserializeAllExtraRFC5988Attributes() throws Exception {
|
||||
void deserializeAllExtraRFC5988Attributes() throws Exception {
|
||||
|
||||
RepresentationModel<?> expected = new RepresentationModel<>();
|
||||
expected.add(new Link("localhost", "self") //
|
||||
@@ -142,7 +142,7 @@ public class Jackson2HalIntegrationTest extends AbstractJackson2MarshallingInteg
|
||||
}
|
||||
|
||||
@Test
|
||||
public void rendersWithOneExtraRFC5988Attribute() throws Exception {
|
||||
void rendersWithOneExtraRFC5988Attribute() throws Exception {
|
||||
|
||||
RepresentationModel<?> resourceSupport = new RepresentationModel<>();
|
||||
resourceSupport.add(new Link("localhost", "self").withTitle("the title"));
|
||||
@@ -154,7 +154,7 @@ public class Jackson2HalIntegrationTest extends AbstractJackson2MarshallingInteg
|
||||
* @see #699
|
||||
*/
|
||||
@Test
|
||||
public void deserializeOneExtraRFC5988Attribute() throws Exception {
|
||||
void deserializeOneExtraRFC5988Attribute() throws Exception {
|
||||
|
||||
RepresentationModel<?> expected = new RepresentationModel<>();
|
||||
expected.add(new Link("localhost", "self").withTitle("the title"));
|
||||
@@ -163,7 +163,7 @@ public class Jackson2HalIntegrationTest extends AbstractJackson2MarshallingInteg
|
||||
}
|
||||
|
||||
@Test
|
||||
public void deserializeSingleLink() throws Exception {
|
||||
void deserializeSingleLink() throws Exception {
|
||||
RepresentationModel<?> expected = new RepresentationModel<>();
|
||||
expected.add(new Link("localhost"));
|
||||
assertThat(read(SINGLE_LINK_REFERENCE, RepresentationModel.class)).isEqualTo(expected);
|
||||
@@ -173,7 +173,7 @@ public class Jackson2HalIntegrationTest extends AbstractJackson2MarshallingInteg
|
||||
* @see #29
|
||||
*/
|
||||
@Test
|
||||
public void rendersMultipleLinkAsArray() throws Exception {
|
||||
void rendersMultipleLinkAsArray() throws Exception {
|
||||
|
||||
RepresentationModel<?> resourceSupport = new RepresentationModel<>();
|
||||
resourceSupport.add(new Link("localhost"));
|
||||
@@ -183,7 +183,7 @@ public class Jackson2HalIntegrationTest extends AbstractJackson2MarshallingInteg
|
||||
}
|
||||
|
||||
@Test
|
||||
public void deserializeMultipleLinks() throws Exception {
|
||||
void deserializeMultipleLinks() throws Exception {
|
||||
|
||||
RepresentationModel<?> expected = new RepresentationModel<>();
|
||||
expected.add(new Link("localhost"));
|
||||
@@ -193,7 +193,7 @@ public class Jackson2HalIntegrationTest extends AbstractJackson2MarshallingInteg
|
||||
}
|
||||
|
||||
@Test
|
||||
public void rendersSimpleResourcesAsEmbedded() throws Exception {
|
||||
void rendersSimpleResourcesAsEmbedded() throws Exception {
|
||||
|
||||
List<String> content = new ArrayList<>();
|
||||
content.add("first");
|
||||
@@ -206,7 +206,7 @@ public class Jackson2HalIntegrationTest extends AbstractJackson2MarshallingInteg
|
||||
}
|
||||
|
||||
@Test
|
||||
public void deserializesSimpleResourcesAsEmbedded() throws Exception {
|
||||
void deserializesSimpleResourcesAsEmbedded() throws Exception {
|
||||
|
||||
List<String> content = new ArrayList<>();
|
||||
content.add("first");
|
||||
@@ -223,7 +223,7 @@ public class Jackson2HalIntegrationTest extends AbstractJackson2MarshallingInteg
|
||||
}
|
||||
|
||||
@Test
|
||||
public void rendersSingleResourceResourcesAsEmbedded() throws Exception {
|
||||
void rendersSingleResourceResourcesAsEmbedded() throws Exception {
|
||||
|
||||
List<EntityModel<SimplePojo>> content = new ArrayList<>();
|
||||
content.add(new EntityModel<>(new SimplePojo("test1", 1), new Link("localhost")));
|
||||
@@ -235,7 +235,7 @@ public class Jackson2HalIntegrationTest extends AbstractJackson2MarshallingInteg
|
||||
}
|
||||
|
||||
@Test
|
||||
public void deserializesSingleResourceResourcesAsEmbedded() throws Exception {
|
||||
void deserializesSingleResourceResourcesAsEmbedded() throws Exception {
|
||||
|
||||
List<EntityModel<SimplePojo>> content = new ArrayList<>();
|
||||
content.add(new EntityModel<>(new SimplePojo("test1", 1), new Link("localhost")));
|
||||
@@ -252,7 +252,7 @@ public class Jackson2HalIntegrationTest extends AbstractJackson2MarshallingInteg
|
||||
}
|
||||
|
||||
@Test
|
||||
public void rendersMultipleResourceResourcesAsEmbedded() throws Exception {
|
||||
void rendersMultipleResourceResourcesAsEmbedded() throws Exception {
|
||||
|
||||
CollectionModel<EntityModel<SimplePojo>> resources = setupResources();
|
||||
resources.add(new Link("localhost"));
|
||||
@@ -261,7 +261,7 @@ public class Jackson2HalIntegrationTest extends AbstractJackson2MarshallingInteg
|
||||
}
|
||||
|
||||
@Test
|
||||
public void deserializesMultipleResourceResourcesAsEmbedded() throws Exception {
|
||||
void deserializesMultipleResourceResourcesAsEmbedded() throws Exception {
|
||||
|
||||
CollectionModel<EntityModel<SimplePojo>> expected = setupResources();
|
||||
expected.add(new Link("localhost"));
|
||||
@@ -277,7 +277,7 @@ public class Jackson2HalIntegrationTest extends AbstractJackson2MarshallingInteg
|
||||
* @see #47, #60
|
||||
*/
|
||||
@Test
|
||||
public void serializesAnnotatedResourceResourcesAsEmbedded() throws Exception {
|
||||
void serializesAnnotatedResourceResourcesAsEmbedded() throws Exception {
|
||||
|
||||
List<EntityModel<SimpleAnnotatedPojo>> content = new ArrayList<>();
|
||||
content.add(new EntityModel<>(new SimpleAnnotatedPojo("test1", 1), new Link("localhost")));
|
||||
@@ -292,7 +292,7 @@ public class Jackson2HalIntegrationTest extends AbstractJackson2MarshallingInteg
|
||||
* @see #47, #60
|
||||
*/
|
||||
@Test
|
||||
public void deserializesAnnotatedResourceResourcesAsEmbedded() throws Exception {
|
||||
void deserializesAnnotatedResourceResourcesAsEmbedded() throws Exception {
|
||||
|
||||
List<EntityModel<SimpleAnnotatedPojo>> content = new ArrayList<>();
|
||||
content.add(new EntityModel<>(new SimpleAnnotatedPojo("test1", 1), new Link("localhost")));
|
||||
@@ -311,7 +311,7 @@ public class Jackson2HalIntegrationTest extends AbstractJackson2MarshallingInteg
|
||||
* @see #63
|
||||
*/
|
||||
@Test
|
||||
public void serializesMultipleAnnotatedResourceResourcesAsEmbedded() throws Exception {
|
||||
void serializesMultipleAnnotatedResourceResourcesAsEmbedded() throws Exception {
|
||||
assertThat(write(setupAnnotatedResources())).isEqualTo(ANNOTATED_EMBEDDED_RESOURCES_REFERENCE);
|
||||
}
|
||||
|
||||
@@ -319,7 +319,7 @@ public class Jackson2HalIntegrationTest extends AbstractJackson2MarshallingInteg
|
||||
* @see #63
|
||||
*/
|
||||
@Test
|
||||
public void deserializesMultipleAnnotatedResourceResourcesAsEmbedded() throws Exception {
|
||||
void deserializesMultipleAnnotatedResourceResourcesAsEmbedded() throws Exception {
|
||||
|
||||
CollectionModel<EntityModel<SimpleAnnotatedPojo>> result = mapper.readValue(ANNOTATED_EMBEDDED_RESOURCES_REFERENCE,
|
||||
mapper.getTypeFactory().constructParametricType(CollectionModel.class,
|
||||
@@ -332,7 +332,7 @@ public class Jackson2HalIntegrationTest extends AbstractJackson2MarshallingInteg
|
||||
* @see #63
|
||||
*/
|
||||
@Test
|
||||
public void serializesPagedResource() throws Exception {
|
||||
void serializesPagedResource() throws Exception {
|
||||
assertThat(write(setupAnnotatedPagedResources())).isEqualTo(ANNOTATED_PAGED_RESOURCES);
|
||||
}
|
||||
|
||||
@@ -340,7 +340,7 @@ public class Jackson2HalIntegrationTest extends AbstractJackson2MarshallingInteg
|
||||
* @see #64
|
||||
*/
|
||||
@Test
|
||||
public void deserializesPagedResource() throws Exception {
|
||||
void deserializesPagedResource() throws Exception {
|
||||
PagedModel<EntityModel<SimpleAnnotatedPojo>> result = mapper.readValue(ANNOTATED_PAGED_RESOURCES,
|
||||
mapper.getTypeFactory().constructParametricType(PagedModel.class,
|
||||
mapper.getTypeFactory().constructParametricType(EntityModel.class, SimpleAnnotatedPojo.class)));
|
||||
@@ -352,7 +352,7 @@ public class Jackson2HalIntegrationTest extends AbstractJackson2MarshallingInteg
|
||||
* @see #125
|
||||
*/
|
||||
@Test
|
||||
public void rendersCuriesCorrectly() throws Exception {
|
||||
void rendersCuriesCorrectly() throws Exception {
|
||||
|
||||
CollectionModel<Object> resources = new CollectionModel<>(Collections.emptySet(), new Link("foo"),
|
||||
new Link("bar", "myrel"));
|
||||
@@ -364,7 +364,7 @@ public class Jackson2HalIntegrationTest extends AbstractJackson2MarshallingInteg
|
||||
* @see #125
|
||||
*/
|
||||
@Test
|
||||
public void doesNotRenderCuriesIfNoLinkIsPresent() throws Exception {
|
||||
void doesNotRenderCuriesIfNoLinkIsPresent() throws Exception {
|
||||
|
||||
CollectionModel<Object> resources = new CollectionModel<>(Collections.emptySet());
|
||||
assertThat(getCuriedObjectMapper().writeValueAsString(resources)).isEqualTo(EMPTY_DOCUMENT);
|
||||
@@ -374,7 +374,7 @@ public class Jackson2HalIntegrationTest extends AbstractJackson2MarshallingInteg
|
||||
* @see #125
|
||||
*/
|
||||
@Test
|
||||
public void doesNotRenderCuriesIfNoCurieLinkIsPresent() throws Exception {
|
||||
void doesNotRenderCuriesIfNoCurieLinkIsPresent() throws Exception {
|
||||
|
||||
CollectionModel<Object> resources = new CollectionModel<>(Collections.emptySet());
|
||||
resources.add(new Link("foo"));
|
||||
@@ -386,7 +386,7 @@ public class Jackson2HalIntegrationTest extends AbstractJackson2MarshallingInteg
|
||||
* @see #137
|
||||
*/
|
||||
@Test
|
||||
public void rendersTemplate() throws Exception {
|
||||
void rendersTemplate() throws Exception {
|
||||
|
||||
RepresentationModel<?> support = new RepresentationModel<>();
|
||||
support.add(new Link("/foo{?bar}", "search"));
|
||||
@@ -398,7 +398,7 @@ public class Jackson2HalIntegrationTest extends AbstractJackson2MarshallingInteg
|
||||
* @see #142
|
||||
*/
|
||||
@Test
|
||||
public void rendersMultipleCuries() throws Exception {
|
||||
void rendersMultipleCuries() throws Exception {
|
||||
|
||||
CollectionModel<Object> resources = new CollectionModel<>(Collections.emptySet());
|
||||
resources.add(new Link("foo", "myrel"));
|
||||
@@ -418,7 +418,7 @@ public class Jackson2HalIntegrationTest extends AbstractJackson2MarshallingInteg
|
||||
* @see #286, #236
|
||||
*/
|
||||
@Test
|
||||
public void rendersEmptyEmbeddedCollections() throws Exception {
|
||||
void rendersEmptyEmbeddedCollections() throws Exception {
|
||||
|
||||
EmbeddedWrappers wrappers = new EmbeddedWrappers(false);
|
||||
|
||||
@@ -434,7 +434,7 @@ public class Jackson2HalIntegrationTest extends AbstractJackson2MarshallingInteg
|
||||
* @see #378
|
||||
*/
|
||||
@Test
|
||||
public void rendersTitleIfMessageSourceResolvesNamespacedKey() throws Exception {
|
||||
void rendersTitleIfMessageSourceResolvesNamespacedKey() throws Exception {
|
||||
verifyResolvedTitle("_links.ns:foobar.title");
|
||||
}
|
||||
|
||||
@@ -442,12 +442,12 @@ public class Jackson2HalIntegrationTest extends AbstractJackson2MarshallingInteg
|
||||
* @see #378
|
||||
*/
|
||||
@Test
|
||||
public void rendersTitleIfMessageSourceResolvesLocalKey() throws Exception {
|
||||
void rendersTitleIfMessageSourceResolvesLocalKey() throws Exception {
|
||||
verifyResolvedTitle("_links.foobar.title");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void rendersSingleLinkAsArrayWhenConfigured() throws Exception {
|
||||
void rendersSingleLinkAsArrayWhenConfigured() throws Exception {
|
||||
|
||||
mapper.setHandlerInstantiator(new HalHandlerInstantiator(new AnnotationLinkRelationProvider(), CurieProvider.NONE,
|
||||
new MessageSourceAccessor(messageSource),
|
||||
@@ -463,7 +463,7 @@ public class Jackson2HalIntegrationTest extends AbstractJackson2MarshallingInteg
|
||||
* @see #667
|
||||
*/
|
||||
@Test
|
||||
public void handleTemplatedLinksOnDeserialization() throws IOException {
|
||||
void handleTemplatedLinksOnDeserialization() throws IOException {
|
||||
|
||||
RepresentationModel<?> original = new RepresentationModel<>();
|
||||
original.add(new Link("/orders{?id}", "order"));
|
||||
@@ -480,7 +480,7 @@ public class Jackson2HalIntegrationTest extends AbstractJackson2MarshallingInteg
|
||||
}
|
||||
|
||||
@Test // #811
|
||||
public void rendersSpecificRelWithSingleLinkAsArrayIfConfigured() throws Exception {
|
||||
void rendersSpecificRelWithSingleLinkAsArrayIfConfigured() throws Exception {
|
||||
|
||||
AnnotationLinkRelationProvider provider = new AnnotationLinkRelationProvider();
|
||||
MessageSourceAccessor accessor = new MessageSourceAccessor(messageSource);
|
||||
|
||||
@@ -57,14 +57,14 @@ import org.springframework.web.servlet.config.annotation.EnableWebMvc;
|
||||
@ExtendWith(SpringExtension.class)
|
||||
@WebAppConfiguration
|
||||
@ContextConfiguration
|
||||
public class RenderHypermediaForDefaultAcceptHeadersTest {
|
||||
class RenderHypermediaForDefaultAcceptHeadersTest {
|
||||
|
||||
@Autowired WebApplicationContext context;
|
||||
|
||||
MockMvc mockMvc;
|
||||
|
||||
@BeforeEach
|
||||
public void setUp() {
|
||||
void setUp() {
|
||||
this.mockMvc = webAppContextSetup(this.context).build();
|
||||
}
|
||||
|
||||
@@ -74,7 +74,7 @@ public class RenderHypermediaForDefaultAcceptHeadersTest {
|
||||
* @see #695
|
||||
*/
|
||||
@Test
|
||||
public void browserBasedDefaultAcceptHeadersShouldProduceHalJson() throws Exception {
|
||||
void browserBasedDefaultAcceptHeadersShouldProduceHalJson() throws Exception {
|
||||
|
||||
this.mockMvc.perform(get("/employees").accept(MediaType.APPLICATION_XHTML_XML, MediaType.ALL)) //
|
||||
.andExpect(status().isOk())
|
||||
@@ -87,7 +87,7 @@ public class RenderHypermediaForDefaultAcceptHeadersTest {
|
||||
* @see #695
|
||||
*/
|
||||
@Test
|
||||
public void curlBasedDefaultAcceptHeadersShouldProduceHalJson() throws Exception {
|
||||
void curlBasedDefaultAcceptHeadersShouldProduceHalJson() throws Exception {
|
||||
|
||||
this.mockMvc.perform(get("/employees").accept(MediaType.ALL)) //
|
||||
.andExpect(status().isOk())
|
||||
|
||||
@@ -32,7 +32,7 @@ import org.springframework.hateoas.client.LinkDiscovererUnitTest;
|
||||
*
|
||||
* @author Greg Turnquist
|
||||
*/
|
||||
public class HalFormsLinkDiscovererUnitTest extends LinkDiscovererUnitTest {
|
||||
class HalFormsLinkDiscovererUnitTest extends LinkDiscovererUnitTest {
|
||||
|
||||
static final LinkDiscoverer discoverer = new HalFormsLinkDiscoverer();
|
||||
|
||||
@@ -40,7 +40,7 @@ public class HalFormsLinkDiscovererUnitTest extends LinkDiscovererUnitTest {
|
||||
* @see #314
|
||||
*/
|
||||
@Test
|
||||
public void discoversFullyQualifiedRel() {
|
||||
void discoversFullyQualifiedRel() {
|
||||
assertThat(getDiscoverer().findLinkWithRel("http://www.foo.com/bar", getInputString())).isNotNull();
|
||||
}
|
||||
|
||||
@@ -48,7 +48,7 @@ public class HalFormsLinkDiscovererUnitTest extends LinkDiscovererUnitTest {
|
||||
* @see #787
|
||||
*/
|
||||
@Test
|
||||
public void discoversAllTheLinkAttributes() throws IOException {
|
||||
void discoversAllTheLinkAttributes() throws IOException {
|
||||
|
||||
String linkText = read(new ClassPathResource("hal-forms-link.json", getClass()));
|
||||
|
||||
|
||||
@@ -46,13 +46,13 @@ import com.fasterxml.jackson.databind.ObjectMapper;
|
||||
* @author Greg Turnquist
|
||||
* @author Oliver Gierke
|
||||
*/
|
||||
public class HalFormsMessageConverterUnitTest {
|
||||
class HalFormsMessageConverterUnitTest {
|
||||
|
||||
ObjectMapper mapper;
|
||||
HttpMessageConverter<Object> messageConverter;
|
||||
|
||||
@BeforeEach
|
||||
public void setUp() {
|
||||
void setUp() {
|
||||
|
||||
this.mapper = new ObjectMapper();
|
||||
this.mapper.registerModule(new Jackson2HalFormsModule());
|
||||
@@ -68,7 +68,7 @@ public class HalFormsMessageConverterUnitTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void canReadAHalFormsDocumentMessage() throws IOException {
|
||||
void canReadAHalFormsDocumentMessage() throws IOException {
|
||||
|
||||
HttpInputMessage message = new HttpInputMessage() {
|
||||
@Override
|
||||
@@ -100,7 +100,7 @@ public class HalFormsMessageConverterUnitTest {
|
||||
|
||||
@Test
|
||||
@SuppressWarnings("rawtypes")
|
||||
public void canWriteAHalFormsDocumentMessage() throws IOException {
|
||||
void canWriteAHalFormsDocumentMessage() throws IOException {
|
||||
|
||||
HalFormsProperty property = HalFormsProperty.named("my-name")//
|
||||
.withReadOnly(true) //
|
||||
|
||||
@@ -64,19 +64,19 @@ import org.springframework.web.servlet.config.annotation.EnableWebMvc;
|
||||
@ExtendWith(SpringExtension.class)
|
||||
@WebAppConfiguration
|
||||
@ContextConfiguration
|
||||
public class HalFormsValidationIntegrationTest {
|
||||
class HalFormsValidationIntegrationTest {
|
||||
|
||||
@Autowired WebApplicationContext context;
|
||||
|
||||
MockMvc mockMvc;
|
||||
|
||||
@BeforeEach
|
||||
public void setUp() {
|
||||
void setUp() {
|
||||
this.mockMvc = webAppContextSetup(this.context).build();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void singleEmployee() throws Exception {
|
||||
void singleEmployee() throws Exception {
|
||||
|
||||
Exception exception = this.mockMvc.perform(get("/employees/0").accept(MediaTypes.HAL_FORMS_JSON))
|
||||
.andExpect(status().is5xxServerError()) //
|
||||
@@ -89,7 +89,7 @@ public class HalFormsValidationIntegrationTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void collectionOfEmployees() throws Exception {
|
||||
void collectionOfEmployees() throws Exception {
|
||||
|
||||
Exception exception = this.mockMvc.perform(get("/employees").accept(MediaTypes.HAL_FORMS_JSON)) //
|
||||
.andExpect(status().is5xxServerError()) //
|
||||
|
||||
@@ -46,12 +46,12 @@ import org.springframework.web.reactive.config.EnableWebFlux;
|
||||
@ExtendWith(SpringExtension.class)
|
||||
@WebAppConfiguration
|
||||
@ContextConfiguration
|
||||
public class HalFormsWebFluxIntegrationTest {
|
||||
class HalFormsWebFluxIntegrationTest {
|
||||
|
||||
@Autowired WebTestClient testClient;
|
||||
|
||||
@BeforeEach
|
||||
public void setUp() {
|
||||
void setUp() {
|
||||
WebFluxEmployeeController.reset();
|
||||
}
|
||||
|
||||
@@ -59,7 +59,7 @@ public class HalFormsWebFluxIntegrationTest {
|
||||
* @see #728
|
||||
*/
|
||||
@Test
|
||||
public void singleEmployee() {
|
||||
void singleEmployee() {
|
||||
|
||||
this.testClient.get().uri("http://localhost/employees/0")
|
||||
.accept(MediaTypes.HAL_FORMS_JSON)
|
||||
@@ -92,7 +92,7 @@ public class HalFormsWebFluxIntegrationTest {
|
||||
* @see #728
|
||||
*/
|
||||
@Test
|
||||
public void collectionOfEmployees() {
|
||||
void collectionOfEmployees() {
|
||||
|
||||
this.testClient.get().uri("http://localhost/employees")
|
||||
.accept(MediaTypes.HAL_FORMS_JSON)
|
||||
@@ -122,7 +122,7 @@ public class HalFormsWebFluxIntegrationTest {
|
||||
* @see #728
|
||||
*/
|
||||
@Test
|
||||
public void createNewEmployee() throws Exception {
|
||||
void createNewEmployee() throws Exception {
|
||||
|
||||
String specBasedJson = MappingUtils.read(new ClassPathResource("new-employee.json", getClass()));
|
||||
|
||||
|
||||
@@ -47,21 +47,21 @@ import org.springframework.web.servlet.config.annotation.EnableWebMvc;
|
||||
@ExtendWith(SpringExtension.class)
|
||||
@WebAppConfiguration
|
||||
@ContextConfiguration
|
||||
public class HalFormsWebMvcIntegrationTest {
|
||||
class HalFormsWebMvcIntegrationTest {
|
||||
|
||||
@Autowired WebApplicationContext context;
|
||||
|
||||
MockMvc mockMvc;
|
||||
|
||||
@BeforeEach
|
||||
public void setUp() {
|
||||
void setUp() {
|
||||
|
||||
this.mockMvc = webAppContextSetup(this.context).build();
|
||||
WebMvcEmployeeController.reset();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void singleEmployee() throws Exception {
|
||||
void singleEmployee() throws Exception {
|
||||
|
||||
this.mockMvc.perform(get("/employees/0").accept(MediaTypes.HAL_FORMS_JSON)) //
|
||||
.andExpect(status().isOk()) //
|
||||
@@ -86,7 +86,7 @@ public class HalFormsWebMvcIntegrationTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void collectionOfEmployees() throws Exception {
|
||||
void collectionOfEmployees() throws Exception {
|
||||
|
||||
this.mockMvc.perform(get("/employees").accept(MediaTypes.HAL_FORMS_JSON)) //
|
||||
.andExpect(status().isOk()) //
|
||||
@@ -109,7 +109,7 @@ public class HalFormsWebMvcIntegrationTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void createNewEmployee() throws Exception {
|
||||
void createNewEmployee() throws Exception {
|
||||
|
||||
String specBasedJson = MappingUtils.read(new ClassPathResource("new-employee.json", getClass()));
|
||||
|
||||
|
||||
@@ -62,7 +62,7 @@ import com.fasterxml.jackson.databind.SerializationFeature;
|
||||
* @author Greg Turnquist
|
||||
* @author Oliver Drotbohm
|
||||
*/
|
||||
public class Jackson2HalFormsIntegrationTest extends AbstractJackson2MarshallingIntegrationTest {
|
||||
class Jackson2HalFormsIntegrationTest extends AbstractJackson2MarshallingIntegrationTest {
|
||||
|
||||
static final Links PAGINATION_LINKS = Links.of( //
|
||||
new Link("foo", IanaLinkRelations.NEXT), //
|
||||
@@ -72,7 +72,7 @@ public class Jackson2HalFormsIntegrationTest extends AbstractJackson2Marshalling
|
||||
MessageSource messageSource = mock(MessageSource.class);
|
||||
|
||||
@BeforeEach
|
||||
public void setUpModule() {
|
||||
void setUpModule() {
|
||||
|
||||
LinkRelationProvider provider = new DelegatingLinkRelationProvider(new AnnotationLinkRelationProvider(),
|
||||
Jackson2HalIntegrationTest.DefaultLinkRelationProvider.INSTANCE);
|
||||
@@ -84,7 +84,7 @@ public class Jackson2HalFormsIntegrationTest extends AbstractJackson2Marshalling
|
||||
}
|
||||
|
||||
@Test
|
||||
public void rendersSingleLinkAsObject() throws Exception {
|
||||
void rendersSingleLinkAsObject() throws Exception {
|
||||
|
||||
RepresentationModel<?> resourceSupport = new RepresentationModel<>();
|
||||
resourceSupport.add(new Link("localhost"));
|
||||
@@ -94,7 +94,7 @@ public class Jackson2HalFormsIntegrationTest extends AbstractJackson2Marshalling
|
||||
}
|
||||
|
||||
@Test
|
||||
public void deserializeSingleLink() throws Exception {
|
||||
void deserializeSingleLink() throws Exception {
|
||||
|
||||
RepresentationModel<?> expected = new RepresentationModel<>();
|
||||
expected.add(new Link("localhost"));
|
||||
@@ -104,7 +104,7 @@ public class Jackson2HalFormsIntegrationTest extends AbstractJackson2Marshalling
|
||||
}
|
||||
|
||||
@Test
|
||||
public void rendersMultipleLinkAsArray() throws Exception {
|
||||
void rendersMultipleLinkAsArray() throws Exception {
|
||||
|
||||
RepresentationModel<?> resourceSupport = new RepresentationModel<>();
|
||||
resourceSupport.add(new Link("localhost"));
|
||||
@@ -115,7 +115,7 @@ public class Jackson2HalFormsIntegrationTest extends AbstractJackson2Marshalling
|
||||
}
|
||||
|
||||
@Test
|
||||
public void deserializeMultipleLinks() throws Exception {
|
||||
void deserializeMultipleLinks() throws Exception {
|
||||
|
||||
RepresentationModel<?> expected = new RepresentationModel<>();
|
||||
expected.add(new Link("localhost"));
|
||||
@@ -126,7 +126,7 @@ public class Jackson2HalFormsIntegrationTest extends AbstractJackson2Marshalling
|
||||
}
|
||||
|
||||
@Test
|
||||
public void rendersResource() throws Exception {
|
||||
void rendersResource() throws Exception {
|
||||
|
||||
EntityModel<SimplePojo> resource = new EntityModel<>(new SimplePojo("test1", 1), new Link("localhost"));
|
||||
|
||||
@@ -135,7 +135,7 @@ public class Jackson2HalFormsIntegrationTest extends AbstractJackson2Marshalling
|
||||
}
|
||||
|
||||
@Test
|
||||
public void deserializesResource() throws IOException {
|
||||
void deserializesResource() throws IOException {
|
||||
|
||||
EntityModel<SimplePojo> expected = new EntityModel<>(new SimplePojo("test1", 1), new Link("localhost"));
|
||||
|
||||
@@ -147,7 +147,7 @@ public class Jackson2HalFormsIntegrationTest extends AbstractJackson2Marshalling
|
||||
}
|
||||
|
||||
@Test
|
||||
public void rendersSimpleResourcesAsEmbedded() throws Exception {
|
||||
void rendersSimpleResourcesAsEmbedded() throws Exception {
|
||||
|
||||
List<String> content = new ArrayList<>();
|
||||
content.add("first");
|
||||
@@ -161,7 +161,7 @@ public class Jackson2HalFormsIntegrationTest extends AbstractJackson2Marshalling
|
||||
}
|
||||
|
||||
@Test
|
||||
public void deserializesSimpleResourcesAsEmbedded() throws Exception {
|
||||
void deserializesSimpleResourcesAsEmbedded() throws Exception {
|
||||
|
||||
List<String> content = new ArrayList<>();
|
||||
content.add("first");
|
||||
@@ -179,7 +179,7 @@ public class Jackson2HalFormsIntegrationTest extends AbstractJackson2Marshalling
|
||||
}
|
||||
|
||||
@Test
|
||||
public void rendersSingleResourceResourcesAsEmbedded() throws Exception {
|
||||
void rendersSingleResourceResourcesAsEmbedded() throws Exception {
|
||||
|
||||
List<EntityModel<SimplePojo>> content = new ArrayList<>();
|
||||
content.add(new EntityModel<>(new SimplePojo("test1", 1), new Link("localhost")));
|
||||
@@ -192,7 +192,7 @@ public class Jackson2HalFormsIntegrationTest extends AbstractJackson2Marshalling
|
||||
}
|
||||
|
||||
@Test
|
||||
public void deserializesSingleResourceResourcesAsEmbedded() throws Exception {
|
||||
void deserializesSingleResourceResourcesAsEmbedded() throws Exception {
|
||||
|
||||
List<EntityModel<SimplePojo>> content = new ArrayList<>();
|
||||
content.add(new EntityModel<>(new SimplePojo("test1", 1), new Link("localhost")));
|
||||
@@ -209,7 +209,7 @@ public class Jackson2HalFormsIntegrationTest extends AbstractJackson2Marshalling
|
||||
}
|
||||
|
||||
@Test
|
||||
public void rendersMultipleResourceResourcesAsEmbedded() throws Exception {
|
||||
void rendersMultipleResourceResourcesAsEmbedded() throws Exception {
|
||||
|
||||
CollectionModel<EntityModel<SimplePojo>> resources = setupResources();
|
||||
resources.add(new Link("localhost"));
|
||||
@@ -219,7 +219,7 @@ public class Jackson2HalFormsIntegrationTest extends AbstractJackson2Marshalling
|
||||
}
|
||||
|
||||
@Test
|
||||
public void deserializesMultipleResourceResourcesAsEmbedded() throws Exception {
|
||||
void deserializesMultipleResourceResourcesAsEmbedded() throws Exception {
|
||||
|
||||
CollectionModel<EntityModel<SimplePojo>> expected = setupResources();
|
||||
expected.add(new Link("localhost"));
|
||||
@@ -233,7 +233,7 @@ public class Jackson2HalFormsIntegrationTest extends AbstractJackson2Marshalling
|
||||
}
|
||||
|
||||
@Test
|
||||
public void serializesAnnotatedResourceResourcesAsEmbedded() throws Exception {
|
||||
void serializesAnnotatedResourceResourcesAsEmbedded() throws Exception {
|
||||
|
||||
List<EntityModel<SimpleAnnotatedPojo>> content = new ArrayList<>();
|
||||
content.add(new EntityModel<>(new SimpleAnnotatedPojo("test1", 1), new Link("localhost")));
|
||||
@@ -246,7 +246,7 @@ public class Jackson2HalFormsIntegrationTest extends AbstractJackson2Marshalling
|
||||
}
|
||||
|
||||
@Test
|
||||
public void deserializesAnnotatedResourceResourcesAsEmbedded() throws Exception {
|
||||
void deserializesAnnotatedResourceResourcesAsEmbedded() throws Exception {
|
||||
|
||||
List<EntityModel<SimpleAnnotatedPojo>> content = new ArrayList<>();
|
||||
content.add(new EntityModel<>(new SimpleAnnotatedPojo("test1", 1), new Link("localhost")));
|
||||
@@ -263,13 +263,13 @@ public class Jackson2HalFormsIntegrationTest extends AbstractJackson2Marshalling
|
||||
}
|
||||
|
||||
@Test
|
||||
public void serializesMultipleAnnotatedResourceResourcesAsEmbedded() throws Exception {
|
||||
void serializesMultipleAnnotatedResourceResourcesAsEmbedded() throws Exception {
|
||||
assertThat(write(setupAnnotatedResources()))
|
||||
.isEqualTo(MappingUtils.read(new ClassPathResource("annotated-embedded-resources-reference.json", getClass())));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void deserializesMultipleAnnotatedResourceResourcesAsEmbedded() throws Exception {
|
||||
void deserializesMultipleAnnotatedResourceResourcesAsEmbedded() throws Exception {
|
||||
|
||||
CollectionModel<EntityModel<SimpleAnnotatedPojo>> result = mapper.readValue(
|
||||
MappingUtils.read(new ClassPathResource("annotated-embedded-resources-reference.json", getClass())),
|
||||
@@ -280,13 +280,13 @@ public class Jackson2HalFormsIntegrationTest extends AbstractJackson2Marshalling
|
||||
}
|
||||
|
||||
@Test
|
||||
public void serializesPagedResource() throws Exception {
|
||||
void serializesPagedResource() throws Exception {
|
||||
assertThat(write(setupAnnotatedPagedResources()))
|
||||
.isEqualTo(MappingUtils.read(new ClassPathResource("annotated-paged-resources.json", getClass())));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void deserializesPagedResource() throws Exception {
|
||||
void deserializesPagedResource() throws Exception {
|
||||
PagedModel<EntityModel<SimpleAnnotatedPojo>> result = mapper.readValue(
|
||||
MappingUtils.read(new ClassPathResource("annotated-paged-resources.json", getClass())),
|
||||
mapper.getTypeFactory().constructParametricType(PagedModel.class,
|
||||
@@ -296,7 +296,7 @@ public class Jackson2HalFormsIntegrationTest extends AbstractJackson2Marshalling
|
||||
}
|
||||
|
||||
@Test
|
||||
public void rendersCuriesCorrectly() throws Exception {
|
||||
void rendersCuriesCorrectly() throws Exception {
|
||||
|
||||
CollectionModel<Object> resources = new CollectionModel<>(Collections.emptySet(), new Link("foo"),
|
||||
new Link("bar", "myrel"));
|
||||
@@ -306,7 +306,7 @@ public class Jackson2HalFormsIntegrationTest extends AbstractJackson2Marshalling
|
||||
}
|
||||
|
||||
@Test
|
||||
public void doesNotRenderCuriesIfNoLinkIsPresent() throws Exception {
|
||||
void doesNotRenderCuriesIfNoLinkIsPresent() throws Exception {
|
||||
|
||||
CollectionModel<Object> resources = new CollectionModel<>(Collections.emptySet());
|
||||
assertThat(getCuriedObjectMapper().writeValueAsString(resources))
|
||||
@@ -314,7 +314,7 @@ public class Jackson2HalFormsIntegrationTest extends AbstractJackson2Marshalling
|
||||
}
|
||||
|
||||
@Test
|
||||
public void doesNotRenderCuriesIfNoCurieLinkIsPresent() throws Exception {
|
||||
void doesNotRenderCuriesIfNoCurieLinkIsPresent() throws Exception {
|
||||
|
||||
CollectionModel<Object> resources = new CollectionModel<>(Collections.emptySet());
|
||||
resources.add(new Link("foo"));
|
||||
@@ -324,7 +324,7 @@ public class Jackson2HalFormsIntegrationTest extends AbstractJackson2Marshalling
|
||||
}
|
||||
|
||||
@Test
|
||||
public void rendersTemplate() throws Exception {
|
||||
void rendersTemplate() throws Exception {
|
||||
|
||||
RepresentationModel<?> support = new RepresentationModel<>();
|
||||
support.add(new Link("/foo{?bar}", "search"));
|
||||
@@ -333,7 +333,7 @@ public class Jackson2HalFormsIntegrationTest extends AbstractJackson2Marshalling
|
||||
}
|
||||
|
||||
@Test
|
||||
public void rendersMultipleCuries() throws Exception {
|
||||
void rendersMultipleCuries() throws Exception {
|
||||
|
||||
CollectionModel<Object> resources = new CollectionModel<>(Collections.emptySet());
|
||||
resources.add(new Link("foo", "myrel"));
|
||||
@@ -350,7 +350,7 @@ public class Jackson2HalFormsIntegrationTest extends AbstractJackson2Marshalling
|
||||
}
|
||||
|
||||
@Test
|
||||
public void rendersEmptyEmbeddedCollections() throws Exception {
|
||||
void rendersEmptyEmbeddedCollections() throws Exception {
|
||||
|
||||
EmbeddedWrappers wrappers = new EmbeddedWrappers(false);
|
||||
|
||||
@@ -364,12 +364,12 @@ public class Jackson2HalFormsIntegrationTest extends AbstractJackson2Marshalling
|
||||
}
|
||||
|
||||
@Test
|
||||
public void rendersTitleIfMessageSourceResolvesNamespacedKey() throws Exception {
|
||||
void rendersTitleIfMessageSourceResolvesNamespacedKey() throws Exception {
|
||||
verifyResolvedTitle("_links.ns:foobar.title");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void rendersTitleIfMessageSourceResolvesLocalKey() throws Exception {
|
||||
void rendersTitleIfMessageSourceResolvesLocalKey() throws Exception {
|
||||
verifyResolvedTitle("_links.foobar.title");
|
||||
}
|
||||
|
||||
@@ -377,7 +377,7 @@ public class Jackson2HalFormsIntegrationTest extends AbstractJackson2Marshalling
|
||||
* @see #667
|
||||
*/
|
||||
@Test
|
||||
public void handleTemplatedLinksOnDeserialization() throws IOException {
|
||||
void handleTemplatedLinksOnDeserialization() throws IOException {
|
||||
|
||||
RepresentationModel<?> original = new RepresentationModel<>();
|
||||
original.add(new Link("/orders{?id}", "order"));
|
||||
|
||||
@@ -47,7 +47,7 @@ import com.fasterxml.jackson.databind.SerializationFeature;
|
||||
* @author Greg Turnquist
|
||||
* @author Jens Schauder
|
||||
*/
|
||||
public class Jackson2UberIntegrationTest extends AbstractJackson2MarshallingIntegrationTest {
|
||||
class Jackson2UberIntegrationTest extends AbstractJackson2MarshallingIntegrationTest {
|
||||
|
||||
static final Links PAGINATION_LINKS = Links.of( //
|
||||
new Link("localhost", IanaLinkRelations.SELF), //
|
||||
@@ -56,7 +56,7 @@ public class Jackson2UberIntegrationTest extends AbstractJackson2MarshallingInte
|
||||
);
|
||||
|
||||
@BeforeEach
|
||||
public void setUpModule() {
|
||||
void setUpModule() {
|
||||
|
||||
this.mapper.registerModule(new Jackson2UberModule());
|
||||
this.mapper.enable(SerializationFeature.INDENT_OUTPUT);
|
||||
@@ -66,7 +66,7 @@ public class Jackson2UberIntegrationTest extends AbstractJackson2MarshallingInte
|
||||
* @see #784
|
||||
*/
|
||||
@Test
|
||||
public void rendersSingleLinkAsObject() throws Exception {
|
||||
void rendersSingleLinkAsObject() throws Exception {
|
||||
|
||||
RepresentationModel<?> resourceSupport = new RepresentationModel<>();
|
||||
resourceSupport.add(new Link("localhost").withSelfRel());
|
||||
@@ -79,7 +79,7 @@ public class Jackson2UberIntegrationTest extends AbstractJackson2MarshallingInte
|
||||
* @see #784
|
||||
*/
|
||||
@Test
|
||||
public void deserializeSingleLink() throws Exception {
|
||||
void deserializeSingleLink() throws Exception {
|
||||
|
||||
RepresentationModel<?> expected = new RepresentationModel<>();
|
||||
expected.add(new Link("localhost"));
|
||||
@@ -93,7 +93,7 @@ public class Jackson2UberIntegrationTest extends AbstractJackson2MarshallingInte
|
||||
* @see #784
|
||||
*/
|
||||
@Test
|
||||
public void rendersMultipleLinkAsArray() throws Exception {
|
||||
void rendersMultipleLinkAsArray() throws Exception {
|
||||
|
||||
RepresentationModel<?> resourceSupport = new RepresentationModel<>();
|
||||
resourceSupport.add(new Link("localhost"));
|
||||
@@ -107,7 +107,7 @@ public class Jackson2UberIntegrationTest extends AbstractJackson2MarshallingInte
|
||||
* @see #784
|
||||
*/
|
||||
@Test
|
||||
public void deserializeMultipleLinks() throws Exception {
|
||||
void deserializeMultipleLinks() throws Exception {
|
||||
|
||||
RepresentationModel<?> expected = new RepresentationModel<>();
|
||||
expected.add(new Link("localhost"));
|
||||
@@ -121,7 +121,7 @@ public class Jackson2UberIntegrationTest extends AbstractJackson2MarshallingInte
|
||||
* @see #784
|
||||
*/
|
||||
@Test
|
||||
public void rendersSimpleResourcesAsEmbedded() throws Exception {
|
||||
void rendersSimpleResourcesAsEmbedded() throws Exception {
|
||||
|
||||
List<String> content = new ArrayList<>();
|
||||
content.add("first");
|
||||
@@ -137,7 +137,7 @@ public class Jackson2UberIntegrationTest extends AbstractJackson2MarshallingInte
|
||||
* @see #784
|
||||
*/
|
||||
@Test
|
||||
public void deserializesSimpleResourcesWithNoLinks() throws Exception {
|
||||
void deserializesSimpleResourcesWithNoLinks() throws Exception {
|
||||
|
||||
List<String> content = new ArrayList<>();
|
||||
content.add("first");
|
||||
@@ -158,7 +158,7 @@ public class Jackson2UberIntegrationTest extends AbstractJackson2MarshallingInte
|
||||
* @see #784
|
||||
*/
|
||||
@Test
|
||||
public void deserializeComplexResourcesSimply() throws IOException {
|
||||
void deserializeComplexResourcesSimply() throws IOException {
|
||||
|
||||
List<EntityModel<String>> content = new ArrayList<>();
|
||||
content.add(new EntityModel<>("first"));
|
||||
@@ -183,7 +183,7 @@ public class Jackson2UberIntegrationTest extends AbstractJackson2MarshallingInte
|
||||
* @see #784
|
||||
*/
|
||||
@Test
|
||||
public void renderSimpleResource() throws Exception {
|
||||
void renderSimpleResource() throws Exception {
|
||||
|
||||
EntityModel<String> data = new EntityModel<>("first", new Link("localhost"));
|
||||
|
||||
@@ -194,7 +194,7 @@ public class Jackson2UberIntegrationTest extends AbstractJackson2MarshallingInte
|
||||
* @see #784
|
||||
*/
|
||||
@Test
|
||||
public void renderResourceWithCustomRel() throws Exception {
|
||||
void renderResourceWithCustomRel() throws Exception {
|
||||
|
||||
EntityModel<String> data2 = new EntityModel<>("second",
|
||||
new Link("localhost").withRel("custom"));
|
||||
@@ -206,7 +206,7 @@ public class Jackson2UberIntegrationTest extends AbstractJackson2MarshallingInte
|
||||
* @see #784
|
||||
*/
|
||||
@Test
|
||||
public void renderResourceWithMultipleLinks() throws Exception {
|
||||
void renderResourceWithMultipleLinks() throws Exception {
|
||||
|
||||
EntityModel<String> data3 = new EntityModel<>("third", new Link("localhost"),
|
||||
new Link("second").withRel("second"), new Link("third").withRel("third"));
|
||||
@@ -218,7 +218,7 @@ public class Jackson2UberIntegrationTest extends AbstractJackson2MarshallingInte
|
||||
* @see #784
|
||||
*/
|
||||
@Test
|
||||
public void renderResourceWithMultipleRels() throws Exception {
|
||||
void renderResourceWithMultipleRels() throws Exception {
|
||||
|
||||
EntityModel<String> data4 = new EntityModel<>("third", new Link("localhost"),
|
||||
new Link("localhost").withRel("https://example.org/rels/todo"), new Link("second").withRel("second"),
|
||||
@@ -231,7 +231,7 @@ public class Jackson2UberIntegrationTest extends AbstractJackson2MarshallingInte
|
||||
* @see #784
|
||||
*/
|
||||
@Test
|
||||
public void deserializeResource() throws IOException {
|
||||
void deserializeResource() throws IOException {
|
||||
|
||||
JavaType resourceStringType = mapper.getTypeFactory().constructParametricType(EntityModel.class,
|
||||
String.class);
|
||||
@@ -269,7 +269,7 @@ public class Jackson2UberIntegrationTest extends AbstractJackson2MarshallingInte
|
||||
* @see #784
|
||||
*/
|
||||
@Test
|
||||
public void renderComplexStructure() throws Exception {
|
||||
void renderComplexStructure() throws Exception {
|
||||
|
||||
List<EntityModel<String>> data = new ArrayList<>();
|
||||
data.add(new EntityModel<>("first", new Link("localhost"), new Link("orders").withRel("orders")));
|
||||
@@ -288,7 +288,7 @@ public class Jackson2UberIntegrationTest extends AbstractJackson2MarshallingInte
|
||||
* @see #784
|
||||
*/
|
||||
@Test
|
||||
public void deserializeResources() throws Exception {
|
||||
void deserializeResources() throws Exception {
|
||||
|
||||
List<EntityModel<String>> data = new ArrayList<>();
|
||||
data.add(new EntityModel<>("first", new Link("localhost"), new Link("orders").withRel("orders")));
|
||||
@@ -310,7 +310,7 @@ public class Jackson2UberIntegrationTest extends AbstractJackson2MarshallingInte
|
||||
* @see #784
|
||||
*/
|
||||
@Test
|
||||
public void deserializeEmptyValue() throws Exception {
|
||||
void deserializeEmptyValue() throws Exception {
|
||||
|
||||
List<EntityModel<String>> data = new ArrayList<>();
|
||||
data.add(new EntityModel<>("", new Link("localhost"), new Link("orders").withRel("orders")));
|
||||
@@ -332,7 +332,7 @@ public class Jackson2UberIntegrationTest extends AbstractJackson2MarshallingInte
|
||||
* @see #784
|
||||
*/
|
||||
@Test
|
||||
public void serializeEmptyResources() throws Exception {
|
||||
void serializeEmptyResources() throws Exception {
|
||||
|
||||
List<EntityModel<String>> data = new ArrayList<>();
|
||||
data.add(new EntityModel<>("first", new Link("localhost"), new Link("orders").withRel("orders")));
|
||||
@@ -350,7 +350,7 @@ public class Jackson2UberIntegrationTest extends AbstractJackson2MarshallingInte
|
||||
* @see #784
|
||||
*/
|
||||
@Test
|
||||
public void deserializeEmptyResources() {
|
||||
void deserializeEmptyResources() {
|
||||
|
||||
List<EntityModel<String>> data = new ArrayList<>();
|
||||
data.add(new EntityModel<>("first", new Link("localhost"), new Link("orders").withRel("orders")));
|
||||
@@ -374,7 +374,7 @@ public class Jackson2UberIntegrationTest extends AbstractJackson2MarshallingInte
|
||||
* @see #784
|
||||
*/
|
||||
@Test
|
||||
public void deserializeResourcesSimply() throws Exception {
|
||||
void deserializeResourcesSimply() throws Exception {
|
||||
|
||||
List<String> data = new ArrayList<>();
|
||||
data.add("first");
|
||||
@@ -395,7 +395,7 @@ public class Jackson2UberIntegrationTest extends AbstractJackson2MarshallingInte
|
||||
* @see #784
|
||||
*/
|
||||
@Test
|
||||
public void serializeWrappedSimplePojo() throws Exception {
|
||||
void serializeWrappedSimplePojo() throws Exception {
|
||||
|
||||
Employee employee = new Employee("Frodo", "ring bearer");
|
||||
EntityModel<Employee> expected = new EntityModel<>(employee,
|
||||
@@ -410,7 +410,7 @@ public class Jackson2UberIntegrationTest extends AbstractJackson2MarshallingInte
|
||||
* @see #784
|
||||
*/
|
||||
@Test
|
||||
public void deserializeWrappedSimplePojo() throws IOException {
|
||||
void deserializeWrappedSimplePojo() throws IOException {
|
||||
|
||||
Employee employee = new Employee("Frodo", "ring bearer");
|
||||
EntityModel<Employee> expected = new EntityModel<>(employee,
|
||||
@@ -427,7 +427,7 @@ public class Jackson2UberIntegrationTest extends AbstractJackson2MarshallingInte
|
||||
* @see #784
|
||||
*/
|
||||
@Test
|
||||
public void deserializeWrappedEmptyPojo() throws IOException {
|
||||
void deserializeWrappedEmptyPojo() throws IOException {
|
||||
|
||||
Employee employee = new Employee();
|
||||
EntityModel<Employee> expected = new EntityModel<>(employee,
|
||||
@@ -444,7 +444,7 @@ public class Jackson2UberIntegrationTest extends AbstractJackson2MarshallingInte
|
||||
* @see #784
|
||||
*/
|
||||
@Test
|
||||
public void serializeConcreteResourceSupport() throws Exception {
|
||||
void serializeConcreteResourceSupport() throws Exception {
|
||||
|
||||
EmployeeResource expected = new EmployeeResource("Frodo", "ring bearer");
|
||||
expected.add(new Link("/employees/1").withSelfRel());
|
||||
@@ -459,7 +459,7 @@ public class Jackson2UberIntegrationTest extends AbstractJackson2MarshallingInte
|
||||
* @see #784
|
||||
*/
|
||||
@Test
|
||||
public void deserializeConcreteResourceSupport() throws Exception {
|
||||
void deserializeConcreteResourceSupport() throws Exception {
|
||||
|
||||
EmployeeResource expected = new EmployeeResource("Frodo", "ring bearer");
|
||||
expected.add(new Link("/employees/1").withSelfRel());
|
||||
@@ -475,7 +475,7 @@ public class Jackson2UberIntegrationTest extends AbstractJackson2MarshallingInte
|
||||
* @see #784
|
||||
*/
|
||||
@Test
|
||||
public void deserializeEmptyConcreteResourceSupport() throws Exception {
|
||||
void deserializeEmptyConcreteResourceSupport() throws Exception {
|
||||
|
||||
EmployeeResource expected = new EmployeeResource(null, null);
|
||||
expected.add(new Link("/employees/1").withSelfRel());
|
||||
@@ -492,7 +492,7 @@ public class Jackson2UberIntegrationTest extends AbstractJackson2MarshallingInte
|
||||
* @see #784
|
||||
*/
|
||||
@Test
|
||||
public void serializesPagedResource() throws Exception {
|
||||
void serializesPagedResource() throws Exception {
|
||||
|
||||
String actual = write(setupAnnotatedPagedResources());
|
||||
assertThat(actual).isEqualTo(MappingUtils.read(new ClassPathResource("paged-resources.json", getClass())));
|
||||
@@ -502,7 +502,7 @@ public class Jackson2UberIntegrationTest extends AbstractJackson2MarshallingInte
|
||||
* @see #784
|
||||
*/
|
||||
@Test
|
||||
public void deserializesPagedResource() throws Exception {
|
||||
void deserializesPagedResource() throws Exception {
|
||||
|
||||
PagedModel<EntityModel<Employee>> result = mapper.readValue(
|
||||
MappingUtils.read(new ClassPathResource("paged-resources.json", getClass())),
|
||||
@@ -516,7 +516,7 @@ public class Jackson2UberIntegrationTest extends AbstractJackson2MarshallingInte
|
||||
* @see #784
|
||||
*/
|
||||
@Test
|
||||
public void deserializesPagedResourceWithEmptyPageInformation() throws Exception {
|
||||
void deserializesPagedResourceWithEmptyPageInformation() throws Exception {
|
||||
|
||||
PagedModel<EntityModel<Employee>> result = mapper.readValue(
|
||||
MappingUtils.read(new ClassPathResource("paged-resources-empty-page.json", getClass())),
|
||||
@@ -530,7 +530,7 @@ public class Jackson2UberIntegrationTest extends AbstractJackson2MarshallingInte
|
||||
* @see #784
|
||||
*/
|
||||
@Test
|
||||
public void handleTemplatedLinksOnDeserialization() throws IOException {
|
||||
void handleTemplatedLinksOnDeserialization() throws IOException {
|
||||
|
||||
RepresentationModel<?> original = new RepresentationModel<>();
|
||||
original.add(new Link("/orders{?id}", "order"));
|
||||
|
||||
@@ -32,13 +32,13 @@ import org.springframework.hateoas.mediatype.hal.HalLinkDiscoverer;
|
||||
*
|
||||
* @author Oliver Gierke
|
||||
*/
|
||||
public class UberLinkDiscovererUnitTest extends LinkDiscovererUnitTest {
|
||||
class UberLinkDiscovererUnitTest extends LinkDiscovererUnitTest {
|
||||
|
||||
LinkDiscoverer discoverer = new UberLinkDiscoverer();
|
||||
String sample;
|
||||
|
||||
@BeforeEach
|
||||
public void setUp() throws IOException {
|
||||
void setUp() throws IOException {
|
||||
|
||||
this.discoverer = new UberLinkDiscoverer();
|
||||
this.sample = read(new ClassPathResource("link-discovery.json", getClass()));
|
||||
@@ -48,7 +48,7 @@ public class UberLinkDiscovererUnitTest extends LinkDiscovererUnitTest {
|
||||
* @see #784
|
||||
*/
|
||||
@Test
|
||||
public void discoversFullyQualifiedRel() {
|
||||
void discoversFullyQualifiedRel() {
|
||||
assertThat(getDiscoverer().findLinkWithRel("http://www.foo.com/bar", this.sample)).isNotNull();
|
||||
}
|
||||
|
||||
|
||||
@@ -46,12 +46,12 @@ import org.springframework.web.reactive.config.EnableWebFlux;
|
||||
@ExtendWith(SpringExtension.class)
|
||||
@WebAppConfiguration
|
||||
@ContextConfiguration
|
||||
public class UberWebFluxIntegrationTest {
|
||||
class UberWebFluxIntegrationTest {
|
||||
|
||||
@Autowired WebTestClient testClient;
|
||||
|
||||
@BeforeEach
|
||||
public void setUp() {
|
||||
void setUp() {
|
||||
WebFluxEmployeeController.reset();
|
||||
}
|
||||
|
||||
@@ -59,7 +59,7 @@ public class UberWebFluxIntegrationTest {
|
||||
* @see #728
|
||||
*/
|
||||
@Test
|
||||
public void singleEmployee() {
|
||||
void singleEmployee() {
|
||||
|
||||
this.testClient.get().uri("http://localhost/employees/0")
|
||||
.accept(MediaTypes.UBER_JSON)
|
||||
@@ -105,7 +105,7 @@ public class UberWebFluxIntegrationTest {
|
||||
* @see #728
|
||||
*/
|
||||
@Test
|
||||
public void collectionOfEmployees() {
|
||||
void collectionOfEmployees() {
|
||||
|
||||
this.testClient.get().uri("http://localhost/employees")
|
||||
.accept(MediaTypes.UBER_JSON)
|
||||
@@ -188,7 +188,7 @@ public class UberWebFluxIntegrationTest {
|
||||
* @see #728
|
||||
*/
|
||||
@Test
|
||||
public void createNewEmployee() throws Exception {
|
||||
void createNewEmployee() throws Exception {
|
||||
|
||||
String input = read(new ClassPathResource("create-employee.json", getClass()));
|
||||
|
||||
|
||||
@@ -47,14 +47,14 @@ import org.springframework.web.servlet.config.annotation.EnableWebMvc;
|
||||
@ExtendWith(SpringExtension.class)
|
||||
@WebAppConfiguration
|
||||
@ContextConfiguration
|
||||
public class UberWebMvcIntegrationTest {
|
||||
class UberWebMvcIntegrationTest {
|
||||
|
||||
@Autowired WebApplicationContext context;
|
||||
|
||||
MockMvc mockMvc;
|
||||
|
||||
@BeforeEach
|
||||
public void setUp() {
|
||||
void setUp() {
|
||||
|
||||
this.mockMvc = webAppContextSetup(this.context).build();
|
||||
WebMvcEmployeeController.reset();
|
||||
@@ -64,7 +64,7 @@ public class UberWebMvcIntegrationTest {
|
||||
* @see #784
|
||||
*/
|
||||
@Test
|
||||
public void singleEmployee() throws Exception {
|
||||
void singleEmployee() throws Exception {
|
||||
|
||||
this.mockMvc.perform(get("/employees/0").accept(MediaTypes.UBER_JSON)) //
|
||||
.andExpect(status().isOk()) //
|
||||
@@ -106,7 +106,7 @@ public class UberWebMvcIntegrationTest {
|
||||
* @see #784
|
||||
*/
|
||||
@Test
|
||||
public void collectionOfEmployees() throws Exception {
|
||||
void collectionOfEmployees() throws Exception {
|
||||
|
||||
this.mockMvc.perform(get("/employees").accept(MediaTypes.UBER_JSON)) //
|
||||
.andExpect(status().isOk()) //
|
||||
@@ -185,7 +185,7 @@ public class UberWebMvcIntegrationTest {
|
||||
* @see #784
|
||||
*/
|
||||
@Test
|
||||
public void createNewEmployee() throws Exception {
|
||||
void createNewEmployee() throws Exception {
|
||||
|
||||
String input = read(new ClassPathResource("create-employee.json", getClass()));
|
||||
|
||||
|
||||
@@ -46,7 +46,7 @@ import com.fasterxml.jackson.databind.SerializationFeature;
|
||||
* @author Oliver Gierke
|
||||
* @author Greg Turnquist
|
||||
*/
|
||||
public class VndErrorsMarshallingTest {
|
||||
class VndErrorsMarshallingTest {
|
||||
|
||||
ObjectMapper jackson2Mapper;
|
||||
|
||||
@@ -63,7 +63,7 @@ public class VndErrorsMarshallingTest {
|
||||
}
|
||||
|
||||
@BeforeEach
|
||||
public void setUp() {
|
||||
void setUp() {
|
||||
|
||||
jackson2Mapper = new com.fasterxml.jackson.databind.ObjectMapper();
|
||||
jackson2Mapper.registerModule(new Jackson2HalModule());
|
||||
@@ -80,7 +80,7 @@ public class VndErrorsMarshallingTest {
|
||||
* @see #62
|
||||
*/
|
||||
@Test
|
||||
public void jackson2Marshalling() throws Exception {
|
||||
void jackson2Marshalling() throws Exception {
|
||||
|
||||
assertThat(jackson2Mapper.writeValueAsString(errors)) //
|
||||
.isEqualToIgnoringWhitespace(json2Reference);
|
||||
@@ -90,7 +90,7 @@ public class VndErrorsMarshallingTest {
|
||||
* @see #93, #94
|
||||
*/
|
||||
@Test
|
||||
public void jackson2UnMarshalling() throws Exception {
|
||||
void jackson2UnMarshalling() throws Exception {
|
||||
assertThat(jackson2Mapper.readValue(jsonReference, VndErrors.class)).isEqualTo(errors);
|
||||
}
|
||||
|
||||
|
||||
@@ -27,10 +27,10 @@ import org.springframework.hateoas.mediatype.vnderrors.VndErrors.VndError;
|
||||
*
|
||||
* @author Oliver Gierke
|
||||
*/
|
||||
public class VndErrorsUnitTest {
|
||||
class VndErrorsUnitTest {
|
||||
|
||||
@Test
|
||||
public void rendersToStringCorrectly() {
|
||||
void rendersToStringCorrectly() {
|
||||
|
||||
VndError error = new VndErrors.VndError("logref", "message", new Link("foo", "bar"));
|
||||
assertThat(error.toString()).isEqualTo("VndError[logref: logref, message: message, links: [<foo>;rel=\"bar\"]]");
|
||||
|
||||
@@ -30,12 +30,12 @@ import org.springframework.web.bind.annotation.RequestMapping;
|
||||
* @author Kevin Conaway
|
||||
* @author Mark Paluch
|
||||
*/
|
||||
public class AnnotationMappingDiscovererUnitTest {
|
||||
class AnnotationMappingDiscovererUnitTest {
|
||||
|
||||
MappingDiscoverer discoverer = new AnnotationMappingDiscoverer(RequestMapping.class);
|
||||
|
||||
@Test
|
||||
public void rejectsNullAnnotation() {
|
||||
void rejectsNullAnnotation() {
|
||||
|
||||
assertThatIllegalArgumentException().isThrownBy(() -> {
|
||||
new AnnotationMappingDiscoverer(null);
|
||||
@@ -43,30 +43,30 @@ public class AnnotationMappingDiscovererUnitTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void discoversTypeLevelMapping() {
|
||||
void discoversTypeLevelMapping() {
|
||||
assertThat(discoverer.getMapping(MyController.class)).isEqualTo("/type");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void discoversMethodLevelMapping() throws Exception {
|
||||
void discoversMethodLevelMapping() throws Exception {
|
||||
Method method = MyController.class.getMethod("method");
|
||||
assertThat(discoverer.getMapping(method)).isEqualTo("/type/method");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void returnsNullForNonExistentTypeLevelMapping() {
|
||||
void returnsNullForNonExistentTypeLevelMapping() {
|
||||
assertThat(discoverer.getMapping(ControllerWithoutTypeLevelMapping.class)).isNull();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void resolvesMethodLevelMappingWithoutTypeLevelMapping() throws Exception {
|
||||
void resolvesMethodLevelMappingWithoutTypeLevelMapping() throws Exception {
|
||||
|
||||
Method method = ControllerWithoutTypeLevelMapping.class.getMethod("method");
|
||||
assertThat(discoverer.getMapping(method)).isEqualTo("/method");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void resolvesMethodLevelMappingWithSlashRootMapping() throws Exception {
|
||||
void resolvesMethodLevelMappingWithSlashRootMapping() throws Exception {
|
||||
|
||||
Method method = SlashRootMapping.class.getMethod("method");
|
||||
assertThat(discoverer.getMapping(method)).isEqualTo("/method");
|
||||
@@ -76,7 +76,7 @@ public class AnnotationMappingDiscovererUnitTest {
|
||||
* @see #46
|
||||
*/
|
||||
@Test
|
||||
public void treatsMissingMethodMappingAsEmptyMapping() throws Exception {
|
||||
void treatsMissingMethodMappingAsEmptyMapping() throws Exception {
|
||||
|
||||
Method method = MyController.class.getMethod("noMethodMapping");
|
||||
assertThat(discoverer.getMapping(method)).isEqualTo("/type");
|
||||
@@ -86,7 +86,7 @@ public class AnnotationMappingDiscovererUnitTest {
|
||||
* @see #114
|
||||
*/
|
||||
@Test
|
||||
public void detectsClassMappingOnSuperType() throws Exception {
|
||||
void detectsClassMappingOnSuperType() throws Exception {
|
||||
|
||||
Method method = ChildController.class.getMethod("mapping");
|
||||
assertThat(discoverer.getMapping(method)).isEqualTo("/parent/child");
|
||||
@@ -96,7 +96,7 @@ public class AnnotationMappingDiscovererUnitTest {
|
||||
* @see #114
|
||||
*/
|
||||
@Test
|
||||
public void includesTypeMappingFromChildClass() throws Exception {
|
||||
void includesTypeMappingFromChildClass() throws Exception {
|
||||
|
||||
Method method = ParentWithMethod.class.getMethod("mapping");
|
||||
assertThat(discoverer.getMapping(ChildWithTypeMapping.class, method)).isEqualTo("/child/parent");
|
||||
@@ -106,7 +106,7 @@ public class AnnotationMappingDiscovererUnitTest {
|
||||
* @see #269
|
||||
*/
|
||||
@Test
|
||||
public void handlesSlashes() throws Exception {
|
||||
void handlesSlashes() throws Exception {
|
||||
|
||||
Method method = ControllerWithoutSlashes.class.getMethod("noslash");
|
||||
assertThat(discoverer.getMapping(method)).isEqualTo("slashes/noslash");
|
||||
@@ -125,7 +125,7 @@ public class AnnotationMappingDiscovererUnitTest {
|
||||
* @see #269
|
||||
*/
|
||||
@Test
|
||||
public void removesMultipleSlashes() throws Exception {
|
||||
void removesMultipleSlashes() throws Exception {
|
||||
|
||||
Method method = ControllerWithMultipleSlashes.class.getMethod("withslash");
|
||||
|
||||
@@ -136,7 +136,7 @@ public class AnnotationMappingDiscovererUnitTest {
|
||||
* @see #186
|
||||
*/
|
||||
@Test
|
||||
public void usesFirstMappingInCaseMultipleOnesAreDefined() throws Exception {
|
||||
void usesFirstMappingInCaseMultipleOnesAreDefined() throws Exception {
|
||||
|
||||
Method method = MultipleMappingsController.class.getMethod("method");
|
||||
|
||||
@@ -147,7 +147,7 @@ public class AnnotationMappingDiscovererUnitTest {
|
||||
* @see #471
|
||||
*/
|
||||
@Test
|
||||
public void discoversMethodLevelMappingUsingComposedAnnotation() throws Exception {
|
||||
void discoversMethodLevelMappingUsingComposedAnnotation() throws Exception {
|
||||
|
||||
Method method = MyController.class.getMethod("methodWithComposedAnnotation");
|
||||
assertThat(discoverer.getMapping(method)).isEqualTo("/type/otherMethod");
|
||||
|
||||
@@ -32,10 +32,10 @@ import org.springframework.stereotype.Controller;
|
||||
*
|
||||
* @author Oliver Gierke
|
||||
*/
|
||||
public class ControllerEntityLinksFactoryBeanUnitTest {
|
||||
class ControllerEntityLinksFactoryBeanUnitTest {
|
||||
|
||||
@Test
|
||||
public void rejectsFactoryBeanIfAnnotationNotSet() {
|
||||
void rejectsFactoryBeanIfAnnotationNotSet() {
|
||||
|
||||
ControllerEntityLinksFactoryBean builder = new ControllerEntityLinksFactoryBean();
|
||||
|
||||
@@ -45,7 +45,7 @@ public class ControllerEntityLinksFactoryBeanUnitTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void discoversSampleControllerFromApplicationContext() throws Exception {
|
||||
void discoversSampleControllerFromApplicationContext() throws Exception {
|
||||
|
||||
DefaultListableBeanFactory factory = new DefaultListableBeanFactory();
|
||||
factory.registerBeanDefinition("controller", new RootBeanDefinition(SampleController.class));
|
||||
|
||||
@@ -46,12 +46,12 @@ import org.springframework.web.bind.annotation.RequestMapping;
|
||||
* @author Oliver Gierke
|
||||
*/
|
||||
@ExtendWith(MockitoExtension.class)
|
||||
public class ControllerEntityLinksUnitTest extends TestUtils {
|
||||
class ControllerEntityLinksUnitTest extends TestUtils {
|
||||
|
||||
@Mock LinkBuilderFactory<LinkBuilder> linkBuilderFactory;
|
||||
|
||||
@Test
|
||||
public void rejectsUnannotatedController() {
|
||||
void rejectsUnannotatedController() {
|
||||
|
||||
assertThatExceptionOfType(IllegalArgumentException.class) //
|
||||
.isThrownBy(() -> new ControllerEntityLinks(singletonList(InvalidController.class), linkBuilderFactory)) //
|
||||
@@ -59,20 +59,20 @@ public class ControllerEntityLinksUnitTest extends TestUtils {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void rejectsNullControllerList() {
|
||||
void rejectsNullControllerList() {
|
||||
assertThatExceptionOfType(IllegalArgumentException.class) //
|
||||
.isThrownBy(() -> new ControllerEntityLinks(null, linkBuilderFactory));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void rejectsNullLinkBuilderFactory() {
|
||||
void rejectsNullLinkBuilderFactory() {
|
||||
|
||||
assertThatExceptionOfType(IllegalArgumentException.class) //
|
||||
.isThrownBy(() -> new ControllerEntityLinks(singletonList(SampleController.class), null));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void registersControllerForEntity() {
|
||||
void registersControllerForEntity() {
|
||||
|
||||
when(linkBuilderFactory.linkTo(SampleController.class, new Object[0])).thenReturn(linkTo(SampleController.class));
|
||||
EntityLinks links = new ControllerEntityLinks(singletonList(SampleController.class), linkBuilderFactory);
|
||||
@@ -82,7 +82,7 @@ public class ControllerEntityLinksUnitTest extends TestUtils {
|
||||
}
|
||||
|
||||
@Test // #43
|
||||
public void returnsLinkBuilderForParameterizedController() {
|
||||
void returnsLinkBuilderForParameterizedController() {
|
||||
|
||||
when(linkBuilderFactory.linkTo(eq(ControllerWithParameters.class), (Object[]) any())) //
|
||||
.thenReturn(linkTo(ControllerWithParameters.class, "1"));
|
||||
@@ -95,7 +95,7 @@ public class ControllerEntityLinksUnitTest extends TestUtils {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void rejectsUnmanagedEntity() {
|
||||
void rejectsUnmanagedEntity() {
|
||||
|
||||
EntityLinks links = new ControllerEntityLinks(Arrays.asList(SampleController.class, ControllerWithParameters.class),
|
||||
linkBuilderFactory);
|
||||
@@ -111,7 +111,7 @@ public class ControllerEntityLinksUnitTest extends TestUtils {
|
||||
}
|
||||
|
||||
@Test // #843
|
||||
public void returnsItemResourceLinkForExtractorFunction() {
|
||||
void returnsItemResourceLinkForExtractorFunction() {
|
||||
|
||||
when(linkBuilderFactory.linkTo(SampleController.class, new Object[0])).thenReturn(linkTo(SampleController.class));
|
||||
|
||||
@@ -122,7 +122,7 @@ public class ControllerEntityLinksUnitTest extends TestUtils {
|
||||
}
|
||||
|
||||
@Test // #843
|
||||
public void returnsTypeEntityLinks() {
|
||||
void returnsTypeEntityLinks() {
|
||||
|
||||
when(linkBuilderFactory.linkTo(SampleController.class, new Object[0])).thenReturn(linkTo(SampleController.class));
|
||||
|
||||
@@ -136,7 +136,7 @@ public class ControllerEntityLinksUnitTest extends TestUtils {
|
||||
}
|
||||
|
||||
@Test // #843
|
||||
public void returnsExtendedTypedEntityLinks() {
|
||||
void returnsExtendedTypedEntityLinks() {
|
||||
|
||||
when(linkBuilderFactory.linkTo(SampleController.class, new Object[0])).thenReturn(linkTo(SampleController.class));
|
||||
|
||||
|
||||
@@ -30,10 +30,10 @@ import org.springframework.web.bind.annotation.RequestMapping;
|
||||
*
|
||||
* @author Oliver Gierke
|
||||
*/
|
||||
public class DelegatingEntityLinksUnitTest extends TestUtils {
|
||||
class DelegatingEntityLinksUnitTest extends TestUtils {
|
||||
|
||||
@Test
|
||||
public void rejectsNullPluginRegistry() {
|
||||
void rejectsNullPluginRegistry() {
|
||||
|
||||
assertThatIllegalArgumentException().isThrownBy(() -> {
|
||||
new DelegatingEntityLinks(null);
|
||||
@@ -41,7 +41,7 @@ public class DelegatingEntityLinksUnitTest extends TestUtils {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void throwsExceptionForUnsupportedClass() {
|
||||
void throwsExceptionForUnsupportedClass() {
|
||||
|
||||
EntityLinks links = new DelegatingEntityLinks(SimplePluginRegistry.empty());
|
||||
|
||||
@@ -51,7 +51,7 @@ public class DelegatingEntityLinksUnitTest extends TestUtils {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void supportsDomainTypeBackedByPlugin() {
|
||||
void supportsDomainTypeBackedByPlugin() {
|
||||
|
||||
EntityLinks target = mock(EntityLinks.class);
|
||||
when(target.supports(String.class)).thenReturn(true);
|
||||
@@ -62,7 +62,7 @@ public class DelegatingEntityLinksUnitTest extends TestUtils {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void delegatesLinkForCall() {
|
||||
void delegatesLinkForCall() {
|
||||
|
||||
EntityLinks target = mock(EntityLinks.class);
|
||||
when(target.supports(String.class)).thenReturn(true);
|
||||
|
||||
@@ -27,10 +27,10 @@ import org.springframework.hateoas.server.LinkRelationProvider.LookupContext;
|
||||
*
|
||||
* @author Oliver Gierke
|
||||
*/
|
||||
public class DelegatingRelProviderUnitTest {
|
||||
class DelegatingRelProviderUnitTest {
|
||||
|
||||
@Test
|
||||
public void foo() {
|
||||
void foo() {
|
||||
|
||||
LinkRelationProvider delegatingProvider = new DelegatingLinkRelationProvider(new AnnotationLinkRelationProvider(),
|
||||
new DefaultLinkRelationProvider());
|
||||
|
||||
@@ -28,7 +28,7 @@ import org.springframework.hateoas.LinkRelation;
|
||||
*
|
||||
* @author Oliver Gierke
|
||||
*/
|
||||
public class EmbeddedWrappersUnitTest {
|
||||
class EmbeddedWrappersUnitTest {
|
||||
|
||||
EmbeddedWrappers wrappers = new EmbeddedWrappers(false);
|
||||
|
||||
@@ -36,7 +36,7 @@ public class EmbeddedWrappersUnitTest {
|
||||
* @see #286
|
||||
*/
|
||||
@Test
|
||||
public void createsWrapperForEmptyCollection() {
|
||||
void createsWrapperForEmptyCollection() {
|
||||
|
||||
EmbeddedWrapper wrapper = wrappers.emptyCollectionOf(String.class);
|
||||
|
||||
@@ -49,7 +49,7 @@ public class EmbeddedWrappersUnitTest {
|
||||
* @see #286
|
||||
*/
|
||||
@Test
|
||||
public void createsWrapperForEmptyCollectionAndExplicitRel() {
|
||||
void createsWrapperForEmptyCollectionAndExplicitRel() {
|
||||
|
||||
EmbeddedWrapper wrapper = wrappers.wrap(Collections.emptySet(), LinkRelation.of("rel"));
|
||||
|
||||
@@ -62,7 +62,7 @@ public class EmbeddedWrappersUnitTest {
|
||||
* @see #286
|
||||
*/
|
||||
@Test
|
||||
public void rejectsEmptyCollectionWithoutExplicitRel() {
|
||||
void rejectsEmptyCollectionWithoutExplicitRel() {
|
||||
|
||||
assertThatIllegalArgumentException().isThrownBy(() -> {
|
||||
wrappers.wrap(Collections.emptySet());
|
||||
|
||||
@@ -26,12 +26,12 @@ import org.springframework.hateoas.server.LinkRelationProvider;
|
||||
*
|
||||
* @author Oliver Gierke
|
||||
*/
|
||||
public class EvoInflectorRelProviderUnitTest {
|
||||
class EvoInflectorRelProviderUnitTest {
|
||||
|
||||
LinkRelationProvider provider = new EvoInflectorLinkRelationProvider();
|
||||
|
||||
@Test
|
||||
public void buildsCollectionRelCorrectly() {
|
||||
void buildsCollectionRelCorrectly() {
|
||||
assertRels(City.class, "city", "cities");
|
||||
assertRels(Person.class, "person", "persons");
|
||||
}
|
||||
|
||||
@@ -26,10 +26,10 @@ import org.springframework.http.MediaType;
|
||||
*
|
||||
* @author Oliver Gierke
|
||||
*/
|
||||
public class JsonPathLinkDiscovererUnitTest {
|
||||
class JsonPathLinkDiscovererUnitTest {
|
||||
|
||||
@Test
|
||||
public void rejectsNullPattern() {
|
||||
void rejectsNullPattern() {
|
||||
|
||||
assertThatIllegalArgumentException().isThrownBy(() -> {
|
||||
new JsonPathLinkDiscoverer(null, MediaType.ALL);
|
||||
|
||||
@@ -31,17 +31,17 @@ import org.springframework.web.util.UriComponentsBuilder;
|
||||
* @author Oliver Gierke
|
||||
* @author Kamill Sokol
|
||||
*/
|
||||
public class LinkBuilderSupportUnitTest extends TestUtils {
|
||||
class LinkBuilderSupportUnitTest extends TestUtils {
|
||||
|
||||
@Test
|
||||
public void callingSlashWithEmptyStringIsNoOp() {
|
||||
void callingSlashWithEmptyStringIsNoOp() {
|
||||
|
||||
SampleLinkBuilder builder = new SampleLinkBuilder(UriComponentsBuilder.newInstance(), Collections.emptyList());
|
||||
assertThat(builder.slash("")).isEqualTo(builder);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void appendsFragmentCorrectly() {
|
||||
void appendsFragmentCorrectly() {
|
||||
|
||||
SampleLinkBuilder builder = new SampleLinkBuilder(UriComponentsBuilder.newInstance(), Collections.emptyList());
|
||||
builder = builder.slash("foo#bar");
|
||||
@@ -60,7 +60,7 @@ public class LinkBuilderSupportUnitTest extends TestUtils {
|
||||
* @see #582
|
||||
*/
|
||||
@Test
|
||||
public void appendsPathContainingColonsCorrectly() {
|
||||
void appendsPathContainingColonsCorrectly() {
|
||||
|
||||
SampleLinkBuilder builder = new SampleLinkBuilder(UriComponentsBuilder.newInstance(), Collections.emptyList());
|
||||
|
||||
|
||||
@@ -29,10 +29,10 @@ import org.springframework.core.MethodParameter;
|
||||
*
|
||||
* @author Oliver Gierke
|
||||
*/
|
||||
public class MethodParametersUnitTest {
|
||||
class MethodParametersUnitTest {
|
||||
|
||||
@Test
|
||||
public void prefersAnnotatedParameterOverDiscovered() throws Exception {
|
||||
void prefersAnnotatedParameterOverDiscovered() throws Exception {
|
||||
|
||||
Method method = Sample.class.getMethod("method", String.class, String.class, Object.class);
|
||||
MethodParameters parameters = new MethodParameters(method, new AnnotationAttribute(Qualifier.class));
|
||||
@@ -46,7 +46,7 @@ public class MethodParametersUnitTest {
|
||||
* @see #138
|
||||
*/
|
||||
@Test
|
||||
public void returnsParametersOfAGivenType() throws Exception {
|
||||
void returnsParametersOfAGivenType() throws Exception {
|
||||
|
||||
Method method = Sample.class.getMethod("method", String.class, String.class, Object.class);
|
||||
MethodParameters methodParameters = MethodParameters.of(method);
|
||||
|
||||
@@ -52,7 +52,7 @@ import org.springframework.web.client.RestTemplate;
|
||||
*/
|
||||
@ExtendWith(SpringExtension.class)
|
||||
@ContextConfiguration
|
||||
public class TypeReferencesIntegrationTest {
|
||||
class TypeReferencesIntegrationTest {
|
||||
|
||||
private static final String HAL_USER = "\"firstname\" : \"Dave\", \"lastname\" : \"Matthews\"";
|
||||
|
||||
@@ -88,7 +88,7 @@ public class TypeReferencesIntegrationTest {
|
||||
MockRestServiceServer server;
|
||||
|
||||
@BeforeEach
|
||||
public void setUp() {
|
||||
void setUp() {
|
||||
this.server = createServer(template);
|
||||
}
|
||||
|
||||
@@ -96,7 +96,7 @@ public class TypeReferencesIntegrationTest {
|
||||
* @see #306
|
||||
*/
|
||||
@Test
|
||||
public void usesResourceTypeReferenceWithHal() {
|
||||
void usesResourceTypeReferenceWithHal() {
|
||||
|
||||
server.expect(requestTo("/resource")).andRespond(withSuccess(RESOURCE_HAL, MediaTypes.HAL_JSON));
|
||||
|
||||
@@ -110,7 +110,7 @@ public class TypeReferencesIntegrationTest {
|
||||
* @see #482
|
||||
*/
|
||||
@Test
|
||||
public void usesResourceTypeReferenceWithCollectionJson() {
|
||||
void usesResourceTypeReferenceWithCollectionJson() {
|
||||
|
||||
server.expect(requestTo("/resource")).andRespond(withSuccess(RESOURCE_COLLECTION_JSON, MediaTypes.COLLECTION_JSON));
|
||||
|
||||
@@ -124,7 +124,7 @@ public class TypeReferencesIntegrationTest {
|
||||
* @see #306
|
||||
*/
|
||||
@Test
|
||||
public void usesResourcesTypeReferenceWithHal() {
|
||||
void usesResourcesTypeReferenceWithHal() {
|
||||
|
||||
server.expect(requestTo("/resources")).andRespond(withSuccess(RESOURCES_OF_USER_HAL, MediaTypes.HAL_JSON));
|
||||
|
||||
@@ -144,7 +144,7 @@ public class TypeReferencesIntegrationTest {
|
||||
* @see #482
|
||||
*/
|
||||
@Test
|
||||
public void usesResourcesTypeReferenceWithCollectionJson() {
|
||||
void usesResourcesTypeReferenceWithCollectionJson() {
|
||||
|
||||
server.expect(requestTo("/resources"))
|
||||
.andRespond(withSuccess(RESOURCES_OF_USER_COLLECTION_JSON, MediaTypes.COLLECTION_JSON));
|
||||
@@ -165,7 +165,7 @@ public class TypeReferencesIntegrationTest {
|
||||
* @see #306
|
||||
*/
|
||||
@Test
|
||||
public void usesResourcesOfResourceTypeReferenceWithHal() {
|
||||
void usesResourcesOfResourceTypeReferenceWithHal() {
|
||||
|
||||
server.expect(requestTo("/resources")).andRespond(withSuccess(RESOURCES_OF_RESOURCE_HAL, MediaTypes.HAL_JSON));
|
||||
|
||||
@@ -185,7 +185,7 @@ public class TypeReferencesIntegrationTest {
|
||||
* @see #482
|
||||
*/
|
||||
@Test
|
||||
public void usesResourcesOfResourceTypeReferenceWithCollectionJson() {
|
||||
void usesResourcesOfResourceTypeReferenceWithCollectionJson() {
|
||||
|
||||
server.expect(requestTo("/resources"))
|
||||
.andRespond(withSuccess(RESOURCES_OF_RESOURCE_COLLECTION_JSON, MediaTypes.COLLECTION_JSON));
|
||||
|
||||
@@ -52,12 +52,12 @@ import org.springframework.web.util.UriComponentsBuilder;
|
||||
* @author Ross Turner
|
||||
*/
|
||||
@Deprecated
|
||||
public class ControllerLinkBuilderFactoryUnitTest extends TestUtils {
|
||||
class ControllerLinkBuilderFactoryUnitTest extends TestUtils {
|
||||
|
||||
ControllerLinkBuilderFactory factory = new ControllerLinkBuilderFactory();
|
||||
|
||||
@Test
|
||||
public void createsLinkToControllerRoot() {
|
||||
void createsLinkToControllerRoot() {
|
||||
|
||||
Link link = factory.linkTo(PersonControllerImpl.class).withSelfRel();
|
||||
|
||||
@@ -67,7 +67,7 @@ public class ControllerLinkBuilderFactoryUnitTest extends TestUtils {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void createsLinkToParameterizedControllerRoot() {
|
||||
void createsLinkToParameterizedControllerRoot() {
|
||||
|
||||
Link link = factory.linkTo(PersonsAddressesController.class, 15).withSelfRel();
|
||||
|
||||
@@ -77,7 +77,7 @@ public class ControllerLinkBuilderFactoryUnitTest extends TestUtils {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void appliesParameterValueIfContributorConfigured() {
|
||||
void appliesParameterValueIfContributorConfigured() {
|
||||
|
||||
ControllerLinkBuilderFactory factory = new ControllerLinkBuilderFactory();
|
||||
factory.setUriComponentsContributors(Collections.singletonList(new SampleUriComponentsContributor()));
|
||||
@@ -94,7 +94,7 @@ public class ControllerLinkBuilderFactoryUnitTest extends TestUtils {
|
||||
* @see #57
|
||||
*/
|
||||
@Test
|
||||
public void usesDateTimeFormatForUriBinding() {
|
||||
void usesDateTimeFormatForUriBinding() {
|
||||
|
||||
DateTime now = DateTime.now();
|
||||
|
||||
@@ -107,7 +107,7 @@ public class ControllerLinkBuilderFactoryUnitTest extends TestUtils {
|
||||
* @see #96
|
||||
*/
|
||||
@Test
|
||||
public void linksToMethodWithPathVariableContainingBlank() {
|
||||
void linksToMethodWithPathVariableContainingBlank() {
|
||||
|
||||
Link link = linkTo(methodOn(ControllerWithMethods.class).methodWithPathVariable("with blank")).withSelfRel();
|
||||
assertThat(link.getRel()).isEqualTo(IanaLinkRelations.SELF);
|
||||
@@ -118,7 +118,7 @@ public class ControllerLinkBuilderFactoryUnitTest extends TestUtils {
|
||||
* @see #96
|
||||
*/
|
||||
@Test
|
||||
public void createsLinkToParameterizedControllerRootContainingBlank() {
|
||||
void createsLinkToParameterizedControllerRootContainingBlank() {
|
||||
|
||||
Link link = factory.linkTo(PersonsAddressesController.class, "with blank").withSelfRel();
|
||||
|
||||
@@ -131,7 +131,7 @@ public class ControllerLinkBuilderFactoryUnitTest extends TestUtils {
|
||||
* @see #209
|
||||
*/
|
||||
@Test
|
||||
public void createsLinkToControllerMethodWithMapRequestParam() {
|
||||
void createsLinkToControllerMethodWithMapRequestParam() {
|
||||
|
||||
Map<String, String> queryParams = new LinkedHashMap<>();
|
||||
queryParams.put("firstKey", "firstValue");
|
||||
@@ -148,7 +148,7 @@ public class ControllerLinkBuilderFactoryUnitTest extends TestUtils {
|
||||
* @see #209
|
||||
*/
|
||||
@Test
|
||||
public void createsLinkToControllerMethodWithMultiValueMapRequestParam() {
|
||||
void createsLinkToControllerMethodWithMultiValueMapRequestParam() {
|
||||
|
||||
MultiValueMap<String, String> queryParams = new LinkedMultiValueMap<>();
|
||||
queryParams.put("key1", Arrays.asList("value1a", "value1b"));
|
||||
@@ -166,7 +166,7 @@ public class ControllerLinkBuilderFactoryUnitTest extends TestUtils {
|
||||
* @see #372
|
||||
*/
|
||||
@Test
|
||||
public void createsLinkToParameterizedControllerRootWithParameterMap() {
|
||||
void createsLinkToParameterizedControllerRootWithParameterMap() {
|
||||
|
||||
Link link = factory.linkTo(PersonsAddressesController.class, Collections.singletonMap("id", "17")).withSelfRel();
|
||||
|
||||
|
||||
@@ -29,13 +29,13 @@ import org.springframework.web.context.request.RequestContextHolder;
|
||||
* @author Greg Turnquist
|
||||
*/
|
||||
@Deprecated
|
||||
public class ControllerLinkBuilderOutsideSpringMvcUnitTest {
|
||||
class ControllerLinkBuilderOutsideSpringMvcUnitTest {
|
||||
|
||||
/**
|
||||
* Clear out any existing request attributes left behind by other tests
|
||||
*/
|
||||
@BeforeEach
|
||||
public void setUp() {
|
||||
void setUp() {
|
||||
RequestContextHolder.setRequestAttributes(null);
|
||||
}
|
||||
|
||||
@@ -43,7 +43,7 @@ public class ControllerLinkBuilderOutsideSpringMvcUnitTest {
|
||||
* @see #408
|
||||
*/
|
||||
@Test
|
||||
public void requestingLinkOutsideWebRequest() {
|
||||
void requestingLinkOutsideWebRequest() {
|
||||
|
||||
Link link = linkTo(
|
||||
methodOn(ControllerLinkBuilderUnitTest.PersonsAddressesController.class, 15).getAddressesForCountry("DE"))
|
||||
|
||||
@@ -51,10 +51,10 @@ import org.springframework.web.util.UriComponentsBuilder;
|
||||
* @author Greg Turnquist
|
||||
*/
|
||||
@Deprecated
|
||||
public class ControllerLinkBuilderUnitTest extends TestUtils {
|
||||
class ControllerLinkBuilderUnitTest extends TestUtils {
|
||||
|
||||
@Test
|
||||
public void createsLinkToControllerRoot() {
|
||||
void createsLinkToControllerRoot() {
|
||||
|
||||
Link link = linkTo(PersonControllerImpl.class).withSelfRel();
|
||||
assertThat(link.getRel()).isEqualTo(IanaLinkRelations.SELF);
|
||||
@@ -62,7 +62,7 @@ public class ControllerLinkBuilderUnitTest extends TestUtils {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void createsLinkToParameterizedControllerRoot() {
|
||||
void createsLinkToParameterizedControllerRoot() {
|
||||
|
||||
Link link = linkTo(PersonsAddressesController.class, 15).withSelfRel();
|
||||
|
||||
@@ -74,7 +74,7 @@ public class ControllerLinkBuilderUnitTest extends TestUtils {
|
||||
* @see #70
|
||||
*/
|
||||
@Test
|
||||
public void createsLinkToMethodOnParameterizedControllerRoot() {
|
||||
void createsLinkToMethodOnParameterizedControllerRoot() {
|
||||
|
||||
Link link = linkTo(methodOn(PersonsAddressesController.class, 15).getAddressesForCountry("DE")).withSelfRel();
|
||||
assertThat(link.getRel()).isEqualTo(IanaLinkRelations.SELF);
|
||||
@@ -82,7 +82,7 @@ public class ControllerLinkBuilderUnitTest extends TestUtils {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void createsLinkToSubResource() {
|
||||
void createsLinkToSubResource() {
|
||||
|
||||
Link link = linkTo(PersonControllerImpl.class).slash("something").withSelfRel();
|
||||
assertThat(link.getRel()).isEqualTo(IanaLinkRelations.SELF);
|
||||
@@ -90,7 +90,7 @@ public class ControllerLinkBuilderUnitTest extends TestUtils {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void createsLinkWithCustomRel() {
|
||||
void createsLinkWithCustomRel() {
|
||||
|
||||
Link link = linkTo(PersonControllerImpl.class).withRel(IanaLinkRelations.NEXT);
|
||||
|
||||
@@ -102,19 +102,19 @@ public class ControllerLinkBuilderUnitTest extends TestUtils {
|
||||
* @see #186
|
||||
*/
|
||||
@Test
|
||||
public void usesFirstMappingInCaseMultipleOnesAreDefined() {
|
||||
void usesFirstMappingInCaseMultipleOnesAreDefined() {
|
||||
assertThat(linkTo(InvalidController.class).withSelfRel().getHref()).endsWith("/persons");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void createsLinkToUnmappedController() {
|
||||
void createsLinkToUnmappedController() {
|
||||
|
||||
Link link = linkTo(UnmappedController.class).withSelfRel();
|
||||
assertThat(link.getHref()).isEqualTo("http://localhost");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void appendingNullIsANoOp() {
|
||||
void appendingNullIsANoOp() {
|
||||
|
||||
Link link = linkTo(PersonControllerImpl.class).slash(null).withSelfRel();
|
||||
assertThat(link.getHref()).endsWith("/people");
|
||||
@@ -124,7 +124,7 @@ public class ControllerLinkBuilderUnitTest extends TestUtils {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void linksToMethod() {
|
||||
void linksToMethod() {
|
||||
|
||||
Link link = linkTo(methodOn(ControllerWithMethods.class).myMethod(null)).withSelfRel();
|
||||
assertPointsToMockServer(link);
|
||||
@@ -132,7 +132,7 @@ public class ControllerLinkBuilderUnitTest extends TestUtils {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void linksToMethodWithPathVariable() {
|
||||
void linksToMethodWithPathVariable() {
|
||||
|
||||
Link link = linkTo(methodOn(ControllerWithMethods.class).methodWithPathVariable("1")).withSelfRel();
|
||||
assertPointsToMockServer(link);
|
||||
@@ -143,7 +143,7 @@ public class ControllerLinkBuilderUnitTest extends TestUtils {
|
||||
* @see #33
|
||||
*/
|
||||
@Test
|
||||
public void usesForwardedHostAsHostIfHeaderIsSet() {
|
||||
void usesForwardedHostAsHostIfHeaderIsSet() {
|
||||
|
||||
request.addHeader("X-Forwarded-Host", "somethingDifferent");
|
||||
|
||||
@@ -157,7 +157,7 @@ public class ControllerLinkBuilderUnitTest extends TestUtils {
|
||||
* @see #112
|
||||
*/
|
||||
@Test
|
||||
public void usesForwardedSslIfHeaderIsSet() {
|
||||
void usesForwardedSslIfHeaderIsSet() {
|
||||
|
||||
request.addHeader("X-Forwarded-Ssl", "on");
|
||||
|
||||
@@ -171,7 +171,7 @@ public class ControllerLinkBuilderUnitTest extends TestUtils {
|
||||
* @see #112
|
||||
*/
|
||||
@Test
|
||||
public void usesForwardedSslIfHeaderIsSetOff() {
|
||||
void usesForwardedSslIfHeaderIsSetOff() {
|
||||
|
||||
request.addHeader("X-Forwarded-Ssl", "off");
|
||||
|
||||
@@ -185,7 +185,7 @@ public class ControllerLinkBuilderUnitTest extends TestUtils {
|
||||
* @see #112
|
||||
*/
|
||||
@Test
|
||||
public void usesForwardedSslAndHostIfHeaderIsSet() {
|
||||
void usesForwardedSslAndHostIfHeaderIsSet() {
|
||||
|
||||
request.addHeader("X-Forwarded-Host", "somethingDifferent");
|
||||
request.addHeader("X-Forwarded-Ssl", "on");
|
||||
@@ -200,7 +200,7 @@ public class ControllerLinkBuilderUnitTest extends TestUtils {
|
||||
* @see #26, #39
|
||||
*/
|
||||
@Test
|
||||
public void addsRequestParametersHandedIntoSlashCorrectly() {
|
||||
void addsRequestParametersHandedIntoSlashCorrectly() {
|
||||
|
||||
Link link = linkTo(PersonController.class).slash("?foo=bar").withSelfRel();
|
||||
|
||||
@@ -212,7 +212,7 @@ public class ControllerLinkBuilderUnitTest extends TestUtils {
|
||||
* @see #26, #39
|
||||
*/
|
||||
@Test
|
||||
public void linksToMethodWithPathVariableAndRequestParams() {
|
||||
void linksToMethodWithPathVariableAndRequestParams() {
|
||||
|
||||
Link link = linkTo(methodOn(ControllerWithMethods.class).methodForNextPage("1", 10, 5)).withSelfRel();
|
||||
|
||||
@@ -228,7 +228,7 @@ public class ControllerLinkBuilderUnitTest extends TestUtils {
|
||||
* @see #26, #39
|
||||
*/
|
||||
@Test
|
||||
public void linksToMethodWithPathVariableAndMultiValueRequestParams() {
|
||||
void linksToMethodWithPathVariableAndMultiValueRequestParams() {
|
||||
|
||||
Link link = linkTo(
|
||||
methodOn(ControllerWithMethods.class).methodWithMultiValueRequestParams("1", Arrays.asList(3, 7), 5))
|
||||
@@ -246,7 +246,7 @@ public class ControllerLinkBuilderUnitTest extends TestUtils {
|
||||
* @see #26, #39
|
||||
*/
|
||||
@Test
|
||||
public void returnsUriComponentsBuilder() {
|
||||
void returnsUriComponentsBuilder() {
|
||||
|
||||
UriComponents components = linkTo(PersonController.class).slash("something?foo=bar").toUriComponentsBuilder()
|
||||
.build();
|
||||
@@ -259,7 +259,7 @@ public class ControllerLinkBuilderUnitTest extends TestUtils {
|
||||
* @see #90
|
||||
*/
|
||||
@Test
|
||||
public void usesForwardedHostAndPortFromHeader() {
|
||||
void usesForwardedHostAndPortFromHeader() {
|
||||
|
||||
request.addHeader("X-Forwarded-Host", "foobar:8088");
|
||||
|
||||
@@ -273,7 +273,7 @@ public class ControllerLinkBuilderUnitTest extends TestUtils {
|
||||
* @see #90
|
||||
*/
|
||||
@Test
|
||||
public void usesFirstHostOfXForwardedHost() {
|
||||
void usesFirstHostOfXForwardedHost() {
|
||||
|
||||
request.addHeader("X-Forwarded-Host", "barfoo:8888, localhost:8088");
|
||||
|
||||
@@ -287,7 +287,7 @@ public class ControllerLinkBuilderUnitTest extends TestUtils {
|
||||
* @see #122, #169
|
||||
*/
|
||||
@Test
|
||||
public void appendsOptionalParameterVariableForUnsetParameter() {
|
||||
void appendsOptionalParameterVariableForUnsetParameter() {
|
||||
|
||||
Link link = linkTo(methodOn(ControllerWithMethods.class).methodForOptionalNextPage(null)).withSelfRel();
|
||||
|
||||
@@ -299,7 +299,7 @@ public class ControllerLinkBuilderUnitTest extends TestUtils {
|
||||
* @see #122, #169
|
||||
*/
|
||||
@Test
|
||||
public void rejectsMissingPathVariable() {
|
||||
void rejectsMissingPathVariable() {
|
||||
|
||||
ControllerLinkBuilder builder = linkTo(methodOn(ControllerWithMethods.class).methodWithPathVariable(null));
|
||||
|
||||
@@ -312,7 +312,7 @@ public class ControllerLinkBuilderUnitTest extends TestUtils {
|
||||
* @see #122, #169
|
||||
*/
|
||||
@Test
|
||||
public void rejectsMissingRequiredRequestParam() {
|
||||
void rejectsMissingRequiredRequestParam() {
|
||||
|
||||
Link link = linkTo(methodOn(ControllerWithMethods.class).methodWithRequestParam(null)).withSelfRel();
|
||||
|
||||
@@ -327,7 +327,7 @@ public class ControllerLinkBuilderUnitTest extends TestUtils {
|
||||
* @see #170
|
||||
*/
|
||||
@Test
|
||||
public void usesForwardedPortFromHeader() {
|
||||
void usesForwardedPortFromHeader() {
|
||||
|
||||
request.addHeader("X-Forwarded-Host", "foobarhost");
|
||||
request.addHeader("X-Forwarded-Port", "9090");
|
||||
@@ -344,7 +344,7 @@ public class ControllerLinkBuilderUnitTest extends TestUtils {
|
||||
* @see #170
|
||||
*/
|
||||
@Test
|
||||
public void usesForwardedHostFromHeaderWithDefaultPort() {
|
||||
void usesForwardedHostFromHeaderWithDefaultPort() {
|
||||
|
||||
request.addHeader("X-Forwarded-Host", "foobarhost");
|
||||
request.setServerPort(8080);
|
||||
@@ -359,7 +359,7 @@ public class ControllerLinkBuilderUnitTest extends TestUtils {
|
||||
* @see #114
|
||||
*/
|
||||
@Test
|
||||
public void discoversParentClassTypeMappingForInvocation() {
|
||||
void discoversParentClassTypeMappingForInvocation() {
|
||||
|
||||
Link link = linkTo(methodOn(ChildController.class).myMethod()).withSelfRel();
|
||||
assertThat(link.getHref()).endsWith("/parent/child");
|
||||
@@ -369,7 +369,7 @@ public class ControllerLinkBuilderUnitTest extends TestUtils {
|
||||
* @see #114
|
||||
*/
|
||||
@Test
|
||||
public void includesTypeMappingFromChildClass() {
|
||||
void includesTypeMappingFromChildClass() {
|
||||
|
||||
Link link = linkTo(methodOn(ChildWithTypeMapping.class).myMethod()).withSelfRel();
|
||||
assertThat(link.getHref()).endsWith("/child/parent");
|
||||
@@ -379,7 +379,7 @@ public class ControllerLinkBuilderUnitTest extends TestUtils {
|
||||
* @see #96
|
||||
*/
|
||||
@Test
|
||||
public void linksToMethodWithPathVariableContainingBlank() {
|
||||
void linksToMethodWithPathVariableContainingBlank() {
|
||||
|
||||
Link link = linkTo(methodOn(ControllerWithMethods.class).methodWithPathVariable("with blank")).withSelfRel();
|
||||
|
||||
@@ -391,7 +391,7 @@ public class ControllerLinkBuilderUnitTest extends TestUtils {
|
||||
* @see #192
|
||||
*/
|
||||
@Test
|
||||
public void usesRootMappingOfTargetClassForMethodsOfParentClass() {
|
||||
void usesRootMappingOfTargetClassForMethodsOfParentClass() {
|
||||
|
||||
Link link = linkTo(methodOn(ChildControllerWithRootMapping.class) //
|
||||
.someEmptyMappedMethod()) //
|
||||
@@ -404,7 +404,7 @@ public class ControllerLinkBuilderUnitTest extends TestUtils {
|
||||
* @see #192
|
||||
*/
|
||||
@Test
|
||||
public void usesRootMappingOfTargetClassForMethodsOfParent() throws Exception {
|
||||
void usesRootMappingOfTargetClassForMethodsOfParent() throws Exception {
|
||||
|
||||
Method method = ParentControllerWithoutRootMapping.class.getMethod("someEmptyMappedMethod");
|
||||
|
||||
@@ -416,7 +416,7 @@ public class ControllerLinkBuilderUnitTest extends TestUtils {
|
||||
* @see #257, #107
|
||||
*/
|
||||
@Test
|
||||
public void usesXForwardedProtoHeaderAsLinkSchema() {
|
||||
void usesXForwardedProtoHeaderAsLinkSchema() {
|
||||
|
||||
for (String proto : Arrays.asList("http", "https")) {
|
||||
|
||||
@@ -434,7 +434,7 @@ public class ControllerLinkBuilderUnitTest extends TestUtils {
|
||||
* @see #257, #107
|
||||
*/
|
||||
@Test
|
||||
public void usesProtoValueFromForwardedHeaderAsLinkSchema() {
|
||||
void usesProtoValueFromForwardedHeaderAsLinkSchema() {
|
||||
|
||||
for (String proto : Arrays.asList("http", "https")) {
|
||||
|
||||
@@ -452,7 +452,7 @@ public class ControllerLinkBuilderUnitTest extends TestUtils {
|
||||
* @see #257, #107
|
||||
*/
|
||||
@Test
|
||||
public void favorsStandardForwardHeaderOverXForwardedProto() {
|
||||
void favorsStandardForwardHeaderOverXForwardedProto() {
|
||||
|
||||
request.addHeader("X-Forwarded-Proto", "foo");
|
||||
request.addHeader("Forwarded", "proto=bar");
|
||||
@@ -467,7 +467,7 @@ public class ControllerLinkBuilderUnitTest extends TestUtils {
|
||||
* @see #331
|
||||
*/
|
||||
@Test
|
||||
public void linksToMethodWithRequestParamImplicitlySetToFalse() {
|
||||
void linksToMethodWithRequestParamImplicitlySetToFalse() {
|
||||
|
||||
Link link = linkTo(methodOn(ControllerWithMethods.class).methodForOptionalSizeWithDefaultValue(null)).withSelfRel();
|
||||
|
||||
@@ -478,7 +478,7 @@ public class ControllerLinkBuilderUnitTest extends TestUtils {
|
||||
* @see #398
|
||||
*/
|
||||
@Test
|
||||
public void encodesRequestParameterWithSpecialValue() {
|
||||
void encodesRequestParameterWithSpecialValue() {
|
||||
|
||||
Link link = linkTo(methodOn(ControllerWithMethods.class).methodWithRequestParam("Spring#\n")).withSelfRel();
|
||||
|
||||
@@ -490,7 +490,7 @@ public class ControllerLinkBuilderUnitTest extends TestUtils {
|
||||
* @see #169
|
||||
*/
|
||||
@Test
|
||||
public void createsPartiallyExpandedLink() {
|
||||
void createsPartiallyExpandedLink() {
|
||||
|
||||
Link link = linkTo(methodOn(PersonsAddressesController.class, "some id").getAddressesForCountry(null))
|
||||
.withSelfRel();
|
||||
@@ -503,7 +503,7 @@ public class ControllerLinkBuilderUnitTest extends TestUtils {
|
||||
* @see #169
|
||||
*/
|
||||
@Test
|
||||
public void addsRequestParameterVariablesForMissingRequiredParameter() {
|
||||
void addsRequestParameterVariablesForMissingRequiredParameter() {
|
||||
|
||||
assertThatIllegalArgumentException().isThrownBy(() -> {
|
||||
Link link = linkTo(methodOn(ControllerWithMethods.class).methodForNextPage("1", 10, null)).withSelfRel();
|
||||
@@ -518,7 +518,7 @@ public class ControllerLinkBuilderUnitTest extends TestUtils {
|
||||
* @see #169
|
||||
*/
|
||||
@Test
|
||||
public void addsOptionalRequestParameterTemplateForMissingValue() {
|
||||
void addsOptionalRequestParameterTemplateForMissingValue() {
|
||||
|
||||
Link link = linkTo(methodOn(ControllerWithMethods.class).methodForNextPage("1", null, 5)).withSelfRel();
|
||||
|
||||
@@ -534,7 +534,7 @@ public class ControllerLinkBuilderUnitTest extends TestUtils {
|
||||
* @see #509
|
||||
*/
|
||||
@Test
|
||||
public void supportsTwoProxiesAddingXForwardedPort() {
|
||||
void supportsTwoProxiesAddingXForwardedPort() {
|
||||
|
||||
request.addHeader("X-Forwarded-Port", "1443,8443");
|
||||
request.addHeader("X-Forwarded-Host", "proxy1,proxy2");
|
||||
@@ -548,7 +548,7 @@ public class ControllerLinkBuilderUnitTest extends TestUtils {
|
||||
* @see #509
|
||||
*/
|
||||
@Test
|
||||
public void resolvesAmbiguousXForwardedHeaders() {
|
||||
void resolvesAmbiguousXForwardedHeaders() {
|
||||
|
||||
request.addHeader("X-Forwarded-Proto", "http");
|
||||
request.addHeader("X-Forwarded-Ssl", "on");
|
||||
@@ -560,7 +560,7 @@ public class ControllerLinkBuilderUnitTest extends TestUtils {
|
||||
* @see #527
|
||||
*/
|
||||
@Test
|
||||
public void createsLinkRelativeToContextRoot() {
|
||||
void createsLinkRelativeToContextRoot() {
|
||||
|
||||
request.setContextPath("/ctx");
|
||||
request.setServletPath("/foo");
|
||||
@@ -573,7 +573,7 @@ public class ControllerLinkBuilderUnitTest extends TestUtils {
|
||||
* @see #639
|
||||
*/
|
||||
@Test
|
||||
public void considersEmptyOptionalMethodParameterOptional() {
|
||||
void considersEmptyOptionalMethodParameterOptional() {
|
||||
|
||||
Link link = linkTo(methodOn(ControllerWithMethods.class).methodWithJdk8Optional(Optional.empty())).withSelfRel();
|
||||
|
||||
@@ -585,7 +585,7 @@ public class ControllerLinkBuilderUnitTest extends TestUtils {
|
||||
* @see #639
|
||||
*/
|
||||
@Test
|
||||
public void considersOptionalWithValueMethodParameterOptional() {
|
||||
void considersOptionalWithValueMethodParameterOptional() {
|
||||
|
||||
Link link = linkTo(methodOn(ControllerWithMethods.class).methodWithJdk8Optional(Optional.of(1))).withSelfRel();
|
||||
|
||||
@@ -597,7 +597,7 @@ public class ControllerLinkBuilderUnitTest extends TestUtils {
|
||||
* @see #617
|
||||
*/
|
||||
@Test
|
||||
public void alternativePathVariableParameter() {
|
||||
void alternativePathVariableParameter() {
|
||||
|
||||
Link link = linkTo(methodOn(ControllerWithMethods.class).methodWithAlternatePathVariable("bar")).withSelfRel();
|
||||
assertThat(link.getHref()).isEqualTo("http://localhost/something/bar/foo");
|
||||
|
||||
@@ -30,10 +30,10 @@ import org.springframework.web.bind.annotation.RequestMapping;
|
||||
/**
|
||||
* @author Oliver Gierke
|
||||
*/
|
||||
public class DummyInvocationUtilsUnitTest extends TestUtils {
|
||||
class DummyInvocationUtilsUnitTest extends TestUtils {
|
||||
|
||||
@Test
|
||||
public void pathVariableWithDefaultParameter() {
|
||||
void pathVariableWithDefaultParameter() {
|
||||
|
||||
Link link = linkTo(methodOn(SampleController.class).someMethod(1L)).withSelfRel();
|
||||
|
||||
@@ -41,7 +41,7 @@ public class DummyInvocationUtilsUnitTest extends TestUtils {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void pathVariableWithNameParameter() {
|
||||
void pathVariableWithNameParameter() {
|
||||
|
||||
Link link = linkTo(methodOn(SampleController.class).someOtherMethod(2L)).withSelfRel();
|
||||
|
||||
|
||||
@@ -32,7 +32,7 @@ import org.springframework.http.ResponseEntity;
|
||||
*
|
||||
* @author Oliver Gierke
|
||||
*/
|
||||
public class HeaderLinksResponseEntityUnitTest {
|
||||
class HeaderLinksResponseEntityUnitTest {
|
||||
|
||||
static final Object CONTENT = new Object();
|
||||
static final Link LINK = new Link("href", "rel");
|
||||
@@ -41,7 +41,7 @@ public class HeaderLinksResponseEntityUnitTest {
|
||||
ResponseEntity<EntityModel<Object>> entity = new ResponseEntity<>(resource, HttpStatus.OK);
|
||||
|
||||
@Test
|
||||
public void movesRootResourceLinksToHeader() {
|
||||
void movesRootResourceLinksToHeader() {
|
||||
|
||||
HttpEntity<EntityModel<Object>> wrapper = HeaderLinksResponseEntity.wrap(entity);
|
||||
|
||||
@@ -57,7 +57,7 @@ public class HeaderLinksResponseEntityUnitTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void defaultStatusCodeToOkForHttpEntities() {
|
||||
void defaultStatusCodeToOkForHttpEntities() {
|
||||
|
||||
HttpEntity<EntityModel<Object>> entity = new HttpEntity<>(resource);
|
||||
ResponseEntity<EntityModel<Object>> wrappedEntity = HeaderLinksResponseEntity.wrap(entity);
|
||||
|
||||
@@ -74,7 +74,7 @@ import org.springframework.web.servlet.config.annotation.EnableWebMvc;
|
||||
@ExtendWith(SpringExtension.class)
|
||||
@WebAppConfiguration
|
||||
@ContextConfiguration
|
||||
public class MultiMediaTypeWebMvcIntegrationTest {
|
||||
class MultiMediaTypeWebMvcIntegrationTest {
|
||||
|
||||
@Autowired WebApplicationContext context;
|
||||
|
||||
@@ -83,7 +83,7 @@ public class MultiMediaTypeWebMvcIntegrationTest {
|
||||
private static Map<Integer, Employee> EMPLOYEES;
|
||||
|
||||
@BeforeEach
|
||||
public void setUp() {
|
||||
void setUp() {
|
||||
|
||||
this.mockMvc = webAppContextSetup(this.context).build();
|
||||
|
||||
@@ -94,7 +94,7 @@ public class MultiMediaTypeWebMvcIntegrationTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void singleEmployeeCollectionJson() throws Exception {
|
||||
void singleEmployeeCollectionJson() throws Exception {
|
||||
|
||||
this.mockMvc.perform(get("/employees/0").accept(MediaTypes.COLLECTION_JSON_VALUE)) //
|
||||
.andExpect(status().isOk()) //
|
||||
@@ -124,7 +124,7 @@ public class MultiMediaTypeWebMvcIntegrationTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void collectionOfEmployeesCollectionJson() throws Exception {
|
||||
void collectionOfEmployeesCollectionJson() throws Exception {
|
||||
|
||||
this.mockMvc.perform(get("/employees").accept(MediaTypes.COLLECTION_JSON_VALUE)) //
|
||||
.andExpect(status().isOk()) //
|
||||
@@ -159,7 +159,7 @@ public class MultiMediaTypeWebMvcIntegrationTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void createNewEmployeeCollectionJson() throws Exception {
|
||||
void createNewEmployeeCollectionJson() throws Exception {
|
||||
|
||||
String specBasedJson = MappingUtils
|
||||
.read(new ClassPathResource("spec-part7-adjusted.json", CollectionJsonLinkDiscoverer.class));
|
||||
@@ -195,7 +195,7 @@ public class MultiMediaTypeWebMvcIntegrationTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void singleEmployeeHalForms() throws Exception {
|
||||
void singleEmployeeHalForms() throws Exception {
|
||||
|
||||
this.mockMvc.perform(get("/employees/0").accept(MediaTypes.HAL_FORMS_JSON)) //
|
||||
.andExpect(status().isOk()) //
|
||||
@@ -220,7 +220,7 @@ public class MultiMediaTypeWebMvcIntegrationTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void collectionOfEmployeesHalForms() throws Exception {
|
||||
void collectionOfEmployeesHalForms() throws Exception {
|
||||
|
||||
this.mockMvc.perform(get("/employees").accept(MediaTypes.HAL_FORMS_JSON)) //
|
||||
.andExpect(status().isOk()) //
|
||||
@@ -243,7 +243,7 @@ public class MultiMediaTypeWebMvcIntegrationTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void createNewEmployeeHalForms() throws Exception {
|
||||
void createNewEmployeeHalForms() throws Exception {
|
||||
|
||||
String specBasedJson = MappingUtils.read(new ClassPathResource("new-employee.json", HalFormsLinkDiscoverer.class));
|
||||
|
||||
@@ -274,7 +274,7 @@ public class MultiMediaTypeWebMvcIntegrationTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void singleEmployeeUber() throws Exception {
|
||||
void singleEmployeeUber() throws Exception {
|
||||
|
||||
this.mockMvc.perform(get("/employees/0").accept(MediaTypes.UBER_JSON)) //
|
||||
.andExpect(status().isOk()) //
|
||||
@@ -312,7 +312,7 @@ public class MultiMediaTypeWebMvcIntegrationTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void collectionOfEmployeesUber() throws Exception {
|
||||
void collectionOfEmployeesUber() throws Exception {
|
||||
|
||||
this.mockMvc.perform(get("/employees").accept(MediaTypes.UBER_JSON)) //
|
||||
.andExpect(status().isOk()) //
|
||||
@@ -387,7 +387,7 @@ public class MultiMediaTypeWebMvcIntegrationTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void createNewEmployeeUber() throws Exception {
|
||||
void createNewEmployeeUber() throws Exception {
|
||||
|
||||
String input = MappingUtils.read(new ClassPathResource("create-employee.json", UberLinkDiscoverer.class));
|
||||
|
||||
|
||||
@@ -59,7 +59,7 @@ import org.springframework.web.method.support.HandlerMethodReturnValueHandler;
|
||||
* @author Jon Brisbin
|
||||
*/
|
||||
@ExtendWith(MockitoExtension.class)
|
||||
public class ResourceProcessorHandlerMethodReturnValueHandlerUnitTest {
|
||||
class ResourceProcessorHandlerMethodReturnValueHandlerUnitTest {
|
||||
|
||||
static final EntityModel<String> FOO = new EntityModel<>("foo");
|
||||
static final CollectionModel<EntityModel<String>> FOOS = new CollectionModel<>(Collections.singletonList(FOO));
|
||||
@@ -95,7 +95,7 @@ public class ResourceProcessorHandlerMethodReturnValueHandlerUnitTest {
|
||||
List<RepresentationModelProcessor<?>> resourceProcessors;
|
||||
|
||||
@BeforeEach
|
||||
public void setUp() {
|
||||
void setUp() {
|
||||
resourceProcessors = new ArrayList<>();
|
||||
}
|
||||
|
||||
@@ -103,7 +103,7 @@ public class ResourceProcessorHandlerMethodReturnValueHandlerUnitTest {
|
||||
* @see #362
|
||||
*/
|
||||
@Test
|
||||
public void supportsIfDelegateSupports() {
|
||||
void supportsIfDelegateSupports() {
|
||||
assertSupport(true);
|
||||
}
|
||||
|
||||
@@ -111,7 +111,7 @@ public class ResourceProcessorHandlerMethodReturnValueHandlerUnitTest {
|
||||
* @see #362
|
||||
*/
|
||||
@Test
|
||||
public void doesNotSupportIfDelegateDoesNot() {
|
||||
void doesNotSupportIfDelegateDoesNot() {
|
||||
assertSupport(false);
|
||||
}
|
||||
|
||||
@@ -119,7 +119,7 @@ public class ResourceProcessorHandlerMethodReturnValueHandlerUnitTest {
|
||||
* @see #362
|
||||
*/
|
||||
@Test
|
||||
public void postProcessesStringResource() throws Exception {
|
||||
void postProcessesStringResource() throws Exception {
|
||||
|
||||
resourceProcessors.add(StringResourceProcessor.INSTANCE);
|
||||
resourceProcessors.add(LongResourceProcessor.INSTANCE);
|
||||
@@ -131,7 +131,7 @@ public class ResourceProcessorHandlerMethodReturnValueHandlerUnitTest {
|
||||
* @see #362
|
||||
*/
|
||||
@Test
|
||||
public void postProcessesStringResourceInResponseEntity() throws Exception {
|
||||
void postProcessesStringResourceInResponseEntity() throws Exception {
|
||||
|
||||
resourceProcessors.add(StringResourceProcessor.INSTANCE);
|
||||
resourceProcessors.add(LongResourceProcessor.INSTANCE);
|
||||
@@ -143,7 +143,7 @@ public class ResourceProcessorHandlerMethodReturnValueHandlerUnitTest {
|
||||
* @see #362
|
||||
*/
|
||||
@Test
|
||||
public void postProcessesStringResourceInWildcardResponseEntity() throws Exception {
|
||||
void postProcessesStringResourceInWildcardResponseEntity() throws Exception {
|
||||
|
||||
resourceProcessors.add(StringResourceProcessor.INSTANCE);
|
||||
resourceProcessors.add(LongResourceProcessor.INSTANCE);
|
||||
@@ -155,7 +155,7 @@ public class ResourceProcessorHandlerMethodReturnValueHandlerUnitTest {
|
||||
* @see #362
|
||||
*/
|
||||
@Test
|
||||
public void postProcessesStringResources() throws Exception {
|
||||
void postProcessesStringResources() throws Exception {
|
||||
|
||||
resourceProcessors.add(StringResourcesProcessor.INSTANCE);
|
||||
resourceProcessors.add(LongResourceProcessor.INSTANCE);
|
||||
@@ -167,7 +167,7 @@ public class ResourceProcessorHandlerMethodReturnValueHandlerUnitTest {
|
||||
* @see #362
|
||||
*/
|
||||
@Test
|
||||
public void postProcessesSpecializedStringResource() throws Exception {
|
||||
void postProcessesSpecializedStringResource() throws Exception {
|
||||
|
||||
resourceProcessors.add(SpecializedStringResourceProcessor.INSTANCE);
|
||||
resourceProcessors.add(LongResourceProcessor.INSTANCE);
|
||||
@@ -179,7 +179,7 @@ public class ResourceProcessorHandlerMethodReturnValueHandlerUnitTest {
|
||||
* @see #362
|
||||
*/
|
||||
@Test
|
||||
public void postProcessesSpecializedStringUsingStringResourceProcessor() throws Exception {
|
||||
void postProcessesSpecializedStringUsingStringResourceProcessor() throws Exception {
|
||||
|
||||
resourceProcessors.add(StringResourceProcessor.INSTANCE);
|
||||
resourceProcessors.add(LongResourceProcessor.INSTANCE);
|
||||
@@ -191,7 +191,7 @@ public class ResourceProcessorHandlerMethodReturnValueHandlerUnitTest {
|
||||
* @see #362
|
||||
*/
|
||||
@Test
|
||||
public void postProcessesLongResource() throws Exception {
|
||||
void postProcessesLongResource() throws Exception {
|
||||
|
||||
resourceProcessors.add(StringResourceProcessor.INSTANCE);
|
||||
resourceProcessors.add(LongResourceProcessor.INSTANCE);
|
||||
@@ -203,7 +203,7 @@ public class ResourceProcessorHandlerMethodReturnValueHandlerUnitTest {
|
||||
* @see #362
|
||||
*/
|
||||
@Test
|
||||
public void postProcessesSpecializedLongResource() throws Exception {
|
||||
void postProcessesSpecializedLongResource() throws Exception {
|
||||
|
||||
resourceProcessors.add(StringResourceProcessor.INSTANCE);
|
||||
resourceProcessors.add(SpecializedLongResourceProcessor.INSTANCE);
|
||||
@@ -215,7 +215,7 @@ public class ResourceProcessorHandlerMethodReturnValueHandlerUnitTest {
|
||||
* @see #362
|
||||
*/
|
||||
@Test
|
||||
public void doesNotPostProcesseLongResourceWithSpecializedLongResourceProcessor() throws Exception {
|
||||
void doesNotPostProcesseLongResourceWithSpecializedLongResourceProcessor() throws Exception {
|
||||
|
||||
resourceProcessors.add(StringResourceProcessor.INSTANCE);
|
||||
resourceProcessors.add(SpecializedLongResourceProcessor.INSTANCE);
|
||||
@@ -227,7 +227,7 @@ public class ResourceProcessorHandlerMethodReturnValueHandlerUnitTest {
|
||||
* @see #362
|
||||
*/
|
||||
@Test
|
||||
public void postProcessesSpecializedLongResourceUsingLongResourceProcessor() throws Exception {
|
||||
void postProcessesSpecializedLongResourceUsingLongResourceProcessor() throws Exception {
|
||||
|
||||
resourceProcessors.add(StringResourceProcessor.INSTANCE);
|
||||
resourceProcessors.add(LongResourceProcessor.INSTANCE);
|
||||
@@ -239,7 +239,7 @@ public class ResourceProcessorHandlerMethodReturnValueHandlerUnitTest {
|
||||
* @see #362
|
||||
*/
|
||||
@Test
|
||||
public void usesHeaderLinksResponseEntityForResourceIfConfigured() throws Exception {
|
||||
void usesHeaderLinksResponseEntityForResourceIfConfigured() throws Exception {
|
||||
usesHeaderLinksResponseEntityIfConfigured(Function.identity());
|
||||
}
|
||||
|
||||
@@ -247,7 +247,7 @@ public class ResourceProcessorHandlerMethodReturnValueHandlerUnitTest {
|
||||
* @see #362
|
||||
*/
|
||||
@Test
|
||||
public void usesHeaderLinksResponseEntityIfConfigured() throws Exception {
|
||||
void usesHeaderLinksResponseEntityIfConfigured() throws Exception {
|
||||
usesHeaderLinksResponseEntityIfConfigured(ResponseEntity::ok);
|
||||
}
|
||||
|
||||
@@ -269,7 +269,7 @@ public class ResourceProcessorHandlerMethodReturnValueHandlerUnitTest {
|
||||
* @see #362
|
||||
*/
|
||||
@Test
|
||||
public void resourcesProcessorMatchesValueSubTypes() {
|
||||
void resourcesProcessorMatchesValueSubTypes() {
|
||||
|
||||
ResolvableType type = ResolvableType.forClass(PagedStringResources.class);
|
||||
|
||||
@@ -280,7 +280,7 @@ public class ResourceProcessorHandlerMethodReturnValueHandlerUnitTest {
|
||||
* @see #362
|
||||
*/
|
||||
@Test
|
||||
public void doesNotInvokeAProcessorForASpecializedType() throws Exception {
|
||||
void doesNotInvokeAProcessorForASpecializedType() throws Exception {
|
||||
|
||||
EmbeddedWrappers wrappers = new EmbeddedWrappers(false);
|
||||
CollectionModel<Object> value = new CollectionModel<>(
|
||||
@@ -296,7 +296,7 @@ public class ResourceProcessorHandlerMethodReturnValueHandlerUnitTest {
|
||||
* @see #362
|
||||
*/
|
||||
@Test
|
||||
public void registersProcessorForProxyType() {
|
||||
void registersProcessorForProxyType() {
|
||||
|
||||
ProjectionProcessor processor = new ProjectionProcessor();
|
||||
ProxyFactory factory = new ProxyFactory(processor);
|
||||
@@ -310,7 +310,7 @@ public class ResourceProcessorHandlerMethodReturnValueHandlerUnitTest {
|
||||
* @see #486
|
||||
*/
|
||||
@Test
|
||||
public void processesElementsForWildcardedResources() throws Exception {
|
||||
void processesElementsForWildcardedResources() throws Exception {
|
||||
|
||||
resourceProcessors.add(StringResourceProcessor.INSTANCE);
|
||||
|
||||
|
||||
@@ -28,13 +28,13 @@ import org.springframework.http.converter.GenericHttpMessageConverter;
|
||||
*
|
||||
* @author Oliver Gierke
|
||||
*/
|
||||
public class TypeConstrainedMappingJackson2HttpMessageConverterUnitTest {
|
||||
class TypeConstrainedMappingJackson2HttpMessageConverterUnitTest {
|
||||
|
||||
/**
|
||||
* @see #219
|
||||
*/
|
||||
@Test
|
||||
public void rejectsNullType() {
|
||||
void rejectsNullType() {
|
||||
|
||||
assertThatIllegalArgumentException().isThrownBy(() -> {
|
||||
new TypeConstrainedMappingJackson2HttpMessageConverter(null);
|
||||
@@ -45,7 +45,7 @@ public class TypeConstrainedMappingJackson2HttpMessageConverterUnitTest {
|
||||
* @see #219, #360
|
||||
*/
|
||||
@Test
|
||||
public void canReadTypeIfAssignableToConfiguredType() {
|
||||
void canReadTypeIfAssignableToConfiguredType() {
|
||||
|
||||
GenericHttpMessageConverter<Object> converter = new TypeConstrainedMappingJackson2HttpMessageConverter(
|
||||
RepresentationModel.class);
|
||||
@@ -59,7 +59,7 @@ public class TypeConstrainedMappingJackson2HttpMessageConverterUnitTest {
|
||||
* @see #219, #360
|
||||
*/
|
||||
@Test
|
||||
public void canWriteTypeIfAssignableToConfiguredType() {
|
||||
void canWriteTypeIfAssignableToConfiguredType() {
|
||||
|
||||
GenericHttpMessageConverter<Object> converter = new TypeConstrainedMappingJackson2HttpMessageConverter(
|
||||
RepresentationModel.class);
|
||||
|
||||
@@ -51,12 +51,12 @@ import org.springframework.web.util.UriComponentsBuilder;
|
||||
* @author Kamill Sokol
|
||||
* @author Ross Turner
|
||||
*/
|
||||
public class WebMvcLinkBuilderFactoryUnitTest extends TestUtils {
|
||||
class WebMvcLinkBuilderFactoryUnitTest extends TestUtils {
|
||||
|
||||
WebMvcLinkBuilderFactory factory = new WebMvcLinkBuilderFactory();
|
||||
|
||||
@Test
|
||||
public void createsLinkToControllerRoot() {
|
||||
void createsLinkToControllerRoot() {
|
||||
|
||||
Link link = factory.linkTo(PersonControllerImpl.class).withSelfRel();
|
||||
|
||||
@@ -66,7 +66,7 @@ public class WebMvcLinkBuilderFactoryUnitTest extends TestUtils {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void createsLinkToParameterizedControllerRoot() {
|
||||
void createsLinkToParameterizedControllerRoot() {
|
||||
|
||||
Link link = factory.linkTo(PersonsAddressesController.class, 15).withSelfRel();
|
||||
|
||||
@@ -76,7 +76,7 @@ public class WebMvcLinkBuilderFactoryUnitTest extends TestUtils {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void appliesParameterValueIfContributorConfigured() {
|
||||
void appliesParameterValueIfContributorConfigured() {
|
||||
|
||||
WebMvcLinkBuilderFactory factory = new WebMvcLinkBuilderFactory();
|
||||
factory.setUriComponentsContributors(Collections.singletonList(new SampleUriComponentsContributor()));
|
||||
@@ -93,7 +93,7 @@ public class WebMvcLinkBuilderFactoryUnitTest extends TestUtils {
|
||||
* @see #57
|
||||
*/
|
||||
@Test
|
||||
public void usesDateTimeFormatForUriBinding() {
|
||||
void usesDateTimeFormatForUriBinding() {
|
||||
|
||||
DateTime now = DateTime.now();
|
||||
|
||||
@@ -106,7 +106,7 @@ public class WebMvcLinkBuilderFactoryUnitTest extends TestUtils {
|
||||
* @see #96
|
||||
*/
|
||||
@Test
|
||||
public void linksToMethodWithPathVariableContainingBlank() {
|
||||
void linksToMethodWithPathVariableContainingBlank() {
|
||||
|
||||
Link link = linkTo(methodOn(ControllerWithMethods.class).methodWithPathVariable("with blank")).withSelfRel();
|
||||
assertThat(link.getRel()).isEqualTo(IanaLinkRelations.SELF);
|
||||
@@ -117,7 +117,7 @@ public class WebMvcLinkBuilderFactoryUnitTest extends TestUtils {
|
||||
* @see #96
|
||||
*/
|
||||
@Test
|
||||
public void createsLinkToParameterizedControllerRootContainingBlank() {
|
||||
void createsLinkToParameterizedControllerRootContainingBlank() {
|
||||
|
||||
Link link = factory.linkTo(PersonsAddressesController.class, "with blank").withSelfRel();
|
||||
|
||||
@@ -130,7 +130,7 @@ public class WebMvcLinkBuilderFactoryUnitTest extends TestUtils {
|
||||
* @see #209
|
||||
*/
|
||||
@Test
|
||||
public void createsLinkToControllerMethodWithMapRequestParam() {
|
||||
void createsLinkToControllerMethodWithMapRequestParam() {
|
||||
|
||||
Map<String, String> queryParams = new LinkedHashMap<>();
|
||||
queryParams.put("firstKey", "firstValue");
|
||||
@@ -147,7 +147,7 @@ public class WebMvcLinkBuilderFactoryUnitTest extends TestUtils {
|
||||
* @see #209
|
||||
*/
|
||||
@Test
|
||||
public void createsLinkToControllerMethodWithMultiValueMapRequestParam() {
|
||||
void createsLinkToControllerMethodWithMultiValueMapRequestParam() {
|
||||
|
||||
MultiValueMap<String, String> queryParams = new LinkedMultiValueMap<>();
|
||||
queryParams.put("key1", Arrays.asList("value1a", "value1b"));
|
||||
@@ -165,7 +165,7 @@ public class WebMvcLinkBuilderFactoryUnitTest extends TestUtils {
|
||||
* @see #372
|
||||
*/
|
||||
@Test
|
||||
public void createsLinkToParameterizedControllerRootWithParameterMap() {
|
||||
void createsLinkToParameterizedControllerRootWithParameterMap() {
|
||||
|
||||
Link link = factory.linkTo(PersonsAddressesController.class, Collections.singletonMap("id", "17")).withSelfRel();
|
||||
|
||||
|
||||
@@ -29,13 +29,13 @@ import org.springframework.web.context.request.RequestContextHolder;
|
||||
* @author Greg Turnquist
|
||||
* @author Oliver Drotbohm
|
||||
*/
|
||||
public class WebMvcLinkBuilderOutsideSpringMvcUnitTest {
|
||||
class WebMvcLinkBuilderOutsideSpringMvcUnitTest {
|
||||
|
||||
/**
|
||||
* Clear out any existing request attributes left behind by other tests
|
||||
*/
|
||||
@BeforeEach
|
||||
public void setUp() {
|
||||
void setUp() {
|
||||
RequestContextHolder.setRequestAttributes(null);
|
||||
}
|
||||
|
||||
@@ -43,7 +43,7 @@ public class WebMvcLinkBuilderOutsideSpringMvcUnitTest {
|
||||
* @see #408
|
||||
*/
|
||||
@Test
|
||||
public void requestingLinkOutsideWebRequest() {
|
||||
void requestingLinkOutsideWebRequest() {
|
||||
|
||||
Link link = linkTo(
|
||||
methodOn(WebMvcLinkBuilderUnitTest.PersonsAddressesController.class, 15).getAddressesForCountry("DE"))
|
||||
|
||||
@@ -50,10 +50,10 @@ import org.springframework.web.util.UriComponentsBuilder;
|
||||
* @author Oliver Trosien
|
||||
* @author Greg Turnquist
|
||||
*/
|
||||
public class WebMvcLinkBuilderUnitTest extends TestUtils {
|
||||
class WebMvcLinkBuilderUnitTest extends TestUtils {
|
||||
|
||||
@Test
|
||||
public void createsLinkToControllerRoot() {
|
||||
void createsLinkToControllerRoot() {
|
||||
|
||||
Link link = linkTo(PersonControllerImpl.class).withSelfRel();
|
||||
assertThat(link.getRel()).isEqualTo(IanaLinkRelations.SELF);
|
||||
@@ -61,7 +61,7 @@ public class WebMvcLinkBuilderUnitTest extends TestUtils {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void createsLinkToParameterizedControllerRoot() {
|
||||
void createsLinkToParameterizedControllerRoot() {
|
||||
|
||||
Link link = linkTo(PersonsAddressesController.class, 15).withSelfRel();
|
||||
|
||||
@@ -73,7 +73,7 @@ public class WebMvcLinkBuilderUnitTest extends TestUtils {
|
||||
* @see #70
|
||||
*/
|
||||
@Test
|
||||
public void createsLinkToMethodOnParameterizedControllerRoot() {
|
||||
void createsLinkToMethodOnParameterizedControllerRoot() {
|
||||
|
||||
Link link = linkTo(methodOn(PersonsAddressesController.class, 15).getAddressesForCountry("DE")).withSelfRel();
|
||||
assertThat(link.getRel()).isEqualTo(IanaLinkRelations.SELF);
|
||||
@@ -81,7 +81,7 @@ public class WebMvcLinkBuilderUnitTest extends TestUtils {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void createsLinkToSubResource() {
|
||||
void createsLinkToSubResource() {
|
||||
|
||||
Link link = linkTo(PersonControllerImpl.class).slash("something").withSelfRel();
|
||||
assertThat(link.getRel()).isEqualTo(IanaLinkRelations.SELF);
|
||||
@@ -89,7 +89,7 @@ public class WebMvcLinkBuilderUnitTest extends TestUtils {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void createsLinkWithCustomRel() {
|
||||
void createsLinkWithCustomRel() {
|
||||
|
||||
Link link = linkTo(PersonControllerImpl.class).withRel(IanaLinkRelations.NEXT);
|
||||
|
||||
@@ -101,19 +101,19 @@ public class WebMvcLinkBuilderUnitTest extends TestUtils {
|
||||
* @see #186
|
||||
*/
|
||||
@Test
|
||||
public void usesFirstMappingInCaseMultipleOnesAreDefined() {
|
||||
void usesFirstMappingInCaseMultipleOnesAreDefined() {
|
||||
assertThat(linkTo(InvalidController.class).withSelfRel().getHref()).endsWith("/persons");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void createsLinkToUnmappedController() {
|
||||
void createsLinkToUnmappedController() {
|
||||
|
||||
Link link = linkTo(UnmappedController.class).withSelfRel();
|
||||
assertThat(link.getHref()).isEqualTo("http://localhost");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void appendingNullIsANoOp() {
|
||||
void appendingNullIsANoOp() {
|
||||
|
||||
Link link = linkTo(PersonControllerImpl.class).slash(null).withSelfRel();
|
||||
assertThat(link.getHref()).endsWith("/people");
|
||||
@@ -123,7 +123,7 @@ public class WebMvcLinkBuilderUnitTest extends TestUtils {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void linksToMethod() {
|
||||
void linksToMethod() {
|
||||
|
||||
Link link = linkTo(methodOn(ControllerWithMethods.class).myMethod(null)).withSelfRel();
|
||||
assertPointsToMockServer(link);
|
||||
@@ -131,7 +131,7 @@ public class WebMvcLinkBuilderUnitTest extends TestUtils {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void linksToMethodWithPathVariable() {
|
||||
void linksToMethodWithPathVariable() {
|
||||
|
||||
Link link = linkTo(methodOn(ControllerWithMethods.class).methodWithPathVariable("1")).withSelfRel();
|
||||
assertPointsToMockServer(link);
|
||||
@@ -142,7 +142,7 @@ public class WebMvcLinkBuilderUnitTest extends TestUtils {
|
||||
* @see #33
|
||||
*/
|
||||
@Test
|
||||
public void usesForwardedHostAsHostIfHeaderIsSet() {
|
||||
void usesForwardedHostAsHostIfHeaderIsSet() {
|
||||
|
||||
request.addHeader("X-Forwarded-Host", "somethingDifferent");
|
||||
|
||||
@@ -156,7 +156,7 @@ public class WebMvcLinkBuilderUnitTest extends TestUtils {
|
||||
* @see #112
|
||||
*/
|
||||
@Test
|
||||
public void usesForwardedSslIfHeaderIsSet() {
|
||||
void usesForwardedSslIfHeaderIsSet() {
|
||||
|
||||
request.addHeader("X-Forwarded-Ssl", "on");
|
||||
|
||||
@@ -170,7 +170,7 @@ public class WebMvcLinkBuilderUnitTest extends TestUtils {
|
||||
* @see #112
|
||||
*/
|
||||
@Test
|
||||
public void usesForwardedSslIfHeaderIsSetOff() {
|
||||
void usesForwardedSslIfHeaderIsSetOff() {
|
||||
|
||||
request.addHeader("X-Forwarded-Ssl", "off");
|
||||
|
||||
@@ -184,7 +184,7 @@ public class WebMvcLinkBuilderUnitTest extends TestUtils {
|
||||
* @see #112
|
||||
*/
|
||||
@Test
|
||||
public void usesForwardedSslAndHostIfHeaderIsSet() {
|
||||
void usesForwardedSslAndHostIfHeaderIsSet() {
|
||||
|
||||
request.addHeader("X-Forwarded-Host", "somethingDifferent");
|
||||
request.addHeader("X-Forwarded-Ssl", "on");
|
||||
@@ -199,7 +199,7 @@ public class WebMvcLinkBuilderUnitTest extends TestUtils {
|
||||
* @see #26, #39
|
||||
*/
|
||||
@Test
|
||||
public void addsRequestParametersHandedIntoSlashCorrectly() {
|
||||
void addsRequestParametersHandedIntoSlashCorrectly() {
|
||||
|
||||
Link link = linkTo(PersonController.class).slash("?foo=bar").withSelfRel();
|
||||
|
||||
@@ -211,7 +211,7 @@ public class WebMvcLinkBuilderUnitTest extends TestUtils {
|
||||
* @see #26, #39
|
||||
*/
|
||||
@Test
|
||||
public void linksToMethodWithPathVariableAndRequestParams() {
|
||||
void linksToMethodWithPathVariableAndRequestParams() {
|
||||
|
||||
Link link = linkTo(methodOn(ControllerWithMethods.class).methodForNextPage("1", 10, 5)).withSelfRel();
|
||||
|
||||
@@ -227,7 +227,7 @@ public class WebMvcLinkBuilderUnitTest extends TestUtils {
|
||||
* @see #26, #39
|
||||
*/
|
||||
@Test
|
||||
public void linksToMethodWithPathVariableAndMultiValueRequestParams() {
|
||||
void linksToMethodWithPathVariableAndMultiValueRequestParams() {
|
||||
|
||||
Link link = linkTo(
|
||||
methodOn(ControllerWithMethods.class).methodWithMultiValueRequestParams("1", Arrays.asList(3, 7), 5))
|
||||
@@ -245,7 +245,7 @@ public class WebMvcLinkBuilderUnitTest extends TestUtils {
|
||||
* @see #26, #39
|
||||
*/
|
||||
@Test
|
||||
public void returnsUriComponentsBuilder() {
|
||||
void returnsUriComponentsBuilder() {
|
||||
|
||||
UriComponents components = linkTo(PersonController.class).slash("something?foo=bar").toUriComponentsBuilder()
|
||||
.build();
|
||||
@@ -258,7 +258,7 @@ public class WebMvcLinkBuilderUnitTest extends TestUtils {
|
||||
* @see #90
|
||||
*/
|
||||
@Test
|
||||
public void usesForwardedHostAndPortFromHeader() {
|
||||
void usesForwardedHostAndPortFromHeader() {
|
||||
|
||||
request.addHeader("X-Forwarded-Host", "foobar:8088");
|
||||
|
||||
@@ -272,7 +272,7 @@ public class WebMvcLinkBuilderUnitTest extends TestUtils {
|
||||
* @see #90
|
||||
*/
|
||||
@Test
|
||||
public void usesFirstHostOfXForwardedHost() {
|
||||
void usesFirstHostOfXForwardedHost() {
|
||||
|
||||
request.addHeader("X-Forwarded-Host", "barfoo:8888, localhost:8088");
|
||||
|
||||
@@ -286,7 +286,7 @@ public class WebMvcLinkBuilderUnitTest extends TestUtils {
|
||||
* @see #122, #169
|
||||
*/
|
||||
@Test
|
||||
public void appendsOptionalParameterVariableForUnsetParameter() {
|
||||
void appendsOptionalParameterVariableForUnsetParameter() {
|
||||
|
||||
Link link = linkTo(methodOn(ControllerWithMethods.class).methodForOptionalNextPage(null)).withSelfRel();
|
||||
|
||||
@@ -298,7 +298,7 @@ public class WebMvcLinkBuilderUnitTest extends TestUtils {
|
||||
* @see #122, #169
|
||||
*/
|
||||
@Test
|
||||
public void rejectsMissingPathVariable() {
|
||||
void rejectsMissingPathVariable() {
|
||||
|
||||
assertThatIllegalArgumentException().isThrownBy(() -> {
|
||||
linkTo(methodOn(ControllerWithMethods.class).methodWithPathVariable(null))//
|
||||
@@ -310,7 +310,7 @@ public class WebMvcLinkBuilderUnitTest extends TestUtils {
|
||||
* @see #122, #169
|
||||
*/
|
||||
@Test
|
||||
public void rejectsMissingRequiredRequestParam() {
|
||||
void rejectsMissingRequiredRequestParam() {
|
||||
|
||||
assertThatIllegalArgumentException().isThrownBy(() -> {
|
||||
Link link = linkTo(methodOn(ControllerWithMethods.class).methodWithRequestParam(null)).withSelfRel();
|
||||
@@ -325,7 +325,7 @@ public class WebMvcLinkBuilderUnitTest extends TestUtils {
|
||||
* @see #170
|
||||
*/
|
||||
@Test
|
||||
public void usesForwardedPortFromHeader() {
|
||||
void usesForwardedPortFromHeader() {
|
||||
|
||||
request.addHeader("X-Forwarded-Host", "foobarhost");
|
||||
request.addHeader("X-Forwarded-Port", "9090");
|
||||
@@ -342,7 +342,7 @@ public class WebMvcLinkBuilderUnitTest extends TestUtils {
|
||||
* @see #170
|
||||
*/
|
||||
@Test
|
||||
public void usesForwardedHostFromHeaderWithDefaultPort() {
|
||||
void usesForwardedHostFromHeaderWithDefaultPort() {
|
||||
|
||||
request.addHeader("X-Forwarded-Host", "foobarhost");
|
||||
request.setServerPort(8080);
|
||||
@@ -357,7 +357,7 @@ public class WebMvcLinkBuilderUnitTest extends TestUtils {
|
||||
* @see #114
|
||||
*/
|
||||
@Test
|
||||
public void discoversParentClassTypeMappingForInvocation() {
|
||||
void discoversParentClassTypeMappingForInvocation() {
|
||||
|
||||
Link link = linkTo(methodOn(ChildController.class).myMethod()).withSelfRel();
|
||||
assertThat(link.getHref()).endsWith("/parent/child");
|
||||
@@ -367,7 +367,7 @@ public class WebMvcLinkBuilderUnitTest extends TestUtils {
|
||||
* @see #114
|
||||
*/
|
||||
@Test
|
||||
public void includesTypeMappingFromChildClass() {
|
||||
void includesTypeMappingFromChildClass() {
|
||||
|
||||
Link link = linkTo(methodOn(ChildWithTypeMapping.class).myMethod()).withSelfRel();
|
||||
assertThat(link.getHref()).endsWith("/child/parent");
|
||||
@@ -377,7 +377,7 @@ public class WebMvcLinkBuilderUnitTest extends TestUtils {
|
||||
* @see #96
|
||||
*/
|
||||
@Test
|
||||
public void linksToMethodWithPathVariableContainingBlank() {
|
||||
void linksToMethodWithPathVariableContainingBlank() {
|
||||
|
||||
Link link = linkTo(methodOn(ControllerWithMethods.class).methodWithPathVariable("with blank")).withSelfRel();
|
||||
|
||||
@@ -389,7 +389,7 @@ public class WebMvcLinkBuilderUnitTest extends TestUtils {
|
||||
* @see #192
|
||||
*/
|
||||
@Test
|
||||
public void usesRootMappingOfTargetClassForMethodsOfParentClass() {
|
||||
void usesRootMappingOfTargetClassForMethodsOfParentClass() {
|
||||
|
||||
Link link = linkTo(methodOn(ChildControllerWithRootMapping.class) //
|
||||
.someEmptyMappedMethod()) //
|
||||
@@ -402,7 +402,7 @@ public class WebMvcLinkBuilderUnitTest extends TestUtils {
|
||||
* @see #192
|
||||
*/
|
||||
@Test
|
||||
public void usesRootMappingOfTargetClassForMethodsOfParent() throws Exception {
|
||||
void usesRootMappingOfTargetClassForMethodsOfParent() throws Exception {
|
||||
|
||||
Method method = ParentControllerWithoutRootMapping.class.getMethod("someEmptyMappedMethod");
|
||||
|
||||
@@ -414,7 +414,7 @@ public class WebMvcLinkBuilderUnitTest extends TestUtils {
|
||||
* @see #257, #107
|
||||
*/
|
||||
@Test
|
||||
public void usesXForwardedProtoHeaderAsLinkSchema() {
|
||||
void usesXForwardedProtoHeaderAsLinkSchema() {
|
||||
|
||||
for (String proto : Arrays.asList("http", "https")) {
|
||||
|
||||
@@ -432,7 +432,7 @@ public class WebMvcLinkBuilderUnitTest extends TestUtils {
|
||||
* @see #257, #107
|
||||
*/
|
||||
@Test
|
||||
public void usesProtoValueFromForwardedHeaderAsLinkSchema() {
|
||||
void usesProtoValueFromForwardedHeaderAsLinkSchema() {
|
||||
|
||||
for (String proto : Arrays.asList("http", "https")) {
|
||||
|
||||
@@ -450,7 +450,7 @@ public class WebMvcLinkBuilderUnitTest extends TestUtils {
|
||||
* @see #257, #107
|
||||
*/
|
||||
@Test
|
||||
public void favorsStandardForwardHeaderOverXForwardedProto() {
|
||||
void favorsStandardForwardHeaderOverXForwardedProto() {
|
||||
|
||||
request.addHeader("X-Forwarded-Proto", "foo");
|
||||
request.addHeader("Forwarded", "proto=bar");
|
||||
@@ -465,7 +465,7 @@ public class WebMvcLinkBuilderUnitTest extends TestUtils {
|
||||
* @see #331
|
||||
*/
|
||||
@Test
|
||||
public void linksToMethodWithRequestParamImplicitlySetToFalse() {
|
||||
void linksToMethodWithRequestParamImplicitlySetToFalse() {
|
||||
|
||||
Link link = linkTo(methodOn(ControllerWithMethods.class).methodForOptionalSizeWithDefaultValue(null)).withSelfRel();
|
||||
|
||||
@@ -476,7 +476,7 @@ public class WebMvcLinkBuilderUnitTest extends TestUtils {
|
||||
* @see #398
|
||||
*/
|
||||
@Test
|
||||
public void encodesRequestParameterWithSpecialValue() {
|
||||
void encodesRequestParameterWithSpecialValue() {
|
||||
|
||||
Link link = linkTo(methodOn(ControllerWithMethods.class).methodWithRequestParam("Spring#\n")).withSelfRel();
|
||||
|
||||
@@ -488,7 +488,7 @@ public class WebMvcLinkBuilderUnitTest extends TestUtils {
|
||||
* @see #169
|
||||
*/
|
||||
@Test
|
||||
public void createsPartiallyExpandedLink() {
|
||||
void createsPartiallyExpandedLink() {
|
||||
|
||||
Link link = linkTo(methodOn(PersonsAddressesController.class, "some id").getAddressesForCountry(null))
|
||||
.withSelfRel();
|
||||
@@ -501,7 +501,7 @@ public class WebMvcLinkBuilderUnitTest extends TestUtils {
|
||||
* @see #169
|
||||
*/
|
||||
@Test
|
||||
public void addsRequestParameterVariablesForMissingRequiredParameter() {
|
||||
void addsRequestParameterVariablesForMissingRequiredParameter() {
|
||||
|
||||
assertThatIllegalArgumentException().isThrownBy(() -> {
|
||||
|
||||
@@ -517,7 +517,7 @@ public class WebMvcLinkBuilderUnitTest extends TestUtils {
|
||||
* @see #169
|
||||
*/
|
||||
@Test
|
||||
public void addsOptionalRequestParameterTemplateForMissingValue() {
|
||||
void addsOptionalRequestParameterTemplateForMissingValue() {
|
||||
|
||||
Link link = linkTo(methodOn(ControllerWithMethods.class).methodForNextPage("1", null, 5)).withSelfRel();
|
||||
|
||||
@@ -532,7 +532,7 @@ public class WebMvcLinkBuilderUnitTest extends TestUtils {
|
||||
* @see #509
|
||||
*/
|
||||
@Test
|
||||
public void supportsTwoProxiesAddingXForwardedPort() {
|
||||
void supportsTwoProxiesAddingXForwardedPort() {
|
||||
|
||||
request.addHeader("X-Forwarded-Port", "1443,8443");
|
||||
request.addHeader("X-Forwarded-Host", "proxy1,proxy2");
|
||||
@@ -546,7 +546,7 @@ public class WebMvcLinkBuilderUnitTest extends TestUtils {
|
||||
* @see #509
|
||||
*/
|
||||
@Test
|
||||
public void resolvesAmbiguousXForwardedHeaders() {
|
||||
void resolvesAmbiguousXForwardedHeaders() {
|
||||
|
||||
request.addHeader("X-Forwarded-Proto", "http");
|
||||
request.addHeader("X-Forwarded-Ssl", "on");
|
||||
@@ -558,7 +558,7 @@ public class WebMvcLinkBuilderUnitTest extends TestUtils {
|
||||
* @see #527
|
||||
*/
|
||||
@Test
|
||||
public void createsLinkRelativeToContextRoot() {
|
||||
void createsLinkRelativeToContextRoot() {
|
||||
|
||||
request.setContextPath("/ctx");
|
||||
request.setServletPath("/foo");
|
||||
@@ -571,7 +571,7 @@ public class WebMvcLinkBuilderUnitTest extends TestUtils {
|
||||
* @see #639
|
||||
*/
|
||||
@Test
|
||||
public void considersEmptyOptionalMethodParameterOptional() {
|
||||
void considersEmptyOptionalMethodParameterOptional() {
|
||||
|
||||
Link link = linkTo(methodOn(ControllerWithMethods.class).methodWithJdk8Optional(Optional.empty())).withSelfRel();
|
||||
|
||||
@@ -583,7 +583,7 @@ public class WebMvcLinkBuilderUnitTest extends TestUtils {
|
||||
* @see #639
|
||||
*/
|
||||
@Test
|
||||
public void considersOptionalWithValueMethodParameterOptional() {
|
||||
void considersOptionalWithValueMethodParameterOptional() {
|
||||
|
||||
Link link = linkTo(methodOn(ControllerWithMethods.class).methodWithJdk8Optional(Optional.of(1))).withSelfRel();
|
||||
|
||||
@@ -595,7 +595,7 @@ public class WebMvcLinkBuilderUnitTest extends TestUtils {
|
||||
* @see #617
|
||||
*/
|
||||
@Test
|
||||
public void alternativePathVariableParameter() {
|
||||
void alternativePathVariableParameter() {
|
||||
|
||||
Link link = linkTo(methodOn(ControllerWithMethods.class).methodWithAlternatePathVariable("bar")).withSelfRel();
|
||||
assertThat(link.getHref()).isEqualTo("http://localhost/something/bar/foo");
|
||||
|
||||
@@ -42,12 +42,12 @@ import org.springframework.web.reactive.config.EnableWebFlux;
|
||||
/**
|
||||
* @author Greg Turnquist
|
||||
*/
|
||||
public class HypermediaWebFilterTest {
|
||||
class HypermediaWebFilterTest {
|
||||
|
||||
WebTestClient testClient;
|
||||
|
||||
@BeforeEach
|
||||
public void setUp() {
|
||||
void setUp() {
|
||||
|
||||
AnnotationConfigApplicationContext ctx = new AnnotationConfigApplicationContext();
|
||||
ctx.register(WebFluxConfig.class);
|
||||
@@ -63,7 +63,7 @@ public class HypermediaWebFilterTest {
|
||||
* @see #728
|
||||
*/
|
||||
@Test
|
||||
public void webFilterShouldEmbedExchangeIntoContext() {
|
||||
void webFilterShouldEmbedExchangeIntoContext() {
|
||||
|
||||
this.testClient.get().uri("https://example.com/api") //
|
||||
.accept(MediaTypes.HAL_JSON) //
|
||||
|
||||
@@ -39,7 +39,7 @@ import org.springframework.web.server.ServerWebExchange;
|
||||
/**
|
||||
* @author Greg Turnquist
|
||||
*/
|
||||
public class ReactiveResourceAssemblerUnitTest {
|
||||
class ReactiveResourceAssemblerUnitTest {
|
||||
|
||||
TestAssembler assembler;
|
||||
|
||||
@@ -50,7 +50,7 @@ public class ReactiveResourceAssemblerUnitTest {
|
||||
ServerWebExchange exchange;
|
||||
|
||||
@BeforeEach
|
||||
public void setUp() {
|
||||
void setUp() {
|
||||
|
||||
this.assembler = new TestAssembler();
|
||||
this.assemblerWithCustomResources = new TestAssemblerWithCustomResources();
|
||||
@@ -62,7 +62,7 @@ public class ReactiveResourceAssemblerUnitTest {
|
||||
* @see #728
|
||||
*/
|
||||
@Test
|
||||
public void simpleConversionShouldWork() {
|
||||
void simpleConversionShouldWork() {
|
||||
|
||||
this.assembler.toModel(this.employee, this.exchange).as(StepVerifier::create)
|
||||
.expectNextMatches(employeeResource -> {
|
||||
@@ -79,7 +79,7 @@ public class ReactiveResourceAssemblerUnitTest {
|
||||
* @see #728
|
||||
*/
|
||||
@Test
|
||||
public void defaultResourcesConversionShouldWork() {
|
||||
void defaultResourcesConversionShouldWork() {
|
||||
|
||||
this.assembler.toCollectionModel(Flux.just(this.employee), this.exchange).as(StepVerifier::create)
|
||||
.expectNextMatches(employeeResources -> {
|
||||
@@ -101,7 +101,7 @@ public class ReactiveResourceAssemblerUnitTest {
|
||||
* @see #728
|
||||
*/
|
||||
@Test
|
||||
public void customResourcesShouldWork() {
|
||||
void customResourcesShouldWork() {
|
||||
|
||||
this.assemblerWithCustomResources.toCollectionModel(Flux.just(this.employee), this.exchange) //
|
||||
.as(StepVerifier::create) //
|
||||
|
||||
@@ -33,7 +33,7 @@ import org.springframework.web.server.ServerWebExchange;
|
||||
/**
|
||||
* @author Greg Turnquist
|
||||
*/
|
||||
public class SimpleReactiveResourceAssemblerTest {
|
||||
class SimpleReactiveResourceAssemblerTest {
|
||||
|
||||
TestResourceAssemblerSimple testResourceAssembler;
|
||||
|
||||
@@ -42,7 +42,7 @@ public class SimpleReactiveResourceAssemblerTest {
|
||||
@Mock ServerWebExchange exchange;
|
||||
|
||||
@BeforeEach
|
||||
public void setUp() {
|
||||
void setUp() {
|
||||
|
||||
this.testResourceAssembler = new TestResourceAssemblerSimple();
|
||||
this.resourceAssemblerWithCustomLink = new ResourceAssemblerWithCustomLinkSimple();
|
||||
@@ -52,7 +52,7 @@ public class SimpleReactiveResourceAssemblerTest {
|
||||
* @see #728
|
||||
*/
|
||||
@Test
|
||||
public void convertingToResourceShouldWork() {
|
||||
void convertingToResourceShouldWork() {
|
||||
|
||||
this.testResourceAssembler.toModel(new Employee("Frodo"), this.exchange).as(StepVerifier::create)
|
||||
.expectNextMatches(resource -> {
|
||||
@@ -67,7 +67,7 @@ public class SimpleReactiveResourceAssemblerTest {
|
||||
* @see #728
|
||||
*/
|
||||
@Test
|
||||
public void convertingToResourcesShouldWork() {
|
||||
void convertingToResourcesShouldWork() {
|
||||
|
||||
this.testResourceAssembler.toCollectionModel(Flux.just(new Employee("Frodo")), this.exchange)
|
||||
.as(StepVerifier::create).expectNextMatches(resources -> {
|
||||
@@ -83,7 +83,7 @@ public class SimpleReactiveResourceAssemblerTest {
|
||||
* @see #728
|
||||
*/
|
||||
@Test
|
||||
public void convertingToResourceWithCustomLinksShouldWork() {
|
||||
void convertingToResourceWithCustomLinksShouldWork() {
|
||||
|
||||
this.resourceAssemblerWithCustomLink.toModel(new Employee("Frodo"), this.exchange).as(StepVerifier::create)
|
||||
.expectNextMatches(resource -> {
|
||||
@@ -99,7 +99,7 @@ public class SimpleReactiveResourceAssemblerTest {
|
||||
* @see #728
|
||||
*/
|
||||
@Test
|
||||
public void convertingToResourcesWithCustomLinksShouldWork() {
|
||||
void convertingToResourcesWithCustomLinksShouldWork() {
|
||||
|
||||
this.resourceAssemblerWithCustomLink.toCollectionModel(Flux.just(new Employee("Frodo")), this.exchange)
|
||||
.as(StepVerifier::create).expectNextMatches(resources -> {
|
||||
|
||||
@@ -45,7 +45,7 @@ import org.springframework.web.server.ServerWebExchange;
|
||||
* @author Oliver Drotbohm
|
||||
*/
|
||||
@ExtendWith(MockitoExtension.class)
|
||||
public class WebFluxLinkBuilderTest {
|
||||
class WebFluxLinkBuilderTest {
|
||||
|
||||
@Mock ServerWebExchange exchange;
|
||||
@Mock ServerHttpRequest request;
|
||||
@@ -54,7 +54,7 @@ public class WebFluxLinkBuilderTest {
|
||||
* @see #728
|
||||
*/
|
||||
@Test
|
||||
public void linkAtSameLevelAsExplicitServerExchangeShouldWork() {
|
||||
void linkAtSameLevelAsExplicitServerExchangeShouldWork() {
|
||||
|
||||
when(this.exchange.getRequest()).thenReturn(this.request);
|
||||
when(this.request.getURI()).thenReturn(URI.create("http://localhost:8080/api"));
|
||||
@@ -75,7 +75,7 @@ public class WebFluxLinkBuilderTest {
|
||||
* @see #728
|
||||
*/
|
||||
@Test
|
||||
public void linkAtSameLevelAsContextProvidedServerExchangeShouldWork() {
|
||||
void linkAtSameLevelAsContextProvidedServerExchangeShouldWork() {
|
||||
|
||||
when(this.exchange.getRequest()).thenReturn(this.request);
|
||||
when(this.request.getURI()).thenReturn(URI.create("http://localhost:8080/api"));
|
||||
@@ -96,7 +96,7 @@ public class WebFluxLinkBuilderTest {
|
||||
* @see #728
|
||||
*/
|
||||
@Test
|
||||
public void shallowLinkFromDeepExplicitServerExchangeShouldWork() {
|
||||
void shallowLinkFromDeepExplicitServerExchangeShouldWork() {
|
||||
|
||||
when(this.exchange.getRequest()).thenReturn(this.request);
|
||||
|
||||
@@ -119,7 +119,7 @@ public class WebFluxLinkBuilderTest {
|
||||
* @see #728
|
||||
*/
|
||||
@Test
|
||||
public void shallowLinkFromDeepContextProvidedServerExchangeShouldWork() {
|
||||
void shallowLinkFromDeepContextProvidedServerExchangeShouldWork() {
|
||||
|
||||
when(this.exchange.getRequest()).thenReturn(this.request);
|
||||
when(this.request.getURI()).thenReturn(URI.create("http://localhost:8080/api/employees"));
|
||||
@@ -141,7 +141,7 @@ public class WebFluxLinkBuilderTest {
|
||||
* @see #728
|
||||
*/
|
||||
@Test
|
||||
public void deepLinkFromShallowExplicitServerExchangeShouldWork() {
|
||||
void deepLinkFromShallowExplicitServerExchangeShouldWork() {
|
||||
|
||||
when(this.exchange.getRequest()).thenReturn(this.request);
|
||||
when(this.request.getURI()).thenReturn(URI.create("http://localhost:8080/api"));
|
||||
@@ -162,7 +162,7 @@ public class WebFluxLinkBuilderTest {
|
||||
* @see #728
|
||||
*/
|
||||
@Test
|
||||
public void deepLinkFromShallowContextProvidedServerExchangeShouldWork() {
|
||||
void deepLinkFromShallowContextProvidedServerExchangeShouldWork() {
|
||||
|
||||
when(this.exchange.getRequest()).thenReturn(this.request);
|
||||
when(this.request.getURI()).thenReturn(URI.create("http://localhost:8080/api"));
|
||||
@@ -184,7 +184,7 @@ public class WebFluxLinkBuilderTest {
|
||||
* @see #728
|
||||
*/
|
||||
@Test
|
||||
public void linkToRouteWithNoMappingShouldWork() {
|
||||
void linkToRouteWithNoMappingShouldWork() {
|
||||
|
||||
when(this.exchange.getRequest()).thenReturn(this.request);
|
||||
when(this.request.getURI()).thenReturn(URI.create("http://localhost:8080/"));
|
||||
@@ -206,7 +206,7 @@ public class WebFluxLinkBuilderTest {
|
||||
* @see #728
|
||||
*/
|
||||
@Test
|
||||
public void linkToRouteWithNoExchangeInTheContextShouldFallbackToRelativeUris() {
|
||||
void linkToRouteWithNoExchangeInTheContextShouldFallbackToRelativeUris() {
|
||||
|
||||
linkTo(methodOn(TestController2.class).root()).withSelfRel().toMono() //
|
||||
.as(StepVerifier::create).expectNextMatches(link -> {
|
||||
@@ -223,7 +223,7 @@ public class WebFluxLinkBuilderTest {
|
||||
* @see #728
|
||||
*/
|
||||
@Test
|
||||
public void linkToRouteWithExplictExchangeBeingNullShouldFallbackToRelativeUris() {
|
||||
void linkToRouteWithExplictExchangeBeingNullShouldFallbackToRelativeUris() {
|
||||
|
||||
linkTo(methodOn(TestController2.class).root(), null).withSelfRel().toMono() //
|
||||
.as(StepVerifier::create).expectNextMatches(link -> {
|
||||
|
||||
@@ -27,7 +27,7 @@ import org.springframework.hateoas.RepresentationModel;
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@AllArgsConstructor
|
||||
public class EmployeeResource extends RepresentationModel<EmployeeResource> {
|
||||
class EmployeeResource extends RepresentationModel<EmployeeResource> {
|
||||
|
||||
private String name;
|
||||
}
|
||||
|
||||
@@ -41,10 +41,10 @@ import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
|
||||
/**
|
||||
* @author Greg Turnquist
|
||||
*/
|
||||
public class PropertyUtilsTest {
|
||||
class PropertyUtilsTest {
|
||||
|
||||
@Test
|
||||
public void simpleObject() {
|
||||
void simpleObject() {
|
||||
|
||||
Employee employee = new Employee("Frodo Baggins", "ring bearer");
|
||||
|
||||
@@ -57,7 +57,7 @@ public class PropertyUtilsTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void simpleObjectWrappedAsResource() {
|
||||
void simpleObjectWrappedAsResource() {
|
||||
|
||||
Employee employee = new Employee("Frodo Baggins", "ring bearer");
|
||||
EntityModel<Employee> employeeResource = new EntityModel<>(employee);
|
||||
@@ -71,7 +71,7 @@ public class PropertyUtilsTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void resourceWrappedSpringMvcParameter() {
|
||||
void resourceWrappedSpringMvcParameter() {
|
||||
|
||||
Method method = ReflectionUtils.findMethod(TestController.class, "newEmployee", EntityModel.class);
|
||||
MethodParameters parameters = MethodParameters.of(method);
|
||||
@@ -88,7 +88,7 @@ public class PropertyUtilsTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void objectWithIgnorableAttributes() {
|
||||
void objectWithIgnorableAttributes() {
|
||||
|
||||
EmployeeWithCustomizedReaders employee = new EmployeeWithCustomizedReaders("Frodo", "Baggins", "ring bearer",
|
||||
"password", "fbaggins", "ignore this one");
|
||||
@@ -105,7 +105,7 @@ public class PropertyUtilsTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void objectWithNullReturningGetter() {
|
||||
void objectWithNullReturningGetter() {
|
||||
|
||||
EmployeeWithNullReturningGetter employee = new EmployeeWithNullReturningGetter("Frodo");
|
||||
|
||||
|
||||
Reference in New Issue
Block a user