public static Capacity from(ClusterResources resources) {
        return from(resources, resources);
    }
@Test
    void testCapacityValidation() {
        // Equal min and max is allowed
        Capacity.from(new ClusterResources(4, 2, new NodeResources(1, 2, 3, 4)),
                      new ClusterResources(4, 2, new NodeResources(1, 2, 3, 4)),
                      IntRange.empty(),
                      false,
                      true,
                      Optional.empty(),
                      ClusterInfo.empty());
        assertValidationFailure(new ClusterResources(4, 2, new NodeResources(1, 2, 3, 4)),
                               new ClusterResources(2, 2, new NodeResources(1, 2, 3, 4)));
        assertValidationFailure(new ClusterResources(4, 4, new NodeResources(1, 2, 3, 4)),
                               new ClusterResources(4, 2, new NodeResources(1, 2, 3, 4)));
        assertValidationFailure(new ClusterResources(4, 2, new NodeResources(2, 2, 3, 4)),
                               new ClusterResources(4, 2, new NodeResources(1, 2, 3, 4)));
        assertValidationFailure(new ClusterResources(4, 2, new NodeResources(1, 3, 3, 4)),
                               new ClusterResources(4, 2, new NodeResources(1, 2, 3, 4)));
        assertValidationFailure(new ClusterResources(4, 2, new NodeResources(1, 2, 4, 4)),
                               new ClusterResources(4, 2, new NodeResources(1, 2, 3, 4)));
        assertValidationFailure(new ClusterResources(4, 2, new NodeResources(1, 2, 3, 5)),
                               new ClusterResources(4, 2, new NodeResources(1, 2, 3, 4)));
        // It's enough that one dimension is smaller also when the others are larger
        assertValidationFailure(new ClusterResources(4, 2, new NodeResources(1, 2, 3, 4)),
                               new ClusterResources(8, 4, new NodeResources(2, 1, 6, 8)));

        assertEquals("Cannot set hostTTL without a custom cloud account",
                     assertThrows(IllegalArgumentException.class,
                                  () -> Capacity.from(new ClusterResources(4, 2, new NodeResources(1, 2, 3, 4)),
                                                      new ClusterResources(4, 2, new NodeResources(1, 2, 3, 4)),
                                                      IntRange.empty(), false, true, Optional.empty(), new ClusterInfo.Builder().hostTTL(Duration.ofSeconds(1)).build()))
                             .getMessage());
    }