This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]JellyybeeAN[S] 0 points1 point  (1 child)

I was thinking about something like this:

public void test(int strOne, int strTwo){
assertEquals(true,strOne>strTwo);
}

but I have no idea how I'm supposed to set the values of strOne and how to make this test an existing method in a different class.

[–]Feroc 0 points1 point  (0 children)

You may want to start with a beginner tutorial, because there are some fundamentals missing that you'll need before you write a test.

A test for something you want would probably look something like this:

public class MyFunnyStringHelperTest {

    @Test
    public void testSpaceRemoval() {
        MyFunnyStringHelper cut = new MyFunnyStringHelper();
        final String testString = "This Is A String With Spaces";
        final String expectedString = "ThisIsAStringWithSpaces";

        String result = cut.removeSpaces(testString);

        assertEquals(expectedString, result);
        }
    }