예제 #1
0
  @Test
  public void test() {

    Assignment6 obj = new Assignment6();
    int c[] = new int[10];
    int[] output = obj.join(new int[] {1, 2, 4, 7, 8}, 5, new int[] {3, 5, 6, 9, 10}, 5, c);
    assertArrayEquals(new int[] {1, 2, 3, 4, 5, 6, 7, 8, 9, 10}, output);
  }
 /**
  * JUnit test cases using a method which takes two arrays as input and return true or false for
  * asserting.
  */
 @Test
 public void test1() {
   int array1[] = {1, 3, 4, 7, 9};
   int array2[] = {2, 7, 9};
   int array3[] = new int[array1.length + array2.length];
   array3 = Assignment6.join(array1, array1.length, array2, array2.length, array3);
   int array4[] = {1, 2, 3, 4, 7, 7, 9, 9}; // expected array
   assertArrayEquals("True", array4, array3);
 }