use of com.vaadin.flow.server.communication.rpc.AttachTemplateChildRpcHandler in project flow by vaadin.
the class AttachTemplateChildRpcHandlerTest method assertHandleNode.
private void assertHandleNode(int assignedId, JsonValue id) {
AttachTemplateChildRpcHandler handler = new AttachTemplateChildRpcHandler();
int requestedId = 1;
JsonObject object = Json.createObject();
object.put(JsonConstants.RPC_ATTACH_REQUESTED_ID, requestedId);
object.put(JsonConstants.RPC_ATTACH_ASSIGNED_ID, assignedId);
object.put(JsonConstants.RPC_ATTACH_ID, id);
StateNode node = Mockito.mock(StateNode.class);
StateNode parentNode = Mockito.mock(StateNode.class);
StateTree tree = Mockito.mock(StateTree.class);
Mockito.when(node.getOwner()).thenReturn(tree);
Mockito.when(node.getParent()).thenReturn(parentNode);
Mockito.when(tree.getNodeById(requestedId)).thenReturn(node);
ElementData data = new ElementData(node);
data.setTag("foo");
Mockito.when(node.getFeature(ElementData.class)).thenReturn(data);
Mockito.when(parentNode.getId()).thenReturn(3);
handler.handleNode(node, object);
}
Aggregations