コード例 #1
0
 @Test
 public void shiftWithZeroShiftTest() {
   final ArrayList<Shape> source =
       new ArrayList<>(Arrays.asList(new Shape[] {new Circle(), new Triangle(), new Square()}));
   final List<Shape> result = ShiftUtils.shift(source, 0);
   assertEquals(source, result);
 }
コード例 #2
0
 @Test(expected = IllegalArgumentException.class)
 public void shiftWithNullElemTest() {
   final ArrayList<Shape> source =
       new ArrayList<>(
           Arrays.asList(new Shape[] {new Circle(), new Triangle(), null, new Rhomb()}));
   ShiftUtils.shift(source, 3);
 }
コード例 #3
0
 @Test
 public void shiftWithOneElemListTest() {
   final ArrayList<Shape> source = new ArrayList<>(Arrays.asList(new Shape[] {new Circle()}));
   for (int i = 0; i < 10; i++) {
     final List<Shape> result = ShiftUtils.shift(source, i);
     assertEquals(source, result);
   }
 }
コード例 #4
0
 @Test
 public void shiftWithEmptyListTest() {
   final ArrayList<Shape> source = new ArrayList<>();
   for (int i = 0; i < 10; i++) {
     final List<Shape> result = ShiftUtils.shift(source, i);
     assertEquals(source, result);
   }
 }
コード例 #5
0
  @Test
  public void shiftWithShiftOfIntMaxValueTest() {
    final ArrayList<Shape> source =
        new ArrayList<>(
            Arrays.asList(new Shape[] {new Circle(), new Triangle(), new Square(), new Rhomb()}));
    final List<Shape> result = ShiftUtils.shift(source, Integer.MAX_VALUE);

    assertEquals(
        new ArrayList<>(
            Arrays.asList(new Shape[] {new Triangle(), new Square(), new Rhomb(), new Circle()})),
        result);
  }
コード例 #6
0
  @Test
  public void shiftWithShiftMoreThanCollectionSizeTest() {
    final ArrayList<Shape> source =
        new ArrayList<>(
            Arrays.asList(new Shape[] {new Circle(), new Triangle(), new Square(), new Rhomb()}));
    final List<Shape> result = ShiftUtils.shift(source, 25);

    assertEquals(
        new ArrayList<>(
            Arrays.asList(new Shape[] {new Rhomb(), new Circle(), new Triangle(), new Square()})),
        result);
  }
コード例 #7
0
 @Test(expected = IllegalArgumentException.class)
 public void shiftWithNegativeValueAndNullListTest() {
   ShiftUtils.shift(null, -3);
 }
コード例 #8
0
 @Test(expected = IllegalArgumentException.class)
 public void shiftWithNegativeValueTest() {
   final ArrayList<Shape> source =
       new ArrayList<>(Arrays.asList(new Shape[] {new Circle(), new Triangle(), new Square()}));
   ShiftUtils.shift(source, -1);
 }
コード例 #9
0
 @Test(expected = IllegalArgumentException.class)
 public void shiftWithNullListTest() {
   ShiftUtils.shift(null, 4);
 }