Skip to content

Commit 76536c9

Browse files
committed
Additional tests
1 parent b4ead82 commit 76536c9

File tree

2 files changed

+56
-0
lines changed

2 files changed

+56
-0
lines changed

access-grant/src/test/java/com/inrupt/client/accessgrant/CredentialFilterTest.java

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,20 @@ void testCredentialEmptyFilterBuilder() {
5959
assertEquals(expectedUri, filter.asURI(BASE_URL));
6060
}
6161

62+
@Test
63+
void testCredentialExcessivePageSizeFilterBuilder() {
64+
final CredentialFilter<AccessDenial> filter = CredentialFilter.newBuilder()
65+
.pageSize(200)
66+
.build(AccessDenial.class);
67+
assertEquals(20, filter.getPageSize());
68+
assertEquals(AccessDenial.class, filter.getCredentialType());
69+
70+
final URI expectedUri = URIBuilder.newBuilder(BASE_URL)
71+
.queryParam("type", "SolidAccessDenial")
72+
.queryParam("pageSize", "20").build();
73+
assertEquals(expectedUri, filter.asURI(BASE_URL));
74+
}
75+
6276
@Test
6377
void testCredentialFilterBuilder() {
6478
final String page = UUID.randomUUID().toString();
Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
/*
2+
* Copyright Inrupt Inc.
3+
*
4+
* Permission is hereby granted, free of charge, to any person obtaining a copy
5+
* of this software and associated documentation files (the "Software"), to deal in
6+
* the Software without restriction, including without limitation the rights to use,
7+
* copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the
8+
* Software, and to permit persons to whom the Software is furnished to do so,
9+
* subject to the following conditions:
10+
*
11+
* The above copyright notice and this permission notice shall be included in
12+
* all copies or substantial portions of the Software.
13+
*
14+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
15+
* INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
16+
* PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
17+
* HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
18+
* OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
19+
* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
20+
*/
21+
package com.inrupt.client.accessgrant;
22+
23+
import static org.junit.jupiter.api.Assertions.*;
24+
25+
import java.util.Collections;
26+
27+
import org.junit.jupiter.api.Test;
28+
29+
class CredentialResultTest {
30+
31+
@Test
32+
void checkNullCredentialResult() {
33+
final CredentialResult<AccessGrant> result = new CredentialResult<>(Collections.emptyList(),
34+
null, null, null, null);
35+
36+
assertTrue(result.getItems().isEmpty());
37+
assertFalse(result.firstPage().isPresent());
38+
assertFalse(result.prevPage().isPresent());
39+
assertFalse(result.nextPage().isPresent());
40+
assertFalse(result.lastPage().isPresent());
41+
}
42+
}

0 commit comments

Comments
 (0)