@Test
public void testUpdateAllocations() {

    final AllocationRequests allocationRequest = AllocationRequests.of(
        new AllocationRequest.Deallocate(EXP_1_TREATMENT_2, 10),
        new AllocationRequest.Allocate(EXP_1_TREATMENT_1, 5),
        new AllocationRequest.Reallocate(EXP_1_TREATMENT_3, 15, EXP_1_TREATMENT_1)
    );
    post(ALLOCATIONS_ENDPOINT, EXPERIMENT_BAD)
        .entity(allocationRequest)
        .assertStatus(Status.NOT_FOUND);
    final Map<String, Integer> allocations = ImmutableMap.of(
        EXP_1_TREATMENT_1, 50,
        EXP_1_TREATMENT_2, 25,
        EXP_1_TREATMENT_3, 25
    );
    final Iterable<AllocationDto> currentAllocations = MAPPER.toDto(
        experiment(EXPERIMENT_1).getAllocations(),
        AllocationDto.class
    );
    assertEquals(allocations, countAllocations(currentAllocations));
    post(ALLOCATIONS_ENDPOINT, EXPERIMENT_1)
        .entity(allocationRequest)
        .assertStatus(Status.NO_CONTENT);
    final Map<String, Integer> expectedAllocations = ImmutableMap.of(
        EXP_1_TREATMENT_1, 75,
        EXP_1_TREATMENT_2, 15,
        EXP_1_TREATMENT_3, 10
    );
    final Iterable<AllocationDto> newAllocations = MAPPER.toDto(
        experiment(EXPERIMENT_1).getAllocations(),
        AllocationDto.class
    );
    assertEquals(expectedAllocations, countAllocations(newAllocations));
}