package com.github.pedrovgs.problem74;

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

import static org.junit.Assert.assertArrayEquals;

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

  private BubbleSort bubbleSort;

  @Before public void setUp() {
    bubbleSort = new BubbleSort();
  }

  @Test(expected = IllegalArgumentException.class) public void shouldNotAcceptNullArrays() {
    bubbleSort.sort(null);
  }

  @Test public void shouldNotModifyArrayIfIsAlreadySorted() {
    int[] input = { 1, 2, 3, 4 };

    bubbleSort.sort(input);

    int[] expectedArray = { 1, 2, 3, 4 };
    assertArrayEquals(expectedArray, input);
  }

  @Test public void shouldSortArrayWhenTheInputDataIsInDescendingOrder() {
    int[] input = { 4, 3, 2, 1 };

    bubbleSort.sort(input);

    int[] expectedArray = { 1, 2, 3, 4 };
    assertArrayEquals(expectedArray, input);
  }

  @Test public void shouldSortArrayPartiallySorted() {
    int[] input = { 1, 2, 4, 3 };

    bubbleSort.sort(input);

    int[] expectedArray = { 1, 2, 3, 4 };
    assertArrayEquals(expectedArray, input);
  }

  @Test public void shouldSortArray() {
    int[] input = { 3, 4, 1, 2 };

    bubbleSort.sort(input);

    int[] expectedArray = { 1, 2, 3, 4 };
    assertArrayEquals(expectedArray, input);
  }
}

@@ -1,1302 +1,980 @@
-package com.github.pedrovgs.problem74;%0A%0Aimport org.junit.Before;%0Aimport org.junit.Test;%0A%0Aimport static org.junit.Assert.assertArrayEquals;%0A%0A/**%0A * @author Pedro Vicente G%C3%B3mez S%C3%A1nchez.%0A */%0Apublic class BubbleSortTest %7B%0A%0A  private BubbleSort bubbleSort;%0A%0A  @Before public void setUp() %7B%0A    bubbleSort = new BubbleSort();%0A  %7D%0A%0A  @Test(expected = IllegalArgumentException.class) public void shouldNotAcceptNullArrays() %7B%0A    bubbleSort.sort(null);%0A  %7D%0A%0A  @Test public void shouldNotModifyArrayIfIsAlreadySorted() %7B%0A    int%5B%5D input = %7B 1, 2, 3, 4 %7D;%0A%0A    bubbleSort.sort(input);%0A%0A    int%5B%5D expectedArray = %7B 1, 2, 3, 4 %7D;%0A    assertArrayEquals(expectedArray, input);%0A  %7D%0A%0A  @Test public void shouldSortArrayWhenTheInputDataIsInDescendingOrder() %7B%0A    int%5B%5D input = %7B 4, 3, 2, 1 %7D;%0A%0A    bubbleSort.sort(input);%0A%0A    int%5B%5D expectedArray = %7B 1, 2, 3, 4 %7D;%0A    assertArrayEquals(expectedArray, input);%0A  %7D%0A%0A  @Test public void shouldSortArrayPartiallySorted() %7B%0A    int%5B%5D input = %7B 1, 2, 4, 3 %7D;%0A%0A    bubbleSort.s
+/*%0A * Copyright (C) 2014 Pedro Vicente G%C3%B3mez S%C3%A1nchez.%0A *%0A * Licensed under the Apache License, Version 2.0 (the %22License%22);%0A * you may not use this file except in compliance with the License.%0A * You may obtain a copy of the License at%0A *%0A * http://www.apache.org/licenses/LICENSE-2.0%0A *%0A * Unless required by applicable law or agreed to in writing, software%0A * distributed under the License is distributed on an %22AS IS%22 BASIS,%0A * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.%0A * See the License for the specific language governing permissions and%0A * limitations under the License.%0A */%0Apackage com.github.pedrovgs.problem74;%0A%0Aimport com.github.pedrovgs.sortingalgorithm.SortingAlgorithm;%0Aimport com.github.pedrovgs.sortingalgorithms.S
 ort
-(
 in
-put);%0A%0A    int%5B%5D expectedArray = %7B 1, 2, 3, 4 %7D;%0A    assertArrayEquals(expectedArray, input);%0A  %7D%0A%0A  @Test public void shouldSortArray() %7B%0A    int%5B%5D input = %7B 3, 4, 1, 2 %7D;%0A%0A    bubbleSort.sort(input);%0A%0A    int%5B%5D expectedArray = %7B 1, 2, 3, 4 %7D;%0A    assertArrayEquals(expectedArray, input
+gAlgorithmTest;%0A%0A/**%0A * @author Pedro Vicente G%C3%B3mez S%C3%A1nchez.%0A */%0Apublic class BubbleSortTest extends SortingAlgorithmTest %7B%0A%0A  @Override public SortingAlgorithm getSortingAlgorithm() %7B%0A    return new BubbleSort(
 );%0A 

Modify BubbleSortTest to extend from SortingAlgorithm test