Reorganize tests. Tweak Javadoc formatting

This commit is contained in:
Eric Anderson 2015-03-11 15:10:35 -07:00
parent 0e904f08e0
commit 8986fc3412
2 changed files with 11 additions and 12 deletions

View File

@ -192,8 +192,8 @@ public final class HttpUtil {
* Looks up the {@link Status} from the given HTTP/2 error code. This is preferred over {@code * Looks up the {@link Status} from the given HTTP/2 error code. This is preferred over {@code
* forCode(code).status()}, to more easily conform to HTTP/2: * forCode(code).status()}, to more easily conform to HTTP/2:
* *
* <blockquote><code>Unknown or unsupported error codes MUST NOT trigger any special behavior. * <blockquote>Unknown or unsupported error codes MUST NOT trigger any special behavior.
* These MAY be treated by an implementation as being equivalent to INTERNAL_ERROR.</code> * These MAY be treated by an implementation as being equivalent to INTERNAL_ERROR.</blockquote>
* *
* @param code the HTTP/2 error code. * @param code the HTTP/2 error code.
* @return a {@link Status} representing the given error. * @return a {@link Status} representing the given error.

View File

@ -43,20 +43,19 @@ import org.junit.runners.JUnit4;
@RunWith(JUnit4.class) @RunWith(JUnit4.class)
public class HttpUtilTest { public class HttpUtilTest {
@Test @Test
public void http2ErrorRoundTrip() { public void http2ErrorForCode() {
// Try edge cases manually, to make the test obviously correct for important cases. // Try edge cases manually, to make the test obviously correct for important cases.
assertSame(Http2Error.NO_ERROR, Http2Error.forCode(Http2Error.NO_ERROR.code())); assertNull(Http2Error.forCode(-1));
assertSame(Http2Error.HTTP_1_1_REQUIRED, assertSame(Http2Error.NO_ERROR, Http2Error.forCode(0));
Http2Error.forCode(Http2Error.HTTP_1_1_REQUIRED.code())); assertSame(Http2Error.HTTP_1_1_REQUIRED, Http2Error.forCode(0xD));
for (Http2Error error : Http2Error.values()) { assertNull(Http2Error.forCode(0xD + 1));
assertSame(error, Http2Error.forCode(error.code()));
}
} }
@Test @Test
public void http2ErrorNoCode() { public void http2ErrorRoundTrip() {
assertNull(Http2Error.forCode(-1)); for (Http2Error error : Http2Error.values()) {
assertNull(Http2Error.forCode(0xD + 1)); assertSame(error, Http2Error.forCode(error.code()));
}
} }
@Test @Test