Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package utilities;
- import junit.framework.Assert;
- import junit.framework.TestCase;
- public class Seftesting extends TestCase{
- public void testMaxValid() {
- int tab[]={0,1,4,10,55,23};
- int res = Max.max(tab);
- Assert.assertEquals(55, res);
- }
- public void testMaxInValid() {
- int tab[]={};
- try{
- int res = Max.max(tab);
- Assert.fail();
- }catch(NotExist e){
- Assert.assertTrue(true);
- }catch(Exception e){
- Assert.fail();
- }
- }
- public void testMaxInValid2() {
- int tab[]=null;
- try{
- int res = Max.max(tab);
- Assert.fail();
- }catch(NotExist e){
- Assert.assertTrue(true);
- }
- }
- public void testMaxLength1() {
- int tab[]={1};
- int res = Max.max(tab);//peste tot trb sa invoc metoda
- Assert.assertEquals(1, res);
- }
- public void testMaxIf() {
- int tab[]={11,5,6,1,3};
- int max = Max.max(tab);
- Assert.assertEquals(11, max);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement