use of net.sf.jtreemap.swing.DefaultValue in project beakerx by twosigma.
the class TreeMapNodeSerializerTest method serializeDoubleValueOfTreeMapNode_resultJsonHasDoubleValue.
@Test
public void serializeDoubleValueOfTreeMapNode_resultJsonHasDoubleValue() 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("doubleValue")).isTrue();
Assertions.assertThat(actualObj.get("doubleValue").asDouble()).isEqualTo(1.5);
}
use of net.sf.jtreemap.swing.DefaultValue in project beakerx by twosigma.
the class RandomColorProviderTest method initStubData.
@Before
public void initStubData() {
node01 = new TreeMapNode("010", 1, new DefaultValue(1));
node02 = new TreeMapNode("021");
node02.setWeight(2.0);
node02.setValue(new DefaultValue(2));
}
use of net.sf.jtreemap.swing.DefaultValue in project beakerx by twosigma.
the class TreeMapNodeSerializerTest method serializeLabelValueOfTreeMapNode_resultJsonHasLabelValue.
@Test
public void serializeLabelValueOfTreeMapNode_resultJsonHasLabelValue() 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("labelValue")).isTrue();
Assertions.assertThat(actualObj.get("labelValue").asText()).isEqualTo("1.5");
}
use of net.sf.jtreemap.swing.DefaultValue 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.DefaultValue 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");
}
Aggregations