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
* forCode(code).status()}, to more easily conform to HTTP/2:
*
* <blockquote><code>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>
* <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.</blockquote>
*
* @param code the HTTP/2 error code.
* @return a {@link Status} representing the given error.

View File

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