package com.fishercoder;

import com.fishercoder.solutions._215;
import org.junit.BeforeClass;
import org.junit.Test;

import static org.junit.Assert.assertEquals;

/**
 * Created by fishercoder on 5/9/17.
 */
public class _215Test {
    private static _215.Solution2 solution2;
    private static int k;
    private static int[] nums;
    private static int actual;
    private static int expected;

    @BeforeClass
    public static void setup() {
        solution2 = new _215.Solution2();
    }

    @Test
    public void test1() {
        k = 2;
        nums = new int[]{3, 2, 1, 5, 6, 4};
        actual = solution2.findKthLargest(nums, k);
        expected = 5;
        assertEquals(expected, actual);
    }
}

package com.fishercoder;

import com.fishercoder.solutions._215;
import org.junit.BeforeClass;
import org.junit.Test;

import static org.junit.Assert.assertEquals;

public class _215Test {
    private static _215.Solution1 solution1;
    private static _215.Solution2 solution2;
    private static _215.Solution3 solution3;
    private static int k;
    private static int[] nums;
    private static int expected;

    @BeforeClass
    public static void setup() {
        solution1 = new _215.Solution1();
        solution2 = new _215.Solution2();
        solution3 = new _215.Solution3();
    }

    @Test
    public void test1() {
        k = 2;
        nums = new int[]{3, 2, 1, 5, 6, 4};
        expected = 5;
        assertEquals(expected, solution1.findKthLargest(nums, k));
        assertEquals(expected, solution2.findKthLargest(nums, k));
        assertEquals(expected, solution3.findKthLargest(nums, k));
    }

    @Test
    public void test2() {
        k = 1;
        nums = new int[]{1};
        expected = 1;
        assertEquals(expected, solution1.findKthLargest(nums, k));
        assertEquals(expected, solution2.findKthLargest(nums, k));
        assertEquals(expected, solution3.findKthLargest(nums, k));
    }

    @Test
    public void test3() {
        k = 2;
        nums = new int[]{2, 1};
        expected = 1;
        assertEquals(expected, solution1.findKthLargest(nums, k));
        assertEquals(expected, solution2.findKthLargest(nums, k));
        assertEquals(expected, solution3.findKthLargest(nums, k));
    }
}

add tests for 215