Qualify references to ResourceType.COLLECTION to avoid ambiguities to AssertJ in tests.

Fixes #2071.
This commit is contained in:
Oliver Drotbohm
2021-10-06 12:35:09 +02:00
parent 46dc6e03fc
commit c0125c99a8
2 changed files with 9 additions and 8 deletions

View File

@@ -61,8 +61,8 @@ public class CrudMethodsSupportedHttpMethodsUnitTests {
SupportedHttpMethods supportedMethods = getSupportedHttpMethodsFor(RawRepository.class);
assertMethodsSupported(supportedMethods, COLLECTION, true, OPTIONS);
assertMethodsSupported(supportedMethods, COLLECTION, false, GET, PUT, POST, PATCH, DELETE, HEAD);
assertMethodsSupported(supportedMethods, ResourceType.COLLECTION, true, OPTIONS);
assertMethodsSupported(supportedMethods, ResourceType.COLLECTION, false, GET, PUT, POST, PATCH, DELETE, HEAD);
assertMethodsSupported(supportedMethods, ITEM, true, OPTIONS);
assertMethodsSupported(supportedMethods, ITEM, false, GET, PUT, POST, PATCH, DELETE, HEAD);
@@ -82,8 +82,8 @@ public class CrudMethodsSupportedHttpMethodsUnitTests {
SupportedHttpMethods supportedHttpMethods = getSupportedHttpMethodsFor(SampleRepository.class);
assertMethodsSupported(supportedHttpMethods, COLLECTION, true, GET, POST, OPTIONS, HEAD);
assertMethodsSupported(supportedHttpMethods, COLLECTION, false, PUT, PATCH, DELETE);
assertMethodsSupported(supportedHttpMethods, ResourceType.COLLECTION, true, GET, POST, OPTIONS, HEAD);
assertMethodsSupported(supportedHttpMethods, ResourceType.COLLECTION, false, PUT, PATCH, DELETE);
}
@Test // DATACMNS-589, DATAREST-409
@@ -133,7 +133,8 @@ public class CrudMethodsSupportedHttpMethodsUnitTests {
reset(mappings);
when(mappings.exposeMethodsByDefault()).thenReturn(false);
assertMethodsSupported(getSupportedHttpMethodsFor(MethodsExplicitlyExportedRepository.class), COLLECTION, true,
assertMethodsSupported(getSupportedHttpMethodsFor(MethodsExplicitlyExportedRepository.class),
ResourceType.COLLECTION, true,
POST, OPTIONS);
assertMethodsSupported(getSupportedHttpMethodsFor(MethodsExplicitlyExportedRepository.class), ITEM, true, OPTIONS,
PUT, PATCH);

View File

@@ -16,11 +16,11 @@
package org.springframework.data.rest.webmvc;
import static org.assertj.core.api.Assertions.*;
import static org.springframework.data.rest.core.mapping.ResourceType.*;
import static org.springframework.http.HttpMethod.*;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.data.rest.core.mapping.ResourceType;
import org.springframework.data.rest.core.mapping.SupportedHttpMethods;
import org.springframework.data.rest.tests.AbstractControllerIntegrationTests;
import org.springframework.data.rest.webmvc.jpa.Address;
@@ -43,13 +43,13 @@ public class RootResourceInformationIntegrationTests extends AbstractControllerI
public void getIsNotSupportedIfFindAllIsNotExported() {
SupportedHttpMethods supportedMethods = getResourceInformation(Address.class).getSupportedMethods();
assertThat(supportedMethods.getMethodsFor(COLLECTION)).doesNotContain(GET);
assertThat(supportedMethods.getMethodsFor(ResourceType.COLLECTION)).doesNotContain(GET);
}
@Test // DATAREST-217
public void postIsNotSupportedIfSaveIsNotExported() {
SupportedHttpMethods supportedMethods = getResourceInformation(Address.class).getSupportedMethods();
assertThat(supportedMethods.getMethodsFor(COLLECTION)).doesNotContain(POST);
assertThat(supportedMethods.getMethodsFor(ResourceType.COLLECTION)).doesNotContain(POST);
}
}