### Question:
LiteralSupport { static Object getLiteralValue(String literal) { if (literal == null || literal.isEmpty()) { return Result.NOT_FOUND; } Object value = Result.NOT_FOUND; if (isStringLiteralSeparator(literal.charAt(0))) { value = literal.substring(1, literal.length() - 1); } else if (literal.equals("true")) { value = Boolean.TRUE; } else if (literal.equals("false")) { value = Boolean.FALSE; } else if (literal.equals("null")) { value = null; } else { char firstChar = literal.charAt(0); if (Character.isDigit(firstChar) || firstChar == '-' || firstChar == '+') { if (INTEGER_LITERAL_PATTERN.matcher(literal).matches()) { try { value = Integer.parseInt(literal); } catch (NumberFormatException e) { LOGGER.warn("Unable to parse integer literal: " + literal, e); } } else if (LONG_LITERAL_PATTERN.matcher(literal).matches()) { try { value = Long .parseLong(literal.substring(0, literal.length() - 1)); } catch (NumberFormatException e) { LOGGER.warn("Unable to parse long literal: " + literal, e); } } else if (DOUBLE_LITERAL_PATTERN.matcher(literal).matches()) { try { value = Double .parseDouble(literal.substring(0, literal.length() - 1)); } catch (NumberFormatException e) { LOGGER.warn("Unable to parse double literal: " + literal, e); } } else if (FLOAT_LITERAL_PATTERN.matcher(literal).matches()) { try { value = Float .parseFloat(literal.substring(0, literal.length() - 1)); } catch (NumberFormatException e) { LOGGER.warn("Unable to parse float literal: " + literal, e); } } } } return value; }    }### Answer:
@Test public void testNumbers() { assertEquals(Integer.valueOf(43), LiteralSupport.getLiteralValue("43")); assertEquals(Long.valueOf(1000), LiteralSupport.getLiteralValue("1000l")); assertEquals(Long.valueOf(-10), LiteralSupport.getLiteralValue("-10L")); assertEquals(Double.valueOf(1.0d), LiteralSupport.getLiteralValue("1d")); assertEquals(Double.valueOf(2.12d), LiteralSupport.getLiteralValue("+2.12d")); assertEquals(Double.valueOf(-2.12d), LiteralSupport.getLiteralValue("-2.12d")); assertEquals(Double.valueOf(123.4d), LiteralSupport.getLiteralValue("123.4D")); assertEquals(Float.valueOf(2.12f), LiteralSupport.getLiteralValue("2.12f")); assertEquals(Float.valueOf(2.12f), LiteralSupport.getLiteralValue("2.12F")); }
@Test public void testBooleans() { assertEquals(Boolean.TRUE, LiteralSupport.getLiteralValue("true")); assertEquals(Boolean.FALSE, LiteralSupport.getLiteralValue("false")); }
@Test public void testNull() { assertNull(LiteralSupport.getLiteralValue("null")); }
@Test public void testStrings() { assertEquals("foo", LiteralSupport.getLiteralValue("'foo'")); assertEquals("foo", LiteralSupport.getLiteralValue("\"foo\"")); }