@Test
  public void testShifts() {
    Slice sl;
    sl = new Slice().setLength(12);
    sl.setStop(2);
    assertEquals(2, sl.getNumSteps());
    assertFalse(sl.setPosition(5));
    assertEquals(5, (int) sl.getStart());
    assertEquals(7, (int) sl.getStop());

    sl.setStart(5);
    assertEquals(5, (int) sl.getStart());

    assertTrue(sl.setPosition(11));
  }
  @Test
  public void testSetter() {
    Slice sl;

    sl = new Slice().setLength(12);
    sl.setStart(1);
    assertEquals(1, (int) sl.getStart());
    sl.setStop(10);
    assertEquals(10, (int) sl.getStop());
    sl.setStep(2);
    assertEquals(2, sl.getStep());
    sl.setLength(11);
    assertEquals(11, sl.getLength());

    sl = new Slice().setLength(12);
    sl.setStart(3);
    sl.setStop(10);
    try {
      sl.setLength(9);
      fail("No exception thrown");
    } catch (IllegalArgumentException iae) {
      // passed
    } catch (Exception e) {
      fail("Wrong exception type passed, this should give an IllegalArgumentException");
    }

    try {
      sl.setStart(11);
      fail("No exception thrown");
    } catch (IllegalArgumentException iae) {
      // passed
    } catch (Exception e) {
      fail("Wrong exception type passed, this should give an IllegalArgumentException");
    }

    sl = new Slice().setLength(12);
    sl.setStart(3);
    sl.setStop(10);
    try {
      sl.setLength(9);
      fail("No exception thrown");
    } catch (IllegalArgumentException iae) {
      // passed
    } catch (Exception e) {
      fail("Wrong exception type passed, this should give an IllegalArgumentException");
    }

    try {
      sl.setStart(11);
      fail("No exception thrown");
    } catch (IllegalArgumentException iae) {
      // passed
    } catch (Exception e) {
      fail("Wrong exception type passed, this should give an IllegalArgumentException");
    }
    try {
      sl.setStop(0);
      fail("No exception thrown");
    } catch (IllegalArgumentException iae) {
      // passed
    } catch (Exception e) {
      fail("Wrong exception type passed, this should give an IllegalArgumentException");
    }

    sl = new Slice().setLength(12);
    sl.setStep(-2);
    sl.setStart(10);
    sl.setStop(3);
    try {
      sl.setLength(9);
      fail("No exception thrown");
    } catch (IllegalArgumentException iae) {
      // passed
    } catch (Exception e) {
      fail("Wrong exception type passed, this should give an IllegalArgumentException");
    }

    try {
      sl.setStart(2);
      fail("No exception thrown");
    } catch (IllegalArgumentException iae) {
      // passed
    } catch (Exception e) {
      fail("Wrong exception type passed, this should give an IllegalArgumentException");
    }
    try {
      sl.setStop(10);
      fail("No exception thrown");
    } catch (IllegalArgumentException iae) {
      // passed
    } catch (Exception e) {
      fail("Wrong exception type passed, this should give an IllegalArgumentException");
    }

    try {
      sl.setStep(0);
      fail("No exception thrown");
    } catch (IllegalArgumentException iae) {
      // passed
    } catch (Exception e) {
      fail("Wrong exception type passed, this should give an IllegalArgumentException");
    }

    sl = new Slice(10).setLength(12);
    assertEquals(null, sl.getStart());
    assertEquals(10, (int) sl.getStop());
    assertEquals(1, sl.getStep());
    assertEquals(12, sl.getLength());
  }