Link to home
Start Free TrialLog in
Avatar of gudii9
gudii9Flag for United States of America

asked on

junit testing

Hi,

I followed

https://www.youtube.com/watch?v=v2F49zLLj-8

package test;

import org.junit.runner.RunWith;
import org.junit.runners.Suite;
import org.junit.runners.Suite.SuiteClasses;

@RunWith(Suite.class)
@SuiteClasses({ ConcateTest.class, MultiplyTest.class })
public class AllTests {

}

Open in new window


package test;

import static org.junit.Assert.*;

import org.junit.Test;

public class ConcateTest {

	@Test
	public void testConcat() {
		Junit junit=new Junit();
		String result=junit.concatenate("aa", "bc");
		assertEquals("aabc", result);
		
		
	}

}

Open in new window


package test;

public class Junit {

	public String concatenate(String one, String two)
	{

	return one+two;

	}

	public int multiply(int number1, int number2)
	{

	return number1*number2;
	}

	}

Open in new window


package test;

import static org.junit.Assert.*;

import org.junit.Test;

public class MultiplyTest {

	@Test
	public void testMultiply() {
		Junit junit=new Junit();
		int result=junit.multiply(3, 6);
		assertEquals(18, result);
	}

}

Open in new window


i wrote above junit tests, suite all works perfect with simple int and strings. When it comes to unit testing complex objects in real time projects involving multiple layers, services with mock objects i am not completely confident in those scenarios. Are there any good similar video tutorials on those advanced junit topics. Any good material, resources to go learn practically step by step. Please advise
ASKER CERTIFIED SOLUTION
Avatar of gudii9
gudii9
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial