|
@@ -623,4 +623,49 @@ public class ArrazTest {
|
623
|
623
|
Assert.assertEquals(expectedSmallest, actualSmallest);
|
624
|
624
|
Assert.assertEquals(expected2ndSmallest, actual2ndSmallest);
|
625
|
625
|
}
|
|
626
|
+
|
|
627
|
+ @Test
|
|
628
|
+ public void test1makeMeACopyPlease() {
|
|
629
|
+ //GIVEN
|
|
630
|
+ int[] arr = {1, 2, 3, 4, 5};
|
|
631
|
+ //WHEN
|
|
632
|
+ int[] actual = arraz.makeMeACopyPlease(arr);
|
|
633
|
+
|
|
634
|
+ //THEN
|
|
635
|
+ Assert.assertEquals(arr[0], actual[4]);
|
|
636
|
+ }
|
|
637
|
+
|
|
638
|
+ @Test
|
|
639
|
+ public void test2makeMeACopyPlease() {
|
|
640
|
+ //GIVEN
|
|
641
|
+ int[] arr = {4, 6, 2, 8};
|
|
642
|
+ //WHEN
|
|
643
|
+ int[] actual = arraz.makeMeACopyPlease(arr);
|
|
644
|
+
|
|
645
|
+ //THEN
|
|
646
|
+ Assert.assertEquals(arr[1], actual[2]);
|
|
647
|
+ }
|
|
648
|
+
|
|
649
|
+ @Test
|
|
650
|
+ public void test1removeLastItemAndCopy() {
|
|
651
|
+ //GIVEN
|
|
652
|
+ int[] arr = {1, 2, 3, 4, 5};
|
|
653
|
+ //WHEN
|
|
654
|
+ int[] retArr = arraz.removeLastItemAndCopy(arr);
|
|
655
|
+ int expected = 4;
|
|
656
|
+ int actual = retArr.length;
|
|
657
|
+ //THEN
|
|
658
|
+ Assert.assertEquals(expected, actual);
|
|
659
|
+ }
|
|
660
|
+
|
|
661
|
+ @Test
|
|
662
|
+ public void test2removeLastItemAndCopy() {
|
|
663
|
+ //GIVEN
|
|
664
|
+ int[] arr = {4, 6, 2, 8};
|
|
665
|
+ //WHEN
|
|
666
|
+ int[] actual = arraz.removeLastItemAndCopy(arr);
|
|
667
|
+
|
|
668
|
+ //THEN
|
|
669
|
+ Assert.assertEquals(arr[2], actual[actual.length - 1]);
|
|
670
|
+ }
|
626
|
671
|
}
|