Skip to content

Commit c0125c9

Browse files
committed
Qualify references to ResourceType.COLLECTION to avoid ambiguities to AssertJ in tests.
Fixes #2071.
1 parent 46dc6e0 commit c0125c9

File tree

2 files changed

+9
-8
lines changed

2 files changed

+9
-8
lines changed

spring-data-rest-core/src/test/java/org/springframework/data/rest/core/mapping/CrudMethodsSupportedHttpMethodsUnitTests.java

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -61,8 +61,8 @@ public void doesNotSupportAnyHttpMethodForEmptyRepository() {
6161

6262
SupportedHttpMethods supportedMethods = getSupportedHttpMethodsFor(RawRepository.class);
6363

64-
assertMethodsSupported(supportedMethods, COLLECTION, true, OPTIONS);
65-
assertMethodsSupported(supportedMethods, COLLECTION, false, GET, PUT, POST, PATCH, DELETE, HEAD);
64+
assertMethodsSupported(supportedMethods, ResourceType.COLLECTION, true, OPTIONS);
65+
assertMethodsSupported(supportedMethods, ResourceType.COLLECTION, false, GET, PUT, POST, PATCH, DELETE, HEAD);
6666

6767
assertMethodsSupported(supportedMethods, ITEM, true, OPTIONS);
6868
assertMethodsSupported(supportedMethods, ITEM, false, GET, PUT, POST, PATCH, DELETE, HEAD);
@@ -82,8 +82,8 @@ public void defaultsSupportedHttpMethodsForCollectionResource() {
8282

8383
SupportedHttpMethods supportedHttpMethods = getSupportedHttpMethodsFor(SampleRepository.class);
8484

85-
assertMethodsSupported(supportedHttpMethods, COLLECTION, true, GET, POST, OPTIONS, HEAD);
86-
assertMethodsSupported(supportedHttpMethods, COLLECTION, false, PUT, PATCH, DELETE);
85+
assertMethodsSupported(supportedHttpMethods, ResourceType.COLLECTION, true, GET, POST, OPTIONS, HEAD);
86+
assertMethodsSupported(supportedHttpMethods, ResourceType.COLLECTION, false, PUT, PATCH, DELETE);
8787
}
8888

8989
@Test // DATACMNS-589, DATAREST-409
@@ -133,7 +133,8 @@ public void onlyExposesExplicitlyAnnotatedMethodsIfConfigured() {
133133
reset(mappings);
134134
when(mappings.exposeMethodsByDefault()).thenReturn(false);
135135

136-
assertMethodsSupported(getSupportedHttpMethodsFor(MethodsExplicitlyExportedRepository.class), COLLECTION, true,
136+
assertMethodsSupported(getSupportedHttpMethodsFor(MethodsExplicitlyExportedRepository.class),
137+
ResourceType.COLLECTION, true,
137138
POST, OPTIONS);
138139
assertMethodsSupported(getSupportedHttpMethodsFor(MethodsExplicitlyExportedRepository.class), ITEM, true, OPTIONS,
139140
PUT, PATCH);

spring-data-rest-tests/spring-data-rest-tests-jpa/src/test/java/org/springframework/data/rest/webmvc/RootResourceInformationIntegrationTests.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,11 +16,11 @@
1616
package org.springframework.data.rest.webmvc;
1717

1818
import static org.assertj.core.api.Assertions.*;
19-
import static org.springframework.data.rest.core.mapping.ResourceType.*;
2019
import static org.springframework.http.HttpMethod.*;
2120

2221
import org.junit.Test;
2322
import org.junit.runner.RunWith;
23+
import org.springframework.data.rest.core.mapping.ResourceType;
2424
import org.springframework.data.rest.core.mapping.SupportedHttpMethods;
2525
import org.springframework.data.rest.tests.AbstractControllerIntegrationTests;
2626
import org.springframework.data.rest.webmvc.jpa.Address;
@@ -43,13 +43,13 @@ public class RootResourceInformationIntegrationTests extends AbstractControllerI
4343
public void getIsNotSupportedIfFindAllIsNotExported() {
4444

4545
SupportedHttpMethods supportedMethods = getResourceInformation(Address.class).getSupportedMethods();
46-
assertThat(supportedMethods.getMethodsFor(COLLECTION)).doesNotContain(GET);
46+
assertThat(supportedMethods.getMethodsFor(ResourceType.COLLECTION)).doesNotContain(GET);
4747
}
4848

4949
@Test // DATAREST-217
5050
public void postIsNotSupportedIfSaveIsNotExported() {
5151

5252
SupportedHttpMethods supportedMethods = getResourceInformation(Address.class).getSupportedMethods();
53-
assertThat(supportedMethods.getMethodsFor(COLLECTION)).doesNotContain(POST);
53+
assertThat(supportedMethods.getMethodsFor(ResourceType.COLLECTION)).doesNotContain(POST);
5454
}
5555
}

0 commit comments

Comments
 (0)