package junit.samples;

import junit.framework.*;

import java.io.*;

/**
 * Some simple tests.
 *
 */
public class SimpleTest extends TestCase {
	protected int fValue1;
	protected int fValue2;

	protected void setUp() {
		fValue1= 2;
		fValue2= 3;
	}


    // 1. Test
	public void testAdd() {
		double result= fValue1 + fValue2;
		// forced failure result == 5
		assertTrue(result == 6);
    //assertEquals(6,result);
	}

    // 2. Test
	public void testDivideByZero() {
		int zero= 1;
		int result= 8/zero;
    assertEquals(8,result);
	}

    // 3. Test
	public void testEquals() {
		assertEquals(12, 12);
		assertEquals(12L, 12L);
		assertEquals(new Long(12), new Long(12));

		assertEquals("Size", 12, 13);  // Fehler
		assertEquals("Differenz", 12.0, 11.99, 0.0);  // Fehler
	}
	public static Test suite() {
		return new TestSuite(SimpleTest.class);
	}
	public static void main (String[] args) {
      // starte alle public test*()
		junit.textui.TestRunner.run( suite() );
    pause();
	}

   private static void pause() {
    try {
      System.in.read();
    }
    catch (IOException e) {
    }
  }  // pause


}