### Question:
FormBodyPublisher implements MimeBodyPublisher { public static Builder newBuilder() { return new Builder(); } private  FormBodyPublisher(Map<String, List<String>> queries); String encodedString(); Optional<String> firstQuery(String name); Optional<String> lastQuery(String name); Map<String, List<String>> queries(); @Override MediaType mediaType(); @Override long contentLength(); @Override void subscribe(Subscriber<? super ByteBuffer> subscriber); static Builder newBuilder();  }### Answer:
@Test void encodedString_safe() { var formBody = FormBodyPublisher.newBuilder() .query("stranger", "danger") .query("leader", "believer") .query("safe", "*.-_") .build(); assertSameContent("stranger=danger&leader=believer&safe=*.-_", formBody); }
@Test void encodedString_unsafe() { var formBody = FormBodyPublisher.newBuilder() .query("some_unsafe", "&(@___@)&") .query("more uns@fe", "¥£$") .build(); assertSameContent("some_unsafe=%26%28%40___%40%29%26&more+uns%40fe=%C2%A5%C2%A3%24", formBody); }
@Test void serializeBody() { var formBody = FormBodyPublisher.newBuilder() .query("eyy+oh&ooh=help", "¥£$ but actually ηΦ") .query("fresh", "avocado") .query("sexy veg@n", "¤") .build(); assertSameContent( "eyy%2Boh%26ooh%3Dhelp=%C2%A5%C2%A3%24+but+actually+%CE%B7%CE%A6&fresh=avocado&sexy+veg%40n=%C2%A4", formBody); }