@Test
public void instanceGroupSystemNoPlacement() {

    AgentInstance instance = createAgentInstance(INSTANCE_GROUP_ID);
    when(agentManagementService.findAgentInstance(INSTANCE_ID)).thenReturn(Optional.of(instance));
    AgentInstanceGroup agentInstanceGroup = createAgentInstanceGroup(InstanceGroupLifecycleState.Active, Tier.Flex, Collections.singletonMap(SchedulerAttributes.SYSTEM_NO_PLACEMENT, "true"));
    when(agentManagementService.findInstanceGroup(INSTANCE_GROUP_ID)).thenReturn(Optional.of(agentInstanceGroup));
    Result result = agentManagementConstraint.evaluate(createTaskRequest(),
            createVirtualMachineCurrentStateMock(INSTANCE_ID), mock(TaskTrackerState.class));
    assertThat(result.isSuccessful()).isFalse();
    assertThat(result.getFailureReason()).isEqualToIgnoringCase("Cannot place on instance group or agent instance due to systemNoPlacement attribute");
}