File tree Expand file tree Collapse file tree
main/java/io/grpc/transport
test/java/io/grpc/transport Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -192,8 +192,8 @@ public static Http2Error forCode(long code) {
192192 * Looks up the {@link Status} from the given HTTP/2 error code. This is preferred over {@code
193193 * forCode(code).status()}, to more easily conform to HTTP/2:
194194 *
195- * <blockquote><code> Unknown or unsupported error codes MUST NOT trigger any special behavior.
196- * These MAY be treated by an implementation as being equivalent to INTERNAL_ERROR.</code >
195+ * <blockquote>Unknown or unsupported error codes MUST NOT trigger any special behavior.
196+ * These MAY be treated by an implementation as being equivalent to INTERNAL_ERROR.</blockquote >
197197 *
198198 * @param code the HTTP/2 error code.
199199 * @return a {@link Status} representing the given error.
Original file line number Diff line number Diff line change 4343@ RunWith (JUnit4 .class )
4444public class HttpUtilTest {
4545 @ Test
46- public void http2ErrorRoundTrip () {
46+ public void http2ErrorForCode () {
4747 // Try edge cases manually, to make the test obviously correct for important cases.
48- assertSame (Http2Error .NO_ERROR , Http2Error .forCode (Http2Error .NO_ERROR .code ()));
49- assertSame (Http2Error .HTTP_1_1_REQUIRED ,
50- Http2Error .forCode (Http2Error .HTTP_1_1_REQUIRED .code ()));
51- for (Http2Error error : Http2Error .values ()) {
52- assertSame (error , Http2Error .forCode (error .code ()));
53- }
48+ assertNull (Http2Error .forCode (-1 ));
49+ assertSame (Http2Error .NO_ERROR , Http2Error .forCode (0 ));
50+ assertSame (Http2Error .HTTP_1_1_REQUIRED , Http2Error .forCode (0xD ));
51+ assertNull (Http2Error .forCode (0xD + 1 ));
5452 }
5553
5654 @ Test
57- public void http2ErrorNoCode () {
58- assertNull (Http2Error .forCode (-1 ));
59- assertNull (Http2Error .forCode (0xD + 1 ));
55+ public void http2ErrorRoundTrip () {
56+ for (Http2Error error : Http2Error .values ()) {
57+ assertSame (error , Http2Error .forCode (error .code ()));
58+ }
6059 }
6160
6261 @ Test
You can’t perform that action at this time.
0 commit comments