ResAllocsUtil { public static ResAllocs add(ResAllocs first, ResAllocs second) { return new ResAllocsBuilder(first.getTaskGroupName()) .withCores(first.getCores() + second.getCores()) .withMemory(first.getMemory() + second.getMemory()) .withNetworkMbps(first.getNetworkMbps() + second.getNetworkMbps()) .withDisk(first.getDisk() + second.getDisk()) .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 testAdd() throws Exception { ResAllocs result = ResAllocsUtil.add(generator.createResAllocs(1), generator.createResAllocs(1)); assertThat(hasEqualResources(result, generator.createResAllocs(2)), is(true)); }