use of eu.esdihumboldt.hale.common.lookup.LookupTable in project hale by halestudio.
the class LookupTableTypeTest method testStringLookup.
/**
* Test if a simple lookup table containing only string values is the same
* when converted to DOM and back again.
*/
@Test
public void testStringLookup() {
Map<Value, Value> values = createStringLookup();
LookupTable org = new LookupTableImpl(values);
// convert to DOM
Element fragment = HaleIO.getComplexElement(org);
// convert back
LookupTable conv = HaleIO.getComplexValue(fragment, LookupTable.class, null);
checkTable(conv, values);
}
use of eu.esdihumboldt.hale.common.lookup.LookupTable in project hale by halestudio.
the class LookupTableTypeTest method testStringLookupJson.
/**
* Test if a simple lookup table containing only string values is the same
* when converted to JSON and back again.
*/
@Test
public void testStringLookupJson() {
Map<Value, Value> values = createStringLookup();
LookupTable org = new LookupTableImpl(values);
// converter
LookupTableType ltt = new LookupTableType();
// convert to Json
StringWriter writer = new StringWriter();
ltt.toJson(org, writer);
System.out.println(writer.toString());
// convert back
LookupTable conv = ltt.fromJson(new StringReader(writer.toString()), null);
checkTable(conv, values);
}
use of eu.esdihumboldt.hale.common.lookup.LookupTable in project hale by halestudio.
the class LookupTableTypeTest method testComplexLookupJson.
/**
* Test if a lookup table containing only complex values is the same when
* converted to JSON and back again.
*/
@Test
public void testComplexLookupJson() {
Map<Value, Value> values2 = createComplexLookup();
LookupTable org2 = new LookupTableImpl(values2);
// converter
LookupTableType ltt = new LookupTableType();
// convert to Json
StringWriter writer = new StringWriter();
ltt.toJson(org2, writer);
System.out.println(writer.toString());
// convert back
LookupTable conv = ltt.fromJson(new StringReader(writer.toString()), null);
checkTable(conv, values2);
}
Aggregations