### Question:
StructuredData { public static StructuredDataObject getStructuredData( String objectType, Multimap<String, Object> values) { return getInstance(objectType).getStructuredData(values); } private  StructuredData(ObjectDefinition objectDefinition); static synchronized void initFromConfiguration(IndexingService indexingService); static synchronized void init(Schema schema); static boolean isInitialized(); static boolean hasObjectDefinition(String objectType); static StructuredDataObject getStructuredData(
      String objectType, Multimap<String, Object> values); static final String DATETIME_PATTERNS; static final String LOCAL_SCHEMA; }### Answer:
@Test public void testGetStructuredData() { setupSchema(); StructuredDataObject expected = new StructuredDataObject() .setProperties( Arrays.asList( new NamedProperty() .setName("textProperty") .setTextValues(new TextValues().setValues(Arrays.asList("v1", "v2"))), new NamedProperty() .setName("htmlProperty") .setHtmlValues(new HtmlValues().setValues(Arrays.asList("f1", "f2"))), new NamedProperty().setName("booleanProperty").setBooleanValue(false))); Multimap<String, Object> values = ArrayListMultimap.create(); values.put("textProperty", "v1"); values.put("textProperty", "v2"); values.put("htmlProperty", "f1"); values.put("htmlProperty", "f2"); values.put("htmlProperty", null); values.put("booleanProperty", "false"); values.put("booleanProperty", true); assertEquals(expected, StructuredData.getStructuredData("myObject", values)); }
@Test public void testInvalidNestedObjectValues() { setupSchema(); Multimap<String, Object> values = ArrayListMultimap.create(); values.put("objectProperty", "invalid"); thrown.expect(IllegalArgumentException.class); StructuredData.getStructuredData("myObject", values); }
@Test public void testConversionError() { setupSchema(); Multimap<String, Object> values = ArrayListMultimap.create(); values.put("integerProperty", "v1"); thrown.expect(NumberFormatException.class); StructuredData.getStructuredData("myObject", values); }
@Test public void testConversionErrorBoolean() { setupSchema(); Multimap<String, Object> values = ArrayListMultimap.create(); values.put("booleanProperty", new DateTime(System.currentTimeMillis())); thrown.expect(IllegalArgumentException.class); StructuredData.getStructuredData("myObject", values); }
@Test public void testConversionErrorDateTime() { setupSchema(); Multimap<String, Object> values = ArrayListMultimap.create(); values.put("dateTimeProperty", "v1"); thrown.expect(NumberFormatException.class); StructuredData.getStructuredData("myObject", values); }
@Test public void testConversionErrorEnum_string() { setupSchema(); Multimap<String, Object> values = ArrayListMultimap.create(); values.put("enumProperty", "P99"); thrown.expect(IllegalArgumentException.class); StructuredData.getStructuredData("myObject", values); }
@Test public void testConversionErrorEnum_intString() { setupSchema(); Multimap<String, Object> values = ArrayListMultimap.create(); values.put("enumProperty", "99"); thrown.expect(IllegalArgumentException.class); StructuredData.getStructuredData("myObject", values); }
@Test public void testConversionErrorEnum_integer() { setupSchema(); Multimap<String, Object> values = ArrayListMultimap.create(); values.put("enumProperty", Integer.valueOf(99)); thrown.expect(IllegalArgumentException.class); StructuredData.getStructuredData("myObject", values); }