### Question:
HttpConversionUtil { static void setHttp2Authority(final String authority, final Http2Headers out) { if (authority != null) { if (authority.isEmpty()) { out.authority(EMPTY_STRING); } else { final int start = authority.indexOf('@') + 1; final int length = authority.length() - start; if (length == 0) { throw new IllegalArgumentException("authority: " + authority); } out.authority(new AsciiString(authority, start, length)); } } } private  HttpConversionUtil(); static HttpResponseStatus parseStatus(final CharSequence status); static FullHttpResponse toFullHttpResponse(
      final int streamId,
      final Http2Headers http2Headers,
      final ByteBufAllocator alloc,
      final boolean validateHttpHeaders); static FullHttpRequest toFullHttpRequest(
      final int streamId,
      final Http2Headers http2Headers,
      final ByteBufAllocator alloc,
      final boolean validateHttpHeaders); static HttpRequest toHttpRequest(
      final int streamId, final Http2Headers http2Headers, final boolean validateHttpHeaders); static HttpResponse toHttpResponse(
      final int streamId, final Http2Headers http2Headers, final boolean validateHttpHeaders); static void addHttp2ToHttpHeaders(
      final int streamId,
      final Http2Headers sourceHeaders,
      final FullHttpMessage destinationMessage,
      final boolean addToTrailer); static void addHttp2ToHttpHeaders(
      final int streamId,
      final Http2Headers inputHeaders,
      final HttpHeaders outputHeaders,
      final HttpVersion httpVersion,
      final boolean isTrailer,
      final boolean isRequest); static Http2Headers toHttp2Headers(final HttpMessage in, final boolean validateHeaders); static Http2Headers toHttp2Headers(
      final HttpHeaders inHeaders, final boolean validateHeaders); static void toHttp2Headers(final HttpHeaders inHeaders, final Http2Headers out); static final HttpMethod OUT_OF_MESSAGE_SEQUENCE_METHOD; static final String OUT_OF_MESSAGE_SEQUENCE_PATH; static final HttpResponseStatus OUT_OF_MESSAGE_SEQUENCE_RETURN_CODE; }### Answer:
@Test public void setHttp2AuthorityWithoutUserInfo() { final Http2Headers headers = new DefaultHttp2Headers(); HttpConversionUtil.setHttp2Authority("foo", headers); assertEquals(new AsciiString("foo"), headers.authority()); }
@Test public void setHttp2AuthorityWithUserInfo() { final Http2Headers headers = new DefaultHttp2Headers(); HttpConversionUtil.setHttp2Authority("info@foo", headers); assertEquals(new AsciiString("foo"), headers.authority()); HttpConversionUtil.setHttp2Authority("@foo.bar", headers); assertEquals(new AsciiString("foo.bar"), headers.authority()); }
@Test public void setHttp2AuthorityNullOrEmpty() { final Http2Headers headers = new DefaultHttp2Headers(); HttpConversionUtil.setHttp2Authority(null, headers); assertNull(headers.authority()); HttpConversionUtil.setHttp2Authority("", headers); assertSame(AsciiString.EMPTY_STRING, headers.authority()); }
@Test(expected = IllegalArgumentException.class) public void setHttp2AuthorityWithEmptyAuthority() { HttpConversionUtil.setHttp2Authority("info@", new DefaultHttp2Headers()); }