Quick Index
Code Explanation


Hello, I am PairSmokeTest.

I am a smoke test.

The purpose of a smoke test is to make sure the code does not blow up (throw exceptions) immediately (upon use).

The idea smoke test is invaluable as complexity increases.

My superclass is Abstract Test.

Read more about me below.

  • Run the tests
  • Show the testing summary
	public static void main(String[] args)  {
		PairSmokeTest test = new PairSmokeTest();
		test.testConstruct();
		test.testAccessors();
		test.printSummary();
	}
A simple smoke test:
  • Construct an Pair
  • Make sure the result is not null
We're just checking if the code blows up.
The helper method assertNotEquals is used.
	private void testConstruct()  {
		header("Starting -- testConstruct");
		//1-2-3 declare-construct-test
		Pair<Integer, Double> pair;
		pair = new Pair<>(0, 10.5);
		assertNotEquals(null, pair);
	}
A simple smoke test:
  • Construct an Pair
  • Use the accessor methods
  • Make sure results are not null
	private void testAccessors()  {
		header("Starting -- testAccessors");
		//Declare
		Pair<Employee, String> pair;
		int id = 1;
		Employee emp = new Employee(id, "Kofi Kingston");
		//Construct
		pair = new Pair<>(emp, "08:30 AM");
		//Test
		assertNotEquals(null, pair.getFirst());
		assertNotEquals(null, pair.getSecond());
	}

Complete Source Code


Here is my code.

Have Fun.

Your friend,
PairSmokeTest

package pair.test;
import pair.model.Pair;
import testutil.AbstractTest;
import testutil.Employee;

public class PairSmokeTest extends AbstractTest {

	//--------------------------
	//Main (Entry Point)

	public static void main(String[] args) {
		PairSmokeTest test = new PairSmokeTest();
		test.testConstruct();
		test.testAccessors();
		test.printSummary();
	}

	//--------------------------
	//Tests

	private void testConstruct() {
		header("Starting -- testConstruct");
		//1-2-3 declare-construct-test
		Pair<Integer, Double> pair;
		pair = new Pair<>(0, 10.5);
		assertNotEquals(null, pair);
	}

	private void testAccessors() {
		header("Starting -- testAccessors");
		//Declare
		Pair<Employee, String> pair;
		int id = 1;
		Employee emp = new Employee(id, "Kofi Kingston");
		//Construct
		pair = new Pair<>(emp, "08:30 AM");
		//Test
		assertNotEquals(null, pair.getFirst());
		assertNotEquals(null, pair.getSecond());
	}


}