|
20 | 20 | import io.opentelemetry.instrumentation.testing.junit.http.HttpServerInstrumentationExtension;
|
21 | 21 | import io.opentelemetry.instrumentation.testing.junit.http.HttpServerTestOptions;
|
22 | 22 | import io.opentelemetry.instrumentation.testing.junit.http.ServerEndpoint;
|
23 |
| -import java.io.IOException; |
24 | 23 | import java.util.HashSet;
|
25 | 24 | import java.util.Set;
|
26 | 25 | import org.glassfish.grizzly.http.server.HttpHandler;
|
@@ -52,33 +51,18 @@ public void service(Request request, Response response) throws Exception {
|
52 | 51 | endpoint,
|
53 | 52 | () -> {
|
54 | 53 | if (endpoint.equals(SUCCESS)) {
|
55 |
| - try { |
56 |
| - response.getWriter().write(endpoint.getBody()); |
57 |
| - } catch (IOException e) { |
58 |
| - throw new RuntimeException(e); |
59 |
| - } |
| 54 | + response.getWriter().write(endpoint.getBody()); |
60 | 55 | } else if (endpoint.equals(INDEXED_CHILD)) {
|
61 |
| - response.setStatus(endpoint.getStatus()); |
62 | 56 | endpoint.collectSpanAttributes(request::getParameter);
|
| 57 | + response.setStatus(endpoint.getStatus()); |
| 58 | + response.getWriter().write(endpoint.getBody()); |
63 | 59 | } else if (endpoint.equals(QUERY_PARAM)) {
|
64 | 60 | response.setStatus(endpoint.getStatus());
|
65 |
| - try { |
66 |
| - response.getWriter().write(request.getQueryString()); |
67 |
| - } catch (IOException e) { |
68 |
| - throw new RuntimeException(e); |
69 |
| - } |
| 61 | + response.getWriter().write(request.getQueryString()); |
70 | 62 | } else if (endpoint.equals(REDIRECT)) {
|
71 |
| - try { |
72 |
| - response.sendRedirect(endpoint.getBody()); |
73 |
| - } catch (IOException e) { |
74 |
| - throw new RuntimeException(e); |
75 |
| - } |
| 63 | + response.sendRedirect(endpoint.getBody()); |
76 | 64 | } else if (endpoint.equals(ERROR)) {
|
77 |
| - try { |
78 |
| - response.sendError(endpoint.getStatus(), endpoint.getBody()); |
79 |
| - } catch (IOException e) { |
80 |
| - throw new RuntimeException(e); |
81 |
| - } |
| 65 | + response.sendError(endpoint.getStatus(), endpoint.getBody()); |
82 | 66 | } else if (endpoint.equals(NOT_FOUND)) {
|
83 | 67 | response.setStatus(endpoint.getStatus());
|
84 | 68 | } else if (endpoint.equals(EXCEPTION)) {
|
|
0 commit comments