DATAREST-1121 - Skip last modified detection for query methods that project.
For an execution of a projecting query method we now skip the last modified detection as it actually doesn't make sense if applied to non-aggregates.
This commit is contained in:
@@ -21,10 +21,13 @@ import static org.mockito.Mockito.*;
|
||||
|
||||
import lombok.Value;
|
||||
|
||||
import java.util.Date;
|
||||
import java.util.function.Supplier;
|
||||
|
||||
import org.junit.Before;
|
||||
import org.junit.Rule;
|
||||
import org.junit.Test;
|
||||
import org.junit.rules.ExpectedException;
|
||||
import org.junit.runner.RunWith;
|
||||
import org.mockito.Mock;
|
||||
import org.mockito.junit.MockitoJUnitRunner;
|
||||
@@ -49,6 +52,8 @@ public class ResourceStatusUnitTests {
|
||||
@Mock HttpHeadersPreparer preparer;
|
||||
@Mock Supplier<PersistentEntityResource> supplier;
|
||||
|
||||
public @Rule ExpectedException exception = ExpectedException.none();
|
||||
|
||||
@Before
|
||||
public void setUp() {
|
||||
|
||||
@@ -87,6 +92,15 @@ public class ResourceStatusUnitTests {
|
||||
assertNotModified(status.getStatusAndHeaders(new HttpHeaders(), new Sample(0), entity));
|
||||
}
|
||||
|
||||
@Test // DATAREST-1121
|
||||
public void rejectsInvalidPersistentEntityDomainObjectCombination() {
|
||||
|
||||
exception.expect(IllegalArgumentException.class);
|
||||
exception.expectMessage(entity.getType().getName());
|
||||
|
||||
assertModified(status.getStatusAndHeaders(new HttpHeaders(), new Date(), entity));
|
||||
}
|
||||
|
||||
private void assertModified(StatusAndHeaders statusAndHeaders) {
|
||||
|
||||
assertThat(statusAndHeaders.isModified()).isTrue();
|
||||
|
||||
Reference in New Issue
Block a user