package com.topone.saa.test;
import org.junit.After; import org.junit.AfterClass; import org.junit.Assert; import org.junit.Assume; import org.junit.Before; import org.junit.BeforeClass; import org.junit.Ignore; import org.junit.Test;
import java.sql.SQLException; import static java.lang.Math.*;
import com.topone.saa.Sorting;
public class SortingTest { private Sorting sort = new Sorting(); @BeforeClass public static void testBeforeClass(){ } @Before public void testBefore(){ System.out.println("@Before....."); Assume.assumeNotNull(PI); } @After public void tsetAfter(){ } @AfterClass public static void testAfterClass(){ } @Ignore @Test public void testSorting(){ int[] arr = {333,231,3,53,23}; sort.bubbleSorting(arr); sort.selectSorting(arr); sort.insertSorting(arr); sort.main(null); Assert.assertArrayEquals(new int[]{3,23,53,231,333}, arr); } @Test(timeout=500) public void testSortingForNeagtive(){ int[] arr = {-23,-1,-55,-232,-12}; sort.selectSorting(arr); sort.insertSorting(arr); sort.bubbleSorting(arr); //sort.main(null); Assert.assertArrayEquals(new int[]{-232,-55,-23,-12,-1}, arr); } } |