Skip to content

Commit

Permalink
REST client encoding test
Browse files Browse the repository at this point in the history
  • Loading branch information
stuartwdouglas authored and gastaldi committed Oct 9, 2020
1 parent 6824ac9 commit db1a7c3
Show file tree
Hide file tree
Showing 5 changed files with 31 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,13 @@ public TestResource.MyData getDataCdi() {
return restClientInterface.getData();
}

@GET
@Path("encoding")
public String testEmojis() {
return restClientInterface.echo(
"\uD83D\uDE00\uD83D\uDE00\uD83D\uDE00\uD83D\uDE00\uD83D\uDE00\uD83D\uDE00\uD83D\uDE00\uD83D\uDE00");
}

@GET
@Path("async/cdi/jackson")
@Produces("application/json")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import javax.enterprise.context.Dependent;
import javax.ws.rs.GET;
import javax.ws.rs.Path;
import javax.ws.rs.PathParam;
import javax.ws.rs.Produces;

import org.eclipse.microprofile.rest.client.annotation.RegisterClientHeaders;
Expand All @@ -16,6 +17,10 @@
@RegisterClientHeaders
public interface RestClientInterface {

@GET
@Path("/echo/{echo}")
String echo(@PathParam("echo") String echo);

@GET
String get();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@

import javax.ws.rs.GET;
import javax.ws.rs.Path;
import javax.ws.rs.PathParam;
import javax.ws.rs.Produces;

import org.eclipse.microprofile.rest.client.annotation.RegisterClientHeaders;
Expand All @@ -19,6 +20,10 @@ public interface RestInterface {
@GET
String get();

@GET
@Path("/echo/{echo}")
String echo(@PathParam("echo") String echo);

@GET
CompletionStage<String> asyncGet();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -320,6 +320,13 @@ public MyEntity fromJson() throws Exception {
}
}

@GET
@Path("/echo/{echo}")
@Produces("application/json")
public String echo(@PathParam("echo") String echo) {
return echo;
}

@GET
@Path("params/{path}")
public void regularParams(@PathParam("path") String path,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,13 @@ public void testMicroprofileClientCDIIntegration() {
.body(is("TEST"));
}

@Test
public void testEmojis() {
RestAssured.when().get("/client/encoding")
.then().body(is(
"\uD83D\uDE00\uD83D\uDE00\uD83D\uDE00\uD83D\uDE00\uD83D\uDE00\uD83D\uDE00\uD83D\uDE00\uD83D\uDE00"));
}

@Test
void testMicroprofileClientData() {
JsonPath jsonPath = RestAssured.when().get("/client/manual/jackson").thenReturn().jsonPath();
Expand Down

0 comments on commit db1a7c3

Please sign in to comment.