diff --git a/pom.xml b/pom.xml index 9907b7ee..5636b4f1 100644 --- a/pom.xml +++ b/pom.xml @@ -78,7 +78,7 @@ spring.hateoas 2.2.0 3.0.2 - 5.3.2 + 5.4.1 2.2.1 Californium-SR4 1.7.25 diff --git a/src/test/java/org/springframework/hateoas/RepresentationModelUnitTest.java b/src/test/java/org/springframework/hateoas/RepresentationModelUnitTest.java index 75e30715..784c9755 100755 --- a/src/test/java/org/springframework/hateoas/RepresentationModelUnitTest.java +++ b/src/test/java/org/springframework/hateoas/RepresentationModelUnitTest.java @@ -85,8 +85,9 @@ public class RepresentationModelUnitTest { @Test public void preventsNullLinkBeingAdded() { + RepresentationModel support = new RepresentationModel<>(); + assertThatIllegalArgumentException().isThrownBy(() -> { - RepresentationModel support = new RepresentationModel<>(); support.add((Link) null); }); } @@ -94,8 +95,9 @@ public class RepresentationModelUnitTest { @Test public void preventsNullLinksBeingAdded() { + RepresentationModel support = new RepresentationModel<>(); + assertThatIllegalArgumentException().isThrownBy(() -> { - RepresentationModel support = new RepresentationModel<>(); support.add((Iterable) null); }); } diff --git a/src/test/java/org/springframework/hateoas/UriTemplateUnitTest.java b/src/test/java/org/springframework/hateoas/UriTemplateUnitTest.java index 26cdd249..0ed49110 100755 --- a/src/test/java/org/springframework/hateoas/UriTemplateUnitTest.java +++ b/src/test/java/org/springframework/hateoas/UriTemplateUnitTest.java @@ -150,8 +150,9 @@ public class UriTemplateUnitTest { @Test public void rejectsMissingRequiredPathVariable() { + UriTemplate template = UriTemplate.of("/foo/{bar}"); + assertThatIllegalArgumentException().isThrownBy(() -> { - UriTemplate template = UriTemplate.of("/foo/{bar}"); template.expand(Collections.emptyMap()); }); } diff --git a/src/test/java/org/springframework/hateoas/mediatype/hal/HalEmbeddedBuilderUnitTest.java b/src/test/java/org/springframework/hateoas/mediatype/hal/HalEmbeddedBuilderUnitTest.java index 41b5837a..58ea5134 100755 --- a/src/test/java/org/springframework/hateoas/mediatype/hal/HalEmbeddedBuilderUnitTest.java +++ b/src/test/java/org/springframework/hateoas/mediatype/hal/HalEmbeddedBuilderUnitTest.java @@ -176,8 +176,10 @@ public class HalEmbeddedBuilderUnitTest { @Test public void rejectsInvalidEmbeddedWrapper() { + HalEmbeddedBuilder builder = new HalEmbeddedBuilder(provider, curieProvider, false); + assertThatIllegalStateException().isThrownBy(() -> { - new HalEmbeddedBuilder(provider, curieProvider, false).add(mock(EmbeddedWrapper.class)); + builder.add(mock(EmbeddedWrapper.class)); }); } diff --git a/src/test/java/org/springframework/hateoas/server/mvc/ControllerLinkBuilderUnitTest.java b/src/test/java/org/springframework/hateoas/server/mvc/ControllerLinkBuilderUnitTest.java index 1a59da75..21e21880 100755 --- a/src/test/java/org/springframework/hateoas/server/mvc/ControllerLinkBuilderUnitTest.java +++ b/src/test/java/org/springframework/hateoas/server/mvc/ControllerLinkBuilderUnitTest.java @@ -301,9 +301,10 @@ public class ControllerLinkBuilderUnitTest extends TestUtils { @Test public void rejectsMissingPathVariable() { + ControllerLinkBuilder builder = linkTo(methodOn(ControllerWithMethods.class).methodWithPathVariable(null)); + assertThatIllegalArgumentException().isThrownBy(() -> { - linkTo(methodOn(ControllerWithMethods.class).methodWithPathVariable(null))// - .withSelfRel().expand(); + builder.withSelfRel().expand(); }); } @@ -313,10 +314,10 @@ public class ControllerLinkBuilderUnitTest extends TestUtils { @Test public void rejectsMissingRequiredRequestParam() { - assertThatIllegalArgumentException().isThrownBy(() -> { - Link link = linkTo(methodOn(ControllerWithMethods.class).methodWithRequestParam(null)).withSelfRel(); + Link link = linkTo(methodOn(ControllerWithMethods.class).methodWithRequestParam(null)).withSelfRel(); - assertThat(link.getVariableNames()).containsExactly("id"); + assertThat(link.getVariableNames()).containsExactly("id"); + assertThatIllegalArgumentException().isThrownBy(() -> { link.expand(); }); @@ -521,7 +522,8 @@ public class ControllerLinkBuilderUnitTest extends TestUtils { Link link = linkTo(methodOn(ControllerWithMethods.class).methodForNextPage("1", null, 5)).withSelfRel(); - assertThat(link.getVariables()).containsExactly(new TemplateVariable("offset", VariableType.REQUEST_PARAM_CONTINUED)); + assertThat(link.getVariables()) + .containsExactly(new TemplateVariable("offset", VariableType.REQUEST_PARAM_CONTINUED)); UriComponents components = toComponents(link);