/*
 * Copyright (C) 2014 Pedro Vicente Gómez Sánchez.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package com.github.pedrovgs.app.problem7;

import org.junit.Before;
import org.junit.Test;

import static org.junit.Assert.assertEquals;

/**
 * @author Pedro Vicente Gómez Sánchez.
 */
public class FibonacciNumbersTest {

  private FibonacciNumbers fibonacciNumbers;

  @Before public void setUp() {
    fibonacciNumbers = new FibonacciNumbers();
  }

  @Test(expected = IllegalArgumentException.class)
  public void shouldNotAcceptNegativeValuesRecursive() {
    fibonacciNumbers.getRecursive(-1);
  }

  @Test public void fourthNumberInFibonacciSequenceIsThreeRecursive() {
    assertEquals(5, fibonacciNumbers.getRecursive(4));
  }

  @Test public void eleventhNumberInFibonacciSequenceIsRecursive() {
    assertEquals(144, fibonacciNumbers.getRecursive(11));
  }

  @Test(expected = IllegalArgumentException.class)
  public void shouldNotAcceptNegativeValuesIterative() {
    fibonacciNumbers.getRecursive(-1);
  }

  @Test public void fourthNumberInFibonacciSequenceIsThreeIterative() {
    assertEquals(5, fibonacciNumbers.getRecursive(4));
  }

  @Test public void eleventhNumberInFibonacciSequenceIsIterative() {
    assertEquals(144, fibonacciNumbers.getRecursive(11));
  }

  @Test(expected = IllegalArgumentException.class)
  public void shouldNotAcceptNegativeValuesIterativeWithCatching() {
    fibonacciNumbers.getRecursiveWithCatching(-1);
  }

  @Test public void fourthNumberInFibonacciSequenceIsThreeIterativeWithCatching() {
    assertEquals(5, fibonacciNumbers.getRecursiveWithCatching(4));
  }

  @Test public void eleventhNumberInFibonacciSequenceIsIterativeWithCatching() {
    assertEquals(144, fibonacciNumbers.getRecursiveWithCatching(11));
  }
}

@@ -1102,32 +1102,163 @@
 rsive(-1);%0A  %7D%0A%0A
+  @Test public void firstNumberInFibonacciSequenceIsThreeRecursive() %7B%0A    assertEquals(1, fibonacciNumbers.getRecursive(1));%0A  %7D%0A%0A
   @Test public v
@@ -1633,36 +1633,167 @@
 iNumbers.get
-Recurs
+Iterative(-1);%0A  %7D%0A%0A  @Test public void firstNumberInFibonacciSequenceIsThreeIterative() %7B%0A    assertEquals(1, fibonacciNumbers.getIterat
 ive(
--
 1
+)
 );%0A  %7D%0A%0A  @T
@@ -1892,38 +1892,38 @@
 nacciNumbers.get
-Recurs
+Iterat
 ive(4));%0A  %7D%0A%0A  
@@ -2023,38 +2023,38 @@
 nacciNumbers.get
-Recurs
+Iterat
 ive(11));%0A  %7D%0A%0A 
@@ -2146,22 +2146,22 @@
 veValues
-Iterat
+Recurs
 iveWithC
@@ -2286,22 +2286,22 @@
 eIsThree
-Iterat
+Recurs
 iveWithC
@@ -2439,22 +2439,22 @@
 quenceIs
-Iterat
+Recurs
 iveWithC

Improve coverage for problem 7