### Question:
Pql { public static Object getApiValue(Value value) { if (value instanceof BooleanValue) { return ((BooleanValue) value).isValue(); } else if (value instanceof NumberValue) { if (((NumberValue) value).getValue() == null) { return null; } else { try { return NumberFormat.getInstance().parse(((NumberValue) value).getValue()); } catch (ParseException e) { throw new IllegalStateException( "Received invalid number format from API: " + ((NumberValue) value).getValue()); } } } else if (value instanceof TextValue) { return ((TextValue) value).getValue(); } else if (value instanceof DateTimeValue) { return ((DateTimeValue) value).getValue(); } else if (value instanceof DateValue) { return ((DateValue) value).getValue(); } else if (value instanceof TargetingValue) { return ((TargetingValue) value).getValue(); } else if (value instanceof SetValue) { List<Value> setValues = ((SetValue) value).getValues(); Set<Object> apiValue = new LinkedHashSet<Object>(); if (setValues != null) { for (Value setValue : setValues) { validateSetValueEntryForSet(getApiValue(setValue), apiValue); apiValue.add(getApiValue(setValue)); } } return apiValue; } else { throw new IllegalArgumentException("Unsupported Value type [" + value.getClass() + "]"); } } private  Pql(); static Value createValue(Object value); static String toString(Value value); static Object getApiValue(Value value); static Object getNativeValue(Value value); static Object getCsvValue(Value value); static List<String[]> resultSetToStringArrayList(ResultSet resultSet); static String resultSetToString(ResultSet resultSet); static List<String> getColumnLabels(ResultSet resultSet); static List<String> getRowStringValues(Row row); static ResultSet combineResultSets(ResultSet first, ResultSet second);  }### Answer:
@Test public void testGetApiValue() { assertEquals("value1", Pql.getApiValue(textValue1)); assertEquals(false, Pql.getApiValue(booleanValue1)); assertEquals(1L, Pql.getApiValue(numberValue1)); assertEquals(1.02, Pql.getApiValue(numberValue2)); assertEquals(dateTime1, Pql.getApiValue(dateTimeValue1)); assertEquals(date1, Pql.getApiValue(dateValue1)); assertNull(Pql.getApiValue(new TextValue())); }
@Test @SuppressWarnings("unchecked") public void testGetApiValue_numberSet() { Set<Object> apiValue = (Set<Object>) Pql.getApiValue(numberSetValue); assertTrue(apiValue.contains(1L)); assertTrue(apiValue.contains(-1L)); assertEquals(2, apiValue.size()); }
@Test @SuppressWarnings("unchecked") public void testGetApiValue_textSet() { Set<Object> apiValue = (Set<Object>) Pql.getApiValue(textSetValue); assertTrue(apiValue.contains("value1")); assertTrue(apiValue.contains("value2")); assertEquals(2, apiValue.size()); }
@Test @SuppressWarnings("unchecked") public void testGetApiValue_commaTextSet() { Set<Object> apiValue = (Set<Object>) Pql.getApiValue(commaTextSetValue); assertTrue(apiValue.contains("value1")); assertTrue(apiValue.contains("comma,separated")); assertEquals(2, apiValue.size()); }
@Test @SuppressWarnings("unchecked") public void testGetApiValue_dateSet() { Set<Object> apiValue = (Set<Object>) Pql.getApiValue(dateSetValue); assertTrue(apiValue.contains(date1)); assertEquals(1, apiValue.size()); }
@Test @SuppressWarnings("unchecked") public void testGetApiValue_dateTimeSet() { Set<Object> apiValue = (Set<Object>) Pql.getApiValue(dateTimeSetValue); assertTrue(apiValue.contains(dateTime1)); assertEquals(1, apiValue.size()); }
@Test public void testGetApiValue_mixedSet() { thrown.expect(IllegalArgumentException.class); Pql.getApiValue(mixedSetValue); }