Skip to content

Commit 1bf37c2

Browse files
committed
Update tests.
1 parent 135f5eb commit 1bf37c2

3 files changed

Lines changed: 24 additions & 10 deletions

File tree

kilo-test/src/main/java/org/httprpc/kilo/test/TestService.java

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,9 @@
4747
import java.util.Map;
4848
import java.util.NoSuchElementException;
4949
import java.util.SequencedMap;
50+
import java.util.SequencedSet;
5051
import java.util.Set;
52+
import java.util.SortedSet;
5153
import java.util.UUID;
5254

5355
import static org.httprpc.kilo.util.Collections.*;
@@ -100,8 +102,9 @@ public interface Response {
100102
List<String> getStrings();
101103
Integer getNumber();
102104
Set<Integer> getNumbers();
103-
boolean getFlag();
104105
char getCharacter();
106+
Set<Character> getCharacters();
107+
boolean getFlag();
105108
DayOfWeek getDayOfWeek();
106109
Instant getDate();
107110
List<Instant> getDates();
@@ -180,7 +183,8 @@ public Number next() {
180183

181184
@RequestMethod("GET")
182185
public Response testGet(@Required String string, List<String> strings,
183-
Integer number, Set<Integer> numbers, boolean flag, char character, DayOfWeek dayOfWeek,
186+
int number, SequencedSet<Integer> numbers, char character, SortedSet<Character> characters,
187+
boolean flag, DayOfWeek dayOfWeek,
184188
Instant date, List<Instant> dates,
185189
LocalDate localDate, LocalTime localTime, LocalDateTime localDateTime,
186190
Duration duration, Period period,
@@ -190,8 +194,9 @@ public Response testGet(@Required String string, List<String> strings,
190194
entry("strings", strings),
191195
entry("number", number),
192196
entry("numbers", numbers),
193-
entry("flag", flag),
194197
entry("character", character),
198+
entry("characters", characters),
199+
entry("flag", flag),
195200
entry("dayOfWeek", dayOfWeek),
196201
entry("date", date),
197202
entry("dates", dates),
@@ -292,7 +297,7 @@ public List<String> testPostList(List<String> list) {
292297

293298
@RequestMethod("POST")
294299
@ResourcePath("map")
295-
public Map<String, Double> testPostMap(SequencedMap<String, Double> map) {
300+
public SequencedMap<String, Double> testPostMap(SequencedMap<String, Double> map) {
296301
return map;
297302
}
298303

kilo-test/src/test/java/org/httprpc/kilo/test/TestServiceProxy.java

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,8 @@
3333
import java.time.Instant;
3434
import java.util.List;
3535
import java.util.Map;
36-
import java.util.Set;
36+
import java.util.SequencedSet;
37+
import java.util.SortedSet;
3738

3839
import static org.httprpc.kilo.util.Iterables.*;
3940

@@ -85,7 +86,9 @@ public void handleResponse(InputStream errorStream, String contentType, int stat
8586
}
8687

8788
@RequestMethod("GET")
88-
TestService.Response testGet(@Required String string, List<String> strings, Integer number, Set<Integer> numbers, char character) throws IOException;
89+
TestService.Response testGet(@Required String string, List<String> strings,
90+
int number, SequencedSet<Integer> numbers, char character, SortedSet<Character> characters,
91+
boolean flag) throws IOException;
8992

9093
@RequestMethod("GET")
9194
@ResourcePath("a#/?/b*/?/c@/?/d=/?")

kilo-test/src/test/java/org/httprpc/kilo/test/WebServiceProxyTest.java

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -76,8 +76,9 @@ public void testGet() throws IOException {
7676
entry("strings", listOf("a", "b", "c")),
7777
entry("number", 123),
7878
entry("numbers", listOf(1, 2, 2, 3, 3, 3)),
79-
entry("flag", true),
8079
entry("character", "abc"),
80+
entry("characters", listOf('c', 'b', 'b', 'a', 'a', 'a')),
81+
entry("flag", true),
8182
entry("dayOfWeek", dayOfWeek),
8283
entry("date", date),
8384
entry("dates", listOf(date)),
@@ -97,8 +98,9 @@ public void testGet() throws IOException {
9798
assertEquals(listOf("a", "b", "c"), result.getStrings());
9899
assertEquals(123, result.getNumber());
99100
assertEquals(setOf(1, 2, 3), result.getNumbers());
100-
assertTrue(result.getFlag());
101101
assertEquals('a', result.getCharacter());
102+
assertEquals(sortedSetOf('a', 'b', 'c'), result.getCharacters());
103+
assertTrue(result.getFlag());
102104
assertEquals(dayOfWeek, result.getDayOfWeek());
103105
assertEquals(date, result.getDate());
104106
assertEquals(listOf(date), result.getDates());
@@ -114,13 +116,17 @@ public void testGet() throws IOException {
114116
public void testGetProxy() throws IOException {
115117
var testServiceProxy = WebServiceProxy.of(TestServiceProxy.class, baseURI);
116118

117-
var result = testServiceProxy.testGet("héllo&gøod+bye?", listOf("a", "b", "c"), 123, setOf(1, 2, 3), 'a');
119+
var result = testServiceProxy.testGet("héllo&gøod+bye?", listOf("a", "b", "c"),
120+
123, setOf(1, 2, 3), 'a', sortedSetOf('a', 'b', 'c'),
121+
true);
118122

119123
assertEquals("héllo&gøod+bye?", result.getString());
120124
assertEquals(listOf("a", "b", "c"), result.getStrings());
121125
assertEquals(123, result.getNumber());
122126
assertEquals(setOf(1, 2, 3), result.getNumbers());
123127
assertEquals('a', result.getCharacter());
128+
assertEquals(sortedSetOf('a', 'b', 'c'), result.getCharacters());
129+
assertTrue(result.getFlag());
124130
}
125131

126132
@Test
@@ -617,7 +623,7 @@ public void testMissingRequiredParameter() {
617623
public void testMissingRequiredParameterProxy() {
618624
var testServiceProxy = WebServiceProxy.of(TestServiceProxy.class, baseURI);
619625

620-
assertThrows(IllegalArgumentException.class, () -> testServiceProxy.testGet(null, null, null, null, '\0'));
626+
assertThrows(IllegalArgumentException.class, () -> testServiceProxy.testGet(null, null, 0, null, '\0', null, false));
621627
}
622628

623629
@Test

0 commit comments

Comments
 (0)