### Question:
MultipartPart implements Closeable { protected void visitContentTypeHeader(PartVisitor visitor) { String contentType = part.getContentType(); if (contentType != null) { visitor.withBytes(CRLF_BYTES); visitor.withBytes(CONTENT_TYPE_BYTES); visitor.withBytes(contentType.getBytes(US_ASCII)); Charset charSet = part.getCharset(); if (charSet != null) { visitor.withBytes(CHARSET_BYTES); visitor.withBytes(part.getCharset().name().getBytes(US_ASCII)); } } } MultipartPart(T part, byte[] boundary); long length(); MultipartState getState(); boolean isTargetSlow(); long transferTo(ByteBuf target); long transferTo(WritableByteChannel target); @Override void close();  }### Answer:
@Test public void testVisitContentTypeHeaderWithCharset() { TestFileLikePart fileLikePart = new TestFileLikePart(null, "application/test", UTF_8, null, null); try (TestMultipartPart multipartPart = new TestMultipartPart(fileLikePart, new byte[0])) { CounterPartVisitor counterVisitor = new CounterPartVisitor(); multipartPart.visitContentTypeHeader(counterVisitor); assertEquals(counterVisitor.getCount(), 47, "CounterPartVisitor count for visitContentTypeHeader should be equal to " + "CRLF_BYTES length + CONTENT_TYPE_BYTES length + contentType length + charset length"); } }
@Test public void testVisitContentTypeHeaderWithoutCharset() { TestFileLikePart fileLikePart = new TestFileLikePart(null, "application/test"); try (TestMultipartPart multipartPart = new TestMultipartPart(fileLikePart, new byte[0])) { CounterPartVisitor counterVisitor = new CounterPartVisitor(); multipartPart.visitContentTypeHeader(counterVisitor); assertEquals(counterVisitor.getCount(), 32, "CounterPartVisitor count for visitContentTypeHeader should be equal to " + "CRLF_BYTES length + CONTENT_TYPE_BYTES length + contentType length when charset is not specified"); } }