### Question:
MultipartPart implements Closeable { protected void visitDispositionHeader(PartVisitor visitor) { visitor.withBytes(CRLF_BYTES); visitor.withBytes(CONTENT_DISPOSITION_BYTES); visitor.withBytes(part.getDispositionType() != null ? part.getDispositionType().getBytes(US_ASCII) : FORM_DATA_DISPOSITION_TYPE_BYTES); if (part.getName() != null) { visitor.withBytes(NAME_BYTES); visitor.withByte(QUOTE_BYTE); visitor.withBytes(part.getName().getBytes(US_ASCII)); visitor.withByte(QUOTE_BYTE); } } 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 testVisitDispositionHeaderWithoutFileName() { TestFileLikePart fileLikePart = new TestFileLikePart("Name"); try (TestMultipartPart multipartPart = new TestMultipartPart(fileLikePart, new byte[0])) { CounterPartVisitor counterVisitor = new CounterPartVisitor(); multipartPart.visitDispositionHeader(counterVisitor); assertEquals(counterVisitor.getCount(), 45, "CounterPartVisitor count for visitDispositionHeader should be equal to " + "CRLF_BYTES length + CONTENT_DISPOSITION_BYTES length + part name length when file name is not specified"); } }
@Test public void testVisitDispositionHeaderWithFileName() { TestFileLikePart fileLikePart = new TestFileLikePart("baPart", null, null, null, null, "fileName"); try (TestMultipartPart multipartPart = new TestMultipartPart(fileLikePart, new byte[0])) { CounterPartVisitor counterVisitor = new CounterPartVisitor(); multipartPart.visitDispositionHeader(counterVisitor); assertEquals(counterVisitor.getCount(), 68, "CounterPartVisitor count for visitDispositionHeader should be equal to " + "CRLF_BYTES length + CONTENT_DISPOSITION_BYTES length + part name length + file name length when" + " both part name and file name are present"); } }
@Test public void testVisitDispositionHeaderWithoutName() { TestFileLikePart fileLikePart = new TestFileLikePart(null, null, null, null, null, "fileName"); try (TestMultipartPart multipartPart = new TestMultipartPart(fileLikePart, new byte[0])) { CounterPartVisitor counterVisitor = new CounterPartVisitor(); multipartPart.visitDispositionHeader(counterVisitor); assertEquals(counterVisitor.getCount(), 53, "CounterPartVisitor count for visitDispositionHeader should be equal to " + "CRLF_BYTES length + CONTENT_DISPOSITION_BYTES length + file name length when part name is not specified"); } }