@Override
    public boolean equals(Object o) {
        if (!(o instanceof Node n)) return false;
        return (type.equals(n.type) && index == n.index);
    }
@Test
    public void testEquals() {
        Node n1 = new Node(NodeType.STORAGE, 6);
        Node n2 = new Node(NodeType.STORAGE, 7);
        Node n3 = new Node(NodeType.DISTRIBUTOR, 6);
        Node n4 = new Node(NodeType.DISTRIBUTOR, 7);
        Node n5 = new Node(NodeType.STORAGE, 6);
        Node n6 = new Node(NodeType.STORAGE, 7);
        Node n7 = new Node(NodeType.DISTRIBUTOR, 6);
        Node n8 = new Node(NodeType.DISTRIBUTOR, 7);

        assertEquals(n1, n5);
        assertEquals(n2, n6);
        assertEquals(n3, n7);
        assertEquals(n4, n8);
        assertEquals(n1, n1);
        assertEquals(n2, n2);
        assertEquals(n3, n3);
        assertEquals(n4, n4);

        assertNotEquals(n1, n2);
        assertNotEquals(n1, n3);
        assertNotEquals(n1, n4);

        assertNotEquals(n2, n1);
        assertNotEquals(n2, n3);
        assertNotEquals(n2, n4);

        assertNotEquals(n3, n1);
        assertNotEquals(n3, n2);
        assertNotEquals(n3, n4);

        assertNotEquals(n4, n1);
        assertNotEquals(n4, n2);
        assertNotEquals(n4, n3);

        assertNotEquals("class not instance of Node", n1);
    }