Skip to content

Commit

Permalink
implement missing hashcode method
Browse files Browse the repository at this point in the history
  • Loading branch information
duncpro committed Aug 25, 2022
1 parent a41756f commit 652926c
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 7 deletions.
16 changes: 10 additions & 6 deletions .idea/workspace.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ plugins {
}

group = "com.duncpro"
version = "1.0-SNAPSHOT-12"
version = "1.0-SNAPSHOT-13"

repositories {
mavenCentral()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,9 @@ public boolean equals(Object o) {
return o instanceof WildcardRouteElement;
}

@Override
public int hashCode() { return 1; }

@Override
public String toString() {
return "*";
Expand Down
10 changes: 10 additions & 0 deletions src/test/java/com/duncpro/jroute/rest/RestRouterTest.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package com.duncpro.jroute.rest;

import com.duncpro.jroute.util.ParameterizedRoute;
import org.junit.jupiter.api.Test;

import static org.junit.jupiter.api.Assertions.*;
Expand Down Expand Up @@ -28,4 +29,13 @@ public void testRouteMatchSuccess() {
final var result = router.route(HttpMethod.GET, "/hello");
assertTrue(result instanceof RestRouteResult.RestRouteMatch);
}

@Test
public void testMultipleWildcardsSmoke() {
RestRouter<Integer> router = new RestRouter<>();
router.add(HttpMethod.GET, ParameterizedRoute.parse("/users/{userId}/docs/{docId}"), 1);
router.add(HttpMethod.OPTIONS, ParameterizedRoute.parse("/users/{userId}/docs/{docId}"), 1);
router.add(HttpMethod.GET, ParameterizedRoute.parse("/festivals/{festivalId}/something"), 1);
router.add(HttpMethod.OPTIONS, ParameterizedRoute.parse("/festivals/{festivalId}/something"), 1);
}
}

0 comments on commit 652926c

Please sign in to comment.