### Question:
StringEncoder implements RequestEncoder { @Override public void apply(Object content, RequestSpecification requestSpecification) { if (content != null) { requestSpecification.content(content.toString().getBytes(StandardCharsets.UTF_8)); } }  @Override void apply(Object content, RequestSpecification requestSpecification);  }### Answer:
@Test void apply_toString() { RequestEncoder encoder = new StringEncoder(); RequestSpecification requestSpecification = mock(RequestSpecification.class); encoder.apply("content", requestSpecification); verify(requestSpecification, times(1)).content(any(byte[].class)); }
@Test void apply_withNullSkips() { RequestEncoder encoder = new StringEncoder(); RequestSpecification requestSpecification = mock(RequestSpecification.class); encoder.apply(null, requestSpecification); verifyZeroInteractions(requestSpecification); }