@Override
  public void encode(Object object, Type bodyType, RequestTemplate template)
      throws EncodeException {
    if (object == null)
      return;
    if (object instanceof JSONArray || object instanceof JSONObject) {
      template.body(object.toString());
    } else {
      throw new EncodeException(format("%s is not a type supported by this encoder.", bodyType));
    }
  }
@Test
  void unknownTypeThrowsEncodeException() {
    Exception exception = assertThrows(EncodeException.class,
        () -> new JsonEncoder().encode("qwerty", Clock.class, new RequestTemplate()));
    assertThat(exception.getMessage())
        .isEqualTo("class java.time.Clock is not a type supported by this encoder.");
  }