Skip to content

Commit

Permalink
Minor refactoring.
Browse files Browse the repository at this point in the history
gk-brown committed Sep 10, 2024

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
1 parent 44711c6 commit afbd0ba
Showing 4 changed files with 11 additions and 11 deletions.
2 changes: 1 addition & 1 deletion build.gradle
Original file line number Diff line number Diff line change
@@ -14,7 +14,7 @@

subprojects {
group = 'org.httprpc'
version = '4.2.1'
version = '4.2.2'

apply plugin: 'java-library'

12 changes: 6 additions & 6 deletions kilo-server/src/main/java/org/httprpc/kilo/WebService.java
Original file line number Diff line number Diff line change
@@ -605,16 +605,16 @@ public TypeDescriptor getValueType() {
}

private static class Resource {
static List<String> order = listOf("GET", "POST", "PUT", "DELETE");
Map<String, Resource> resources = new TreeMap<>();

final Map<String, List<Method>> handlerMap = new TreeMap<>((method1, method2) -> {
var i1 = order.indexOf(method1);
var i2 = order.indexOf(method2);
Map<String, List<Method>> handlerMap = new TreeMap<>((method1, method2) -> {
var i1 = methodOrder.indexOf(method1);
var i2 = methodOrder.indexOf(method2);

return Integer.compare((i1 == -1) ? order.size() : i1, (i2 == -1) ? order.size() : i2);
return Integer.compare((i1 == -1) ? methodOrder.size() : i1, (i2 == -1) ? methodOrder.size() : i2);
});

final Map<String, Resource> resources = new TreeMap<>();
static final List<String> methodOrder = immutableListOf("GET", "POST", "PUT", "DELETE");
}

private static class PartURLConnection extends URLConnection {
Original file line number Diff line number Diff line change
@@ -18,7 +18,7 @@
import java.net.URL;

public abstract class AbstractTest {
protected final URL baseURL;
protected URL baseURL;

protected AbstractTest() {
try {
Original file line number Diff line number Diff line change
@@ -771,21 +771,21 @@ public void testMissingRequiredParameter() throws IOException {
}

@Test
public void testMissingRequiredParameterProxy() throws IOException {
public void testMissingRequiredParameterProxy() {
var testServiceProxy = WebServiceProxy.of(TestServiceProxy.class, baseURL);

assertThrows(IllegalArgumentException.class, () -> testServiceProxy.testGet(null, null, null, null, '\0'));
}

@Test
public void testMissingProxyException() throws IOException {
public void testMissingProxyException() {
var testServiceProxy = WebServiceProxy.of(TestServiceProxy.class, baseURL);

assertThrows(UnsupportedOperationException.class, testServiceProxy::testMissingException);
}

@Test
public void testInvalidProxyException() throws IOException {
public void testInvalidProxyException() {
var testServiceProxy = WebServiceProxy.of(TestServiceProxy.class, baseURL);

assertThrows(UnsupportedOperationException.class, testServiceProxy::testInvalidException);

0 comments on commit afbd0ba

Please sign in to comment.