@Test public void downWhenAlreadyBottom() { final FieldConstraint[] fieldConstraints = new FieldConstraint[2]; fieldConstraints[0] = mock(FieldConstraint.class); final FieldConstraint bottom = mock(FieldConstraint.class); fieldConstraints[1] = bottom; FieldConstraintArrayUtil.moveDown(1, fieldConstraints); assertEquals(bottom, fieldConstraints[1]); }
public static void moveDown(int index, FieldConstraint[] fieldConstraints) { if (index < (fieldConstraints.length - 1)) { final FieldConstraint first = fieldConstraints[index]; final FieldConstraint second = fieldConstraints[index + 1]; if (blockSwap(first, second)) { return; } fieldConstraints[index] = second; fieldConstraints[index + 1] = first; } }
FieldConstraintArrayUtil { public static void moveDown(int index, FieldConstraint[] fieldConstraints) { if (index < (fieldConstraints.length - 1)) { final FieldConstraint first = fieldConstraints[index]; final FieldConstraint second = fieldConstraints[index + 1]; if (blockSwap(first, second)) { return; } fieldConstraints[index] = second; fieldConstraints[index + 1] = first; } } }
FieldConstraintArrayUtil { public static void moveDown(int index, FieldConstraint[] fieldConstraints) { if (index < (fieldConstraints.length - 1)) { final FieldConstraint first = fieldConstraints[index]; final FieldConstraint second = fieldConstraints[index + 1]; if (blockSwap(first, second)) { return; } fieldConstraints[index] = second; fieldConstraints[index + 1] = first; } } private  FieldConstraintArrayUtil(); }
FieldConstraintArrayUtil { public static void moveDown(int index, FieldConstraint[] fieldConstraints) { if (index < (fieldConstraints.length - 1)) { final FieldConstraint first = fieldConstraints[index]; final FieldConstraint second = fieldConstraints[index + 1]; if (blockSwap(first, second)) { return; } fieldConstraints[index] = second; fieldConstraints[index + 1] = first; } } private  FieldConstraintArrayUtil(); static void moveDown(int index, FieldConstraint[] fieldConstraints); static void moveUp(int index, FieldConstraint[] fieldConstraints); }
FieldConstraintArrayUtil { public static void moveDown(int index, FieldConstraint[] fieldConstraints) { if (index < (fieldConstraints.length - 1)) { final FieldConstraint first = fieldConstraints[index]; final FieldConstraint second = fieldConstraints[index + 1]; if (blockSwap(first, second)) { return; } fieldConstraints[index] = second; fieldConstraints[index + 1] = first; } } private  FieldConstraintArrayUtil(); static void moveDown(int index, FieldConstraint[] fieldConstraints); static void moveUp(int index, FieldConstraint[] fieldConstraints);  }