public static ResourceCounter withResource(ResourceProfile resourceProfile, int count) {
        Preconditions.checkArgument(count >= 0);
        return count == 0
                ? empty()
                : new ResourceCounter(Collections.singletonMap(resourceProfile, count));
    }
@Test
    public void testWithResourceRejectsNegativeCount() {
        assertThatThrownBy(() -> ResourceCounter.withResource(ResourceProfile.UNKNOWN, -1))
                .isInstanceOf(IllegalArgumentException.class);
    }