Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- cannot be applied to given types;
- [ERROR] required: int[]
- [ERROR] found: int,int,int,int
- reason: actual and formal argument lists differ in length
- @Test
- public void whenTurnArrayWithEvenAmountOfElementsThenTurnedArray() {
- Turn turn = new Turn();
- int[] resultArray = turn.back(4, 1, 6, 2);
- int[] expectArray = turn.back(2, 6, 1, 4);
- assertThat(resultArray, is(expectArray));
- }
- public int[] back(int[] array) {
- for (int i = 0; i < array.length / 2; i++) {
- int k = array[i];
- array[i] = array[array.length - i + 1];
- array[array.length - i + 1] = k;
- }
- return array;
- }
- @Test
- public void whenTurnArrayWithEvenAmountOfElementsThenTurnedArray() {
- Turn turn = new Turn();
- int[] resultArray = turn.back(new int[] {4, 1, 6, 2});
- int[] expectArray = new int[] {2, 6, 1, 4};
- assertThat(resultArray, is(expectArray));
- }
- public int[] back(int... array) {
- for (int i = 0; i < array.length / 2; i++) {
- int k = array[i];
- array[i] = array[array.length - i + 1];
- array[array.length - i + 1] = k;
- }
- return array;
- }
- @Test
- public void whenTurnArrayWithEvenAmountOfElementsThenTurnedArray() {
- Turn turn = new Turn();
- int[] resultArray = turn.back(4, 1, 6, 2);
- int[] expectArray = new int[] {2, 6, 1, 4};
- assertThat(resultArray, is(expectArray));
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement