@Test(expected = IllegalStateException.class)
  public void loop_checksDisposed() {
    ColorSequence sequence = new ColorSequence(display, rgb1, rgb2);
    sequence.dispose();

    sequence.loop();
  }
  @Test
  public void isDispose_trueAfterDispose() {
    ColorSequence sequence = new ColorSequence(display, rgb1);
    sequence.dispose();

    assertTrue(sequence.isDisposed());
  }
  @Test(expected = IllegalStateException.class)
  public void get_checksDispose() {
    ColorSequence sequence = new ColorSequence(display, rgb1);
    sequence.dispose();

    sequence.get(0);
  }
  @Test
  public void loop_createsStreamWithSingleColor() {
    ColorSequence sequence = new ColorSequence(display, rgb1);

    ColorStream stream = sequence.loop();

    assertEquals(new Color(display, rgb1), stream.next());
  }
  @Test
  public void size() {
    ColorSequence sequence = new ColorSequence(display, rgb1, rgb2, rgb3);

    int size = sequence.size();

    assertEquals(3, size);
  }
  @Test
  public void dispose_disposesColors() {
    ColorSequence sequence = new ColorSequence(display, rgb1);
    Color color = sequence.get(0);

    sequence.dispose();

    assertTrue(color.isDisposed());
  }
  @Test
  public void keepsSafeCopyOfColorsArray() {
    RGB[] colors = {rgb1, rgb2, rgb3};
    ColorSequence sequence = new ColorSequence(display, colors);

    colors[0] = new RGB(47, 47, 47);
    ColorStream stream = sequence.loop();

    assertEquals(new Color(display, rgb1), stream.next());
  }
  @Test
  public void loop_createsLoopingStream() {
    ColorSequence sequence = new ColorSequence(display, rgb1, rgb2);

    ColorStream stream = sequence.loop();

    assertEquals(new Color(display, rgb1), stream.next());
    assertEquals(new Color(display, rgb2), stream.next());
    assertEquals(new Color(display, rgb1), stream.next());
  }
  @Test
  public void loop_createsStreamWithMultipleColors() {
    ColorSequence sequence = new ColorSequence(display, rgb1, rgb2, rgb3);

    ColorStream stream = sequence.loop();

    assertEquals(new Color(display, rgb1), stream.next());
    assertEquals(new Color(display, rgb2), stream.next());
    assertEquals(new Color(display, rgb3), stream.next());
  }
  @Test
  public void isDispose_falseByDefault() {
    ColorSequence sequence = new ColorSequence(display, rgb1);

    assertFalse(sequence.isDisposed());
  }
  @Test(expected = IndexOutOfBoundsException.class)
  public void get_failsWithNegativeIndex() {
    ColorSequence sequence = new ColorSequence(display, rgb1);

    sequence.get(-1);
  }