use of net.sf.jtreemap.swing.TreeMapNode in project beakerx by twosigma.
the class TreeMapNodeSerializerTest method serializeChildrenOfTreeMapNode_resultJsonHasChildren.
@Test
public void serializeChildrenOfTreeMapNode_resultJsonHasChildren() throws IOException {
// when
TreeMapNode treeMapNodeRoot = new TreeMapNode("001");
treeMapNodeRoot.add(new TreeMapNode("010", 1, new DefaultValue(1.5)));
treeMapNodeRoot.add(new TreeMapNode("020", 2, new DefaultValue(2.5)));
treeMapNodeSerializer.serialize(treeMapNodeRoot, jgen, new DefaultSerializerProvider.Impl());
jgen.flush();
// then
JsonNode actualObj = mapper.readTree(sw.toString());
Assertions.assertThat(actualObj.has("children")).isTrue();
Assertions.assertThat(actualObj.get("children")).isNotEmpty();
}
use of net.sf.jtreemap.swing.TreeMapNode in project beakerx by twosigma.
the class TreeMapNodeSerializerTest method serializeLabelOfTreeMapNode_resultJsonHasLabel.
@Test
public void serializeLabelOfTreeMapNode_resultJsonHasLabel() throws IOException {
// when
TreeMapNode treeMapNode = new TreeMapNode("010", 1, new DefaultValue(1.5));
treeMapNode.setUserObject(values);
treeMapNodeSerializer.serialize(treeMapNode, jgen, new DefaultSerializerProvider.Impl());
jgen.flush();
// then
JsonNode actualObj = mapper.readTree(sw.toString());
Assertions.assertThat(actualObj.has("label")).isTrue();
Assertions.assertThat(actualObj.get("label").asText()).isEqualTo("some label");
}
use of net.sf.jtreemap.swing.TreeMapNode in project beakerx by twosigma.
the class TreeMapNodeSerializerTest method serializeTooltipOfTreeMapNode_resultJsonHasTooltip.
@Test
public void serializeTooltipOfTreeMapNode_resultJsonHasTooltip() throws IOException {
// when
TreeMapNode treeMapNode = new TreeMapNode("010", 1, new DefaultValue(1.5));
treeMapNode.setUserObject(values);
treeMapNodeSerializer.serialize(treeMapNode, jgen, new DefaultSerializerProvider.Impl());
jgen.flush();
// then
JsonNode actualObj = mapper.readTree(sw.toString());
Assertions.assertThat(actualObj.has("tooltip")).isTrue();
Assertions.assertThat(actualObj.get("tooltip").asText()).isEqualTo("some tooltip");
}
use of net.sf.jtreemap.swing.TreeMapNode in project beakerx by twosigma.
the class TreeMapNodeSerializerTest method serializeWeightOfTreeMapNode_resultJsonHasWeight.
@Test
public void serializeWeightOfTreeMapNode_resultJsonHasWeight() throws IOException {
// when
TreeMapNode treeMapNode = new TreeMapNode("label");
treeMapNode.setWeight(0.5);
treeMapNodeSerializer.serialize(treeMapNode, jgen, new DefaultSerializerProvider.Impl());
jgen.flush();
// then
JsonNode actualObj = mapper.readTree(sw.toString());
Assertions.assertThat(actualObj.has("weight")).isTrue();
Assertions.assertThat(actualObj.get("weight").asDouble()).isEqualTo(0.5);
}
use of net.sf.jtreemap.swing.TreeMapNode in project beakerx by twosigma.
the class TreeMapNodeSerializerTest method serializeColorOfTreeMapNode_resultJsonHasColor.
@Test
public void serializeColorOfTreeMapNode_resultJsonHasColor() throws IOException {
// when
TreeMapNode treeMapNode = new TreeMapNode("010", 1, new DefaultValue(1.5));
treeMapNode.setUserObject(values);
treeMapNodeSerializer.serialize(treeMapNode, jgen, new DefaultSerializerProvider.Impl());
jgen.flush();
// then
JsonNode actualObj = mapper.readTree(sw.toString());
Assertions.assertThat(actualObj.has("color")).isTrue();
}
Aggregations