ResourceDimensions { public static ResourceDimension multiply(ResourceDimension base, double multiplier) { return ResourceDimension.newBuilder() .withCpus(base.getCpu() * multiplier) .withMemoryMB((long) Math.ceil(base.getMemoryMB() * multiplier)) .withDiskMB((long) Math.ceil(base.getDiskMB() * multiplier)) .withNetworkMbs((long) Math.ceil(base.getNetworkMbs() * multiplier)) .withGpu((long) Math.ceil(base.getGpu() * multiplier)) .withOpportunisticCpus((long) Math.ceil(base.getOpportunisticCpu() * multiplier)) .build(); }  static ResourceDimension add(ResourceDimension... parts); static ResourceDimension add(Collection<ResourceDimension> parts); static ResourceDimension subtractPositive(ResourceDimension left, ResourceDimension right); static ResourceDimension multiply(ResourceDimension base, double multiplier); static Pair<Long, ResourceDimension> divide(ResourceDimension left, ResourceDimension right); static long divideAndRoundUp(ResourceDimension left, ResourceDimension right); static ResourceDimension alignUp(ResourceDimension source, ResourceDimension reference); static boolean isBigger(ResourceDimension dimension, ResourceDimension subDimension); static StringBuilder format(ResourceDimension input, StringBuilder output); static String format(ResourceDimension input); static ResourceDimension fromServerInfo(ServerInfo serverInfo); static ResourceDimension fromAwsInstanceType(AwsInstanceType instanceType); static ResAllocs toResAllocs(String name, ResourceDimension resourceDimension); static ResourceDimension fromResAllocs(ResAllocs resAllocs);  }
@Test public void testResourceDimensionMultiplication() throws Exception { ResourceDimension small = ResourceDimensionSample.SmallWithGpuAndOpportunistic.build(); ResourceDimension expected = ResourceDimensionSample.SmallWithGpuAndOpportunisticX2.build(); assertThat(ResourceDimensions.multiply(small, 2)).isEqualTo(expected); }