public void testPreview() throws Exception {

    List amendments = flCheck.preview();
    assertEquals(2, amendments.size());

    verifyMocks();
  }
  public void testValidateCorrect() throws Exception {

    // This should correct the problem
    List amendments = flCheck.correct();
    assertEquals(2, amendments.size());
    verifyMocks();

    noProblems();
  }
  private void noProblems() throws Exception {
    resetMocks();
    ctrlFieldManager.expectAndReturn(mockFieldManager.isOrderableField("customfield_1"), true);

    replayMocks();

    List amendments = flCheck.preview();
    assertEquals(0, amendments.size());

    verifyMocks();
  }
  protected void setUp() throws Exception {
    super.setUp();
    CoreTransactionUtil.setUseTransactions(false);
    setUpMocks();

    ctrlFieldManager.expectAndReturn(mockFieldManager.isOrderableField("customfield_1"), true);
    ctrlFieldManager.expectAndReturn(mockFieldManager.isOrderableField("customfield_2"), false);
    ctrlFieldManager.expectAndReturn(mockFieldManager.isOrderableField("customfield_3"), false);

    replayMocks();

    UtilsForTests.getTestEntity(
        "FieldLayoutItem", EasyMap.build("id", new Long(1001), "fieldidentifier", "customfield_1"));
    UtilsForTests.getTestEntity(
        "FieldLayoutItem", EasyMap.build("id", new Long(1002), "fieldidentifier", "customfield_2"));
    UtilsForTests.getTestEntity(
        "FieldLayoutItem", EasyMap.build("id", new Long(1003), "fieldidentifier", "customfield_3"));

    flCheck = new FieldLayoutCheck(ofBizDelegator, 1);
    flCheck.setFieldManager(mockFieldManager);
  }