ResAllocsUtil { public static ResAllocs toResAllocs(String name, Map<VMResource, Double> resourceMap) { return new ResAllocsBuilder(name) .withCores(resourceMap.getOrDefault(VMResource.CPU, 0.0)) .withMemory(resourceMap.getOrDefault(VMResource.Memory, 0.0)) .withNetworkMbps(resourceMap.getOrDefault(VMResource.Network, 0.0)) .withDisk(resourceMap.getOrDefault(VMResource.Disk, 0.0)) .build(); }  static ResAllocs add(ResAllocs first, ResAllocs second); static ResAllocs add(ResAllocs first, QueuableTask second); static ResAllocs subtract(ResAllocs first, ResAllocs second); static ResAllocs ceilingOf(ResAllocs first, ResAllocs second); static boolean isBounded(QueuableTask first, ResAllocs second); static boolean isBounded(ResAllocs first, QueuableTask second); static boolean isBounded(ResAllocs first, ResAllocs second); static boolean hasEqualResources(ResAllocs first, ResAllocs second); static ResAllocs empty(); static ResAllocs emptyOf(String name); static ResAllocs rename(String newName, ResAllocs allocs); static ResAllocs toResAllocs(String name, Map<VMResource, Double> resourceMap);  }
@Test public void testToResAllocs() throws Exception { Map<VMResource, Double> resourceMap = new HashMap<>(); assertThat(hasEqualResources(ResAllocsUtil.toResAllocs("my", resourceMap), ResAllocsUtil.empty()), is(true)); }