Welcome to the CSC Q&A, where you can get help (and share your knowledge) about computer science!

MT2 Using JUnit

+14 votes
What is the general format in JUnit for a line of code to test another method?
asked Oct 26, 2015 in Fall 15-16 by Nick Caputo (100 points)

1 Answer

+4 votes
Is this right/what you were looking for? 
public void testGetTheStringArray() {
        MyUnit myUnit = new MyUnit();

        String[] expectedArray = {"one", "two", "three"};

        String[] resultArray =  myUnit.getTheStringArray();

        assertArrayEquals(expectedArray, resultArray);


answered Oct 27, 2015 by Kelsey Self (100 points)
You should probably have an @Test annotation above the method...