Q:

Why are the tests faiing when the actual value and the expected value are the same in JUnit?

I'm writing a code about reversing a String in Java and I have to do some tests with JUnit. The program works for every input I insert. The problem is the tests fail. However, when I see the actual and the expected values they're one and the same. 
That is the code I wrote for the reversing method: 
public static String reverseEnd(String text, int start) {
    char[] reverse = new char[text.length()];
    char[] normal = new char[start];

    for (int i = 0; i < text.length(); i++) {
        if (i < start) {
            normal[i] = text.charAt(i);
        }
        else {
            reverse[text.length()-i-1] = text.charAt(i);
        }
    }

    return String.copyValueOf(normal) + String.copyValueOf(reverse);
}

And these are the tests I am doing: 
public void test2() {
    assertEquals("a", StringManipulation.reverseEnd("a", 1));
}

public void test4() {
    assertEquals("HdlroW ,olle", StringManipulation.reverseEnd("Hello, World",1));
}

//text.length() = 12
//start = 3 (1<start<text.length()-1)
//text.length() - start = 9
@Test
public void test5() {
    assertEquals("HeldlroW ,ol", StringManipulation.reverseEnd("Hello, World",3));
}

//text.length() = 12
//start = 11
//text.length() - start = 1 (= text.length() -1)
@Test
public void test6() {
    assertEquals("Hello, World", StringManipulation.reverseEnd("Hello, World",11));
}

//text.length() = 12
//start = 12
//text.length() - start = 0 
@Test
public void test7() {
    assertEquals("Hello, World", StringManipulation.reverseEnd("Hello, World",12));
}

//text.length() = 5
//start = 5
//text.length() - start = 0
@Test
public void test8() {
    assertEquals("World", StringManipulation.reverseEnd("World",0));
}

//text.length() = 5
//start = 4
//text.length() - start = 1
@Test
public void test9() {
    assertEquals("World", StringManipulation.reverseEnd("World",4));
}

//text.length() = 5
//start = 3
//text.length() - start = 2 (even and >1)
@Test
public void test10() {
    assertEquals("Wordl", StringManipulation.reverseEnd("World",3));
}

//text.length() = 5
//start = 2
//text.length() - start = 3
@Test
public void test11() {
    assertEquals("Wodlr", StringManipulation.reverseEnd("World",2));
}

A:

The actual and expected values you're getting a not the same. The actual values your method returns have trailing whitespaces. One way to get rid of them would be to trim your result:
return String.copyValueOf(normal).trim() + String.copyValueOf(reverse).trim(); 

Alternatively, instead of messing around with arrays, you could use a StringBuilder to append the characters you need:
public static String reverseEnd(String text, int start) {
    StringBuilder sb = new StringBuilder(text.length());
    sb.append(text, 0, start);
    for (int i = text.length() - 1; i >= start; --i) {
        sb.append(text.charAt(i));
    }

    return sb.toString();
}

