@Test public void testConvertObject() { FixtureMap parent = new FixtureMap(); Date date = new Date(); FixtureValue value = FixtureTemplateWrapper.wrap(date, "test", parent); assertEquals(date, value.getValue()); assertEquals("test", value.getFixtureName()); assertEquals(parent, value.getParent()); String string = "string"; FixtureValue value2 = FixtureTemplateWrapper.wrap(string, "test", parent); assertEquals("string", value2.getValue()); assertEquals("test", value2.getFixtureName()); assertEquals(parent, value2.getParent()); }
@SuppressWarnings("unchecked") public static FixtureMap wrap(Map<String, ? extends Object> source, String fixtureName, FixtureTemplate parent) { FixtureMap fixtureMap = new FixtureMap(); fixtureMap.setFixtureName(fixtureName); fixtureMap.setParent(parent); for (Map.Entry<String, ? extends Object> entry : source.entrySet()) { String key = entry.getKey(); if (entry.getValue() instanceof Map) { fixtureMap.put(entry.getKey(), wrap((Map) entry.getValue(), key, fixtureMap)); } else if (entry.getValue() instanceof List) { fixtureMap.put(entry.getKey(), wrap((List) entry.getValue(), key, fixtureMap)); } else { FixtureValue wrapped = wrap(entry.getValue(), entry.getKey(), fixtureMap); fixtureMap.put(entry.getKey(), wrapped); } } return fixtureMap; }
FixtureTemplateWrapper { @SuppressWarnings("unchecked") public static FixtureMap wrap(Map<String, ? extends Object> source, String fixtureName, FixtureTemplate parent) { FixtureMap fixtureMap = new FixtureMap(); fixtureMap.setFixtureName(fixtureName); fixtureMap.setParent(parent); for (Map.Entry<String, ? extends Object> entry : source.entrySet()) { String key = entry.getKey(); if (entry.getValue() instanceof Map) { fixtureMap.put(entry.getKey(), wrap((Map) entry.getValue(), key, fixtureMap)); } else if (entry.getValue() instanceof List) { fixtureMap.put(entry.getKey(), wrap((List) entry.getValue(), key, fixtureMap)); } else { FixtureValue wrapped = wrap(entry.getValue(), entry.getKey(), fixtureMap); fixtureMap.put(entry.getKey(), wrapped); } } return fixtureMap; } }
FixtureTemplateWrapper { @SuppressWarnings("unchecked") public static FixtureMap wrap(Map<String, ? extends Object> source, String fixtureName, FixtureTemplate parent) { FixtureMap fixtureMap = new FixtureMap(); fixtureMap.setFixtureName(fixtureName); fixtureMap.setParent(parent); for (Map.Entry<String, ? extends Object> entry : source.entrySet()) { String key = entry.getKey(); if (entry.getValue() instanceof Map) { fixtureMap.put(entry.getKey(), wrap((Map) entry.getValue(), key, fixtureMap)); } else if (entry.getValue() instanceof List) { fixtureMap.put(entry.getKey(), wrap((List) entry.getValue(), key, fixtureMap)); } else { FixtureValue wrapped = wrap(entry.getValue(), entry.getKey(), fixtureMap); fixtureMap.put(entry.getKey(), wrapped); } } return fixtureMap; }  }
FixtureTemplateWrapper { @SuppressWarnings("unchecked") public static FixtureMap wrap(Map<String, ? extends Object> source, String fixtureName, FixtureTemplate parent) { FixtureMap fixtureMap = new FixtureMap(); fixtureMap.setFixtureName(fixtureName); fixtureMap.setParent(parent); for (Map.Entry<String, ? extends Object> entry : source.entrySet()) { String key = entry.getKey(); if (entry.getValue() instanceof Map) { fixtureMap.put(entry.getKey(), wrap((Map) entry.getValue(), key, fixtureMap)); } else if (entry.getValue() instanceof List) { fixtureMap.put(entry.getKey(), wrap((List) entry.getValue(), key, fixtureMap)); } else { FixtureValue wrapped = wrap(entry.getValue(), entry.getKey(), fixtureMap); fixtureMap.put(entry.getKey(), wrapped); } } return fixtureMap; }  @SuppressWarnings("unchecked") static FixtureMap wrap(Map<String, ? extends Object> source, String fixtureName, FixtureTemplate parent); @SuppressWarnings("unchecked") static FixtureList wrap(List<? extends Object> source, String fixtureName, FixtureTemplate parent); static FixtureValue wrap(Object source, String fixtureName, FixtureTemplate parent); }
FixtureTemplateWrapper { @SuppressWarnings("unchecked") public static FixtureMap wrap(Map<String, ? extends Object> source, String fixtureName, FixtureTemplate parent) { FixtureMap fixtureMap = new FixtureMap(); fixtureMap.setFixtureName(fixtureName); fixtureMap.setParent(parent); for (Map.Entry<String, ? extends Object> entry : source.entrySet()) { String key = entry.getKey(); if (entry.getValue() instanceof Map) { fixtureMap.put(entry.getKey(), wrap((Map) entry.getValue(), key, fixtureMap)); } else if (entry.getValue() instanceof List) { fixtureMap.put(entry.getKey(), wrap((List) entry.getValue(), key, fixtureMap)); } else { FixtureValue wrapped = wrap(entry.getValue(), entry.getKey(), fixtureMap); fixtureMap.put(entry.getKey(), wrapped); } } return fixtureMap; }  @SuppressWarnings("unchecked") static FixtureMap wrap(Map<String, ? extends Object> source, String fixtureName, FixtureTemplate parent); @SuppressWarnings("unchecked") static FixtureList wrap(List<? extends Object> source, String fixtureName, FixtureTemplate parent); static FixtureValue wrap(Object source, String fixtureName, FixtureTemplate parent);  }