@Test
public void testBuffer() {

    List<AgentInstanceGroup> instanceGroups = singletonList(
            getInstanceGroup(Tier.Critical, M4_XLARGE_ID, 0, 2)
    );
    when(agentManagementService.getInstanceGroups()).thenReturn(instanceGroups);
    ApplicationSLA smallSLA = ApplicationSlaSample.CriticalSmall.builder().withInstanceCount(4).build(); // 4 CPUs
    CapacityRequirements requirements = new CapacityRequirements(singletonMap(Tier.Critical, singletonList(smallSLA)));
    // Our SLA allocation requires 1 instance, but buffer goes over it, so we require 2
    CapacityAllocations allocations = strategy.compute(requirements);
    allocations.getInstanceGroups().forEach(instanceGroup -> {
        assertThat(instanceGroup.getTier()).isEqualTo(Tier.Critical);
    });
    AgentInstanceGroup r48xlInstanceGroup = findInstanceGroupByInstanceType(allocations.getInstanceGroups(), M4_XLARGE_ID);
    assertThat(allocations.getExpectedMinSize(r48xlInstanceGroup)).isEqualTo(2);
}