Skip to content

Commit 4748ee5

Browse files
committed
More missing coverage
1 parent 45a0079 commit 4748ee5

File tree

1 file changed

+66
-0
lines changed

1 file changed

+66
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
/**
2+
* Copyright © 2013 spring-data-dynamodb (https://github.com/derjust/spring-data-dynamodb)
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* http://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*/
16+
package org.socialsignin.spring.data.dynamodb.utils;
17+
18+
import org.junit.Rule;
19+
import org.junit.Test;
20+
import org.junit.rules.ExpectedException;
21+
import org.springframework.data.domain.PageRequest;
22+
import org.springframework.data.domain.Pageable;
23+
import org.springframework.data.domain.Sort;
24+
25+
public class SortHandlerTest {
26+
@Rule
27+
public ExpectedException expectedException = ExpectedException.none();
28+
29+
private SortHandler underTest = new SortHandler() {};
30+
31+
@Test
32+
public void testThrowUnsupportedSortException() {
33+
expectedException.expect(UnsupportedOperationException.class);
34+
35+
underTest.throwUnsupportedSortOperationException();
36+
}
37+
38+
@Test
39+
public void testEnsureNoSortUnsorted() {
40+
underTest.ensureNoSort(Sort.unsorted());
41+
}
42+
43+
@Test
44+
public void testEnsureNoSortSorted() {
45+
expectedException.expect(UnsupportedOperationException.class);
46+
47+
underTest.ensureNoSort(Sort.by("property"));
48+
}
49+
50+
@Test
51+
public void testEnsureNoSortUnpaged() {
52+
underTest.ensureNoSort(Pageable.unpaged());
53+
}
54+
55+
@Test
56+
public void TestEnsureNoSortPagedUnsorted() {
57+
underTest.ensureNoSort(PageRequest.of(0, 1, Sort.unsorted()));
58+
}
59+
60+
@Test
61+
public void TestEnsureNoSortPagedSorted() {
62+
expectedException.expect(UnsupportedOperationException.class);
63+
64+
underTest.ensureNoSort(PageRequest.of(0, 1, Sort.by("property")));
65+
}
66+
}

0 commit comments

Comments
 (0)