### Question:
PostgresqlUtils { public static String toQueryValue(Object queryValue) { Objects.requireNonNull(queryValue); if (queryValue instanceof String) { return (String) queryValue; } else if (queryValue instanceof Number) { if (((Number) queryValue).doubleValue() == -0.0) { return "0"; } String numberString = queryValue.toString(); return numberString.replaceAll("^(\\d+)\\.0+$", "$1"); } else if (queryValue instanceof Document) { return toJsonWithClass(queryValue); } else if (queryValue instanceof Map) { return toJson(queryValue); } else if (queryValue instanceof List) { List<?> values = ((List<?>) queryValue).stream() .map(value -> value instanceof Missing ? null : value) .collect(Collectors.toList()); return toJson(values); } else { return toJsonWithClass(queryValue); } } private  PostgresqlUtils(); static String toDataKey(String key); static String toQueryValue(Object queryValue); static boolean isErrorDuplicateKey(SQLException e);  }### Answer:
@Test void testToQueryValue() throws Exception { assertThat(PostgresqlUtils.toQueryValue(123)).isEqualTo("123"); assertThat(PostgresqlUtils.toQueryValue(123.0)).isEqualTo("123"); assertThat(PostgresqlUtils.toQueryValue(123.1)).isEqualTo("123.1"); assertThat(PostgresqlUtils.toQueryValue("foobar")).isEqualTo("foobar"); assertThat(PostgresqlUtils.toQueryValue("1.0")).isEqualTo("1.0"); assertThat(PostgresqlUtils.toQueryValue(new LinkedHashMap<>(Collections.singletonMap("foo", "bar")))).isEqualTo("{\"foo\":\"bar\"}"); assertThat(PostgresqlUtils.toQueryValue(Arrays.asList("foo", "bar"))).isEqualTo("[\"foo\",\"bar\"]"); assertThat(PostgresqlUtils.toQueryValue(new ObjectId("foobarfoobar".getBytes(StandardCharsets.UTF_8)))).isEqualTo("{\"@class\":\"de.bwaldvogel.mongo.bson.ObjectId\",\"data\":\"Zm9vYmFyZm9vYmFy\"}"); assertThat(PostgresqlUtils.toQueryValue(new Document("key", "value"))).isEqualTo("{\"@class\":\"de.bwaldvogel.mongo.bson.Document\",\"key\":\"value\"}"); assertThatExceptionOfType(NullPointerException.class) .isThrownBy(() -> PostgresqlUtils.toQueryValue(null)) .withMessage(null); }