forked from quarkusio/quarkus
-
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Enable Funqy function with same name
Signed-off-by: Matej Vasek <[email protected]>
- Loading branch information
1 parent
c9041ea
commit 24cbc44
Showing
6 changed files
with
100 additions
and
10 deletions.
There are no files selected for viewing
17 changes: 17 additions & 0 deletions
17
...unqy/funqy-knative-events/deployment/src/test/java/io/quarkus/funqy/test/Overloading.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
package io.quarkus.funqy.test; | ||
|
||
import io.quarkus.funqy.Funq; | ||
|
||
public class Overloading { | ||
|
||
@Funq("intfun") | ||
public int function(int i) { | ||
return i * 2; | ||
} | ||
|
||
@Funq("strfun") | ||
public String function(String s) { | ||
return s.toUpperCase(); | ||
} | ||
|
||
} |
31 changes: 31 additions & 0 deletions
31
.../funqy-knative-events/deployment/src/test/java/io/quarkus/funqy/test/OverloadingTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
package io.quarkus.funqy.test; | ||
|
||
import static org.hamcrest.Matchers.equalTo; | ||
|
||
import org.junit.jupiter.api.Test; | ||
import org.junit.jupiter.api.extension.RegisterExtension; | ||
|
||
import io.quarkus.test.QuarkusUnitTest; | ||
import io.restassured.RestAssured; | ||
|
||
public class OverloadingTest { | ||
@RegisterExtension | ||
static QuarkusUnitTest test = new QuarkusUnitTest() | ||
.withApplicationRoot((jar) -> jar | ||
.addClasses(Overloading.class)); | ||
|
||
@Test | ||
public void testMapping() { | ||
RestAssured.given().contentType("application/json") | ||
.body("\"a\"") | ||
.post("/strfun") | ||
.then().statusCode(200) | ||
.body(equalTo("\"A\"")); | ||
|
||
RestAssured.given().contentType("application/json") | ||
.body("10") | ||
.post("/intfun") | ||
.then().statusCode(200) | ||
.body(equalTo("20")); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters