-
Notifications
You must be signed in to change notification settings - Fork 2.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
5 changed files
with
84 additions
and
26 deletions.
There are no files selected for viewing
15 changes: 15 additions & 0 deletions
15
...io/quarkus/amazon/lambda/deployment/testing/LambdaWithCollectionAsInputAndReturnType.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,15 @@ | ||
package io.quarkus.amazon.lambda.deployment.testing; | ||
|
||
import com.amazonaws.services.lambda.runtime.Context; | ||
import com.amazonaws.services.lambda.runtime.RequestHandler; | ||
|
||
import java.util.ArrayList; | ||
import java.util.List; | ||
|
||
public class LambdaWithCollectionAsInputAndReturnType implements RequestHandler<List<Person>, List<Person>> { | ||
|
||
@Override | ||
public List<Person> handleRequest(List<Person> people, Context context) { | ||
return new ArrayList<>(people); | ||
} | ||
} |
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
17 changes: 17 additions & 0 deletions
17
...zon/lambda/deployment/testing/LambdaWithCollectionStringInputAndListPersonReturnType.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.amazon.lambda.deployment.testing; | ||
|
||
import com.amazonaws.services.lambda.runtime.Context; | ||
import com.amazonaws.services.lambda.runtime.RequestHandler; | ||
|
||
import java.util.ArrayList; | ||
import java.util.List; | ||
|
||
public class LambdaWithCollectionStringInputAndListPersonReturnType implements RequestHandler<List<String>, List<Person>> { | ||
|
||
@Override | ||
public List<Person> handleRequest(List<String> strings, Context context) { | ||
List<Person> personList = new ArrayList<>(); | ||
strings.forEach(name -> personList.add(new Person(name))); | ||
return personList; | ||
} | ||
} |
39 changes: 39 additions & 0 deletions
39
...lambda/deployment/testing/LambdaWithCollectionStringInputAndListPersonReturnTypeTest.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,39 @@ | ||
package io.quarkus.amazon.lambda.deployment.testing; | ||
|
||
import io.quarkus.test.QuarkusUnitTest; | ||
import org.jboss.shrinkwrap.api.ShrinkWrap; | ||
import org.jboss.shrinkwrap.api.spec.JavaArchive; | ||
import org.junit.jupiter.api.Test; | ||
import org.junit.jupiter.api.extension.RegisterExtension; | ||
|
||
import java.util.ArrayList; | ||
import java.util.List; | ||
|
||
import static io.restassured.RestAssured.given; | ||
import static org.hamcrest.CoreMatchers.hasItem; | ||
import static org.hamcrest.Matchers.hasEntry; | ||
|
||
public class LambdaWithCollectionStringInputAndListPersonReturnTypeTest { | ||
|
||
@RegisterExtension | ||
static final QuarkusUnitTest test = new QuarkusUnitTest().setArchiveProducer(() -> ShrinkWrap | ||
.create(JavaArchive.class) | ||
.addClasses(LambdaWithCollectionStringInputAndListPersonReturnType.class, Person.class)); | ||
|
||
@Test | ||
void testCollectionLambda() { | ||
|
||
List<String> personList = new ArrayList<>(); | ||
personList.add("Chris"); | ||
personList.add("Fred"); | ||
|
||
given() | ||
.body(personList) | ||
.when() | ||
.post() | ||
.then() | ||
.statusCode(200) | ||
.body("", hasItem(hasEntry("name", "Chris"))) | ||
.body("", hasItem(hasEntry("name", "Fred"))); | ||
} | ||
} |
15 changes: 0 additions & 15 deletions
15
...eployment/src/test/java/io/quarkus/amazon/lambda/deployment/testing/PersonListLambda.java
This file was deleted.
Oops, something went wrong.