### Question:
MultiPartBoundaryBuilder { public String getMultiPartContent(HttpServletRequest request, String xmlSct, String jsonPart) { String contentTypeHeader = request.getHeader(HttpHeaders.CONTENT_TYPE); String boundary = DEFAULT_BOUNDARY; if (contentTypeHeader != null && contentTypeHeader.contains(MediaType.MULTIPART_FORM_DATA_VALUE) && contentTypeHeader.contains(BOUNDARY)) { String boundaryValue = contentTypeHeader.substring(contentTypeHeader.indexOf(BOUNDARY) + BOUNDARY.length()); boundary = boundaryValue.startsWith(BOUNDARY_PREFIX) ? boundaryValue : BOUNDARY_PREFIX + boundaryValue; } return contentTemplate .replaceAll(BOUNDARY_PLACEHOLDER, boundary) .replaceAll(XMLPART_PLACEHOLDER, xmlSct) .replaceAll(JSONPART_PLACEHOLDER, jsonPart) .trim(); }  String getMultiPartContent(HttpServletRequest request, String xmlSct, String jsonPart);  }### Answer:
@Test void getMultiPartContent() { String boundary = "1RECORD2_3BOUNDARY"; request.addHeader(HttpHeaders.CONTENT_TYPE, "multipart/form-data; boundary=" + boundary); String actual = builder.getMultiPartContent(request, xmlPart, jsonPart); assertEquals(content.replaceAll("BOUNDARY", boundary), actual); }
@Test void getMultiPartContent_emptyBoundary_default() { request.addHeader(HttpHeaders.CONTENT_TYPE, "multipart/form-data;"); String actual = builder.getMultiPartContent(request, xmlPart, jsonPart); assertEquals(content.replaceAll("BOUNDARY", DEFAULT_BOUNDARY.replace("--", "")), actual); }