lundi 7 janvier 2019

How to test parameters passed to functions using junit? [duplicate]

This question already has an answer here:

I want to test the function replacefl for checking whether my "String s" has undergone the required changes inside the function.

public class Abc{

void replcefl(String s){

        s = s.subSequence(1, s.length() - 1).toString();

    }
}

public class AbcTest{
Abc abc = new Abc();

@Test
public void testfl{
   String testString="{Chandan}";
   String resultString="Chandan";

   abc.replacefl(testString);
   assertEquals( resultString, testString);
}

}

Aucun commentaire:

Enregistrer un commentaire