Package kalashnikov.dmitry

Source Code of kalashnikov.dmitry.MergeTaskTest

package kalashnikov.dmitry;

import kalashnikov.dmitry.lab3.MergeTask;
import org.junit.Assert;
import org.junit.Test;

/**
* Created by Tronok on 29.04.14.
*/
public class MergeTaskTest {
    @Test
    public void testNormalMerge() throws Exception {
        int[] first = new int[]{1, 5, 20, 40};
        int[] second = new int[]{0, 9, 20};
        MergeTask mt = new MergeTask(first, second);
        Assert.assertArrayEquals(new int[]{0, 1, 5, 9, 20, 20, 40}, mt.call());
    }

    @Test(expected = NullPointerException.class)
    public void testMergeWithNull() {
        int[] second = new int[]{0, 9, 20};
        MergeTask mt = new MergeTask(null, second);
    }

    @Test
    public void testMergeWithEmpty() throws Exception {
        int[] first = new int[]{};
        int[] second = new int[]{0, 9, 20};
        MergeTask mt = new MergeTask(first, second);
        Assert.assertArrayEquals(new int[]{0, 9, 20}, mt.call());
        mt = new MergeTask(second, first);
        Assert.assertArrayEquals(new int[]{0, 9, 20}, mt.call());
    }
}
TOP

Related Classes of kalashnikov.dmitry.MergeTaskTest

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.