### Question:
Product implements Serializable { public Double getFieldValueAsDouble(String fieldName) { Object value = getFieldValue(fieldName); try { Double doubleValue = (Double) value; return doubleValue; } catch(ClassCastException e) { return null; } } Product(Map<String, Object> fields); ImmutableSet<String> getFieldNames(); Object getFieldValue(String fieldName); String getFieldValueAsString(String fieldName); Double getFieldValueAsDouble(String fieldName); Long getFieldValueAsLong(String fieldName); String toString();  }### Answer:
@Test public void testDouble() { Map<String, Object> fields = Maps.newHashMap(); fields.put(Constants.PRODUCT_CATEGORY, "poop bags"); fields.put(Constants.PRODUCT_QUANTITY, 120); fields.put("price", 12.80); Product product = new Product(fields); assertNull(product.getFieldValueAsDouble(Constants.PRODUCT_CATEGORY)); assertEquals(product.getFieldValueAsDouble("price"), 12.80, 1e-5); assertNull(product.getFieldValueAsDouble(Constants.PRODUCT_QUANTITY)); }