import java.util.LinkedList;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.junit.runners.Parameterized;
import static org.junit.Assert.*;

@RunWith(Parameterized.class)
public class FibTest {

  @Parameterized.Parameters
  public static LinkedList<Object[]> getTestCases() {
    LinkedList<Object[]> cases = new LinkedList<Object[]>();
    cases.add(new Object[] {0, 0});
    cases.add(new Object[] {1, 1});
    cases.add(new Object[] {2, 1});
    cases.add(new Object[] {3, 2});
    cases.add(new Object[] {4, 3});
    return cases;
  }

  private int input, expected;
  
  public FibTest( int i, int e ) {
    input = i;
    expected = e;
  }

  public String toString() {  
    // something to identify this test case
    return "fib(" + input + ")";
  }

  @Test 
  public void tryFib() {
    try {
      assertEquals( expected, fib(input) );
    }
    catch( Throwable th ) {
      // here's the trick: catch and re-throw
      throw new Error(this + ": " + th.getMessage(), th);
    }
  }

  private int fib( int i ) {
    return 0;  // place-holder implementation
  }
}
