@VisibleForTesting
    static boolean customWorkerResourcesEquality(WorkerResources first, WorkerResources second) {
        if (first == null) {
            return false;
        }
        if (second == null) {
            return false;
        }
        if (first == second) {
            return true;
        }
        if (first.equals(second)) {
            return true;
        }

        if (first.get_cpu() != second.get_cpu()) {
            return false;
        }
        if (first.get_mem_on_heap() != second.get_mem_on_heap()) {
            return false;
        }
        if (first.get_mem_off_heap() != second.get_mem_off_heap()) {
            return false;
        }
        if (first.get_shared_mem_off_heap() != second.get_shared_mem_off_heap()) {
            return false;
        }
        if (first.get_shared_mem_on_heap() != second.get_shared_mem_on_heap()) {
            return false;
        }
        if (!customResourceMapEquality(first.get_resources(), second.get_resources())) {
            return false;
        }
        if (!customResourceMapEquality(first.get_shared_resources(), second.get_shared_resources())) {
            return false;
        }
        return true;
    }
@Test
    public void testWorkerResourceEquality() {
        WorkerResources resourcesRNull = mkWorkerResources(100.0, 100.0, 100.0, null);
        WorkerResources resourcesREmpty = mkWorkerResources(100.0, 100.0, 100.0, Maps.newHashMap());
        assertTrue(EquivalenceUtils.customWorkerResourcesEquality(resourcesRNull,resourcesREmpty));

        Map<String, Double> resources = new HashMap<>();
        resources.put("network.resource.units", 0.0);
        WorkerResources resourcesRNetwork = mkWorkerResources(100.0, 100.0, 100.0,resources);
        assertTrue(EquivalenceUtils.customWorkerResourcesEquality(resourcesREmpty, resourcesRNetwork));


        Map<String, Double> resourcesNetwork = new HashMap<>();
        resourcesNetwork.put("network.resource.units", 50.0);
        WorkerResources resourcesRNetworkNonZero = mkWorkerResources(100.0, 100.0, 100.0,resourcesNetwork);
        assertFalse(EquivalenceUtils.customWorkerResourcesEquality(resourcesREmpty, resourcesRNetworkNonZero));

        Map<String, Double> resourcesNetworkOne = new HashMap<>();
        resourcesNetworkOne.put("network.resource.units", 50.0);
        WorkerResources resourcesRNetworkOne = mkWorkerResources(100.0, 100.0, 100.0,resourcesNetworkOne);
        assertTrue(EquivalenceUtils.customWorkerResourcesEquality(resourcesRNetworkOne, resourcesRNetworkNonZero));

        Map<String, Double> resourcesNetworkTwo = new HashMap<>();
        resourcesNetworkTwo.put("network.resource.units", 100.0);
        WorkerResources resourcesRNetworkTwo = mkWorkerResources(100.0, 100.0, 100.0,resourcesNetworkTwo);
        assertFalse(EquivalenceUtils.customWorkerResourcesEquality(resourcesRNetworkOne, resourcesRNetworkTwo));

        WorkerResources resourcesCpuNull = mkWorkerResources(null, 100.0,100.0);
        WorkerResources resourcesCPUZero = mkWorkerResources(0.0, 100.0,100.0);
        assertTrue(EquivalenceUtils.customWorkerResourcesEquality(resourcesCpuNull, resourcesCPUZero));

        WorkerResources resourcesOnHeapMemNull = mkWorkerResources(100.0, null,100.0);
        WorkerResources resourcesOnHeapMemZero = mkWorkerResources(100.0, 0.0,100.0);
        assertTrue(EquivalenceUtils.customWorkerResourcesEquality(resourcesOnHeapMemNull, resourcesOnHeapMemZero));

        WorkerResources resourcesOffHeapMemNull = mkWorkerResources(100.0, 100.0,null);
        WorkerResources resourcesOffHeapMemZero = mkWorkerResources(100.0, 100.0,0.0);
        assertTrue(EquivalenceUtils.customWorkerResourcesEquality(resourcesOffHeapMemNull, resourcesOffHeapMemZero));

        assertFalse(EquivalenceUtils.customWorkerResourcesEquality(resourcesOffHeapMemNull, null));
    }