use of org.opennms.features.vaadin.nodemaps.internal.gwt.client.NodeMapState in project opennms by OpenNMS.
the class NodeMapComponentTest method testShowNodes.
@Test
public void testShowNodes() {
final NodeMapState state = new NodeMapState();
final NodeMapComponent component = new NodeMapComponent() {
private static final long serialVersionUID = 1L;
public NodeMapState getState() {
return state;
}
};
final Map<Integer, MapNode> entries = new HashMap<>();
component.showNodes(entries);
assertEquals(0, state.nodes.size());
entries.put(1, createMapNode(1, "Foo", 3f, 4f));
component.showNodes(entries);
assertEquals(1, state.nodes.size());
assertEquals("Foo", state.nodes.get(0).getNodeLabel());
assertEquals(3d, state.nodes.get(0).getLongitude(), 0.1d);
assertEquals(4d, state.nodes.get(0).getLatitude(), 0.1d);
entries.put(1, createMapNode(1, "Bar", 6f, 8f));
component.showNodes(entries);
assertEquals(1, state.nodes.size());
assertEquals("Bar", state.nodes.get(0).getNodeLabel());
assertEquals(6d, state.nodes.get(0).getLongitude(), 0.1d);
assertEquals(8d, state.nodes.get(0).getLatitude(), 0.1d);
entries.remove(1);
component.showNodes(entries);
assertEquals(0, state.nodes.size());
}
Aggregations