A4Tester - import junit.framework.TestCase import java.awt...

Info iconThis preview shows pages 1–2. Sign up to view the full content.

View Full Document Right Arrow Icon
import junit.framework.TestCase; import java.awt.*; /** * A JUnit test case class. * Every method starting with the word "test" will be called when running * the test with JUnit. */ public class A4Tester extends TestCase { p /** Test complement */ public void testComplement() { assertEquals(new Color(5, 255, 255-71), A4Methods.complementRGB(new Color(250, 0, 71))); } /** Test methods complement and truncateTo5 */ public void testTruncateTo5() { assertEquals("130.5", A4Methods.truncateTo5(130.59)); assertEquals("130.5", A4Methods.truncateTo5(130.54)); assertEquals("100.0", A4Methods.truncateTo5(100)); assertEquals("99.56", A4Methods.truncateTo5(99.566)); assertEquals("99.99", A4Methods.truncateTo5(99.99)); assertEquals("99.99", A4Methods.truncateTo5(99.995)); assertEquals("21.99", A4Methods.truncateTo5(21.99575)); assertEquals("21.99", A4Methods.truncateTo5(21.994)); assertEquals("10.01", A4Methods.truncateTo5(10.013567)); assertEquals("10.00", A4Methods.truncateTo5(10.000000005)); assertEquals("9.999", A4Methods.truncateTo5(9.9999)); assertEquals("9.999", A4Methods.truncateTo5(9.9993)); assertEquals("1.354", A4Methods.truncateTo5(1.3546)); assertEquals("1.354", A4Methods.truncateTo5(1.3544)); assertEquals("0.045", A4Methods.truncateTo5(.0456)); assertEquals("0.045", A4Methods.truncateTo5(.0453)); assertEquals("0.005", A4Methods.truncateTo5(.0056)); assertEquals("0.001", A4Methods.truncateTo5(.0013)); assertEquals("0.000", A4Methods.truncateTo5(.0004)); assertEquals("0.000", A4Methods.truncateTo5(.0009999)); } public void testRoundTo5() { /*E.g. round 1.3546 to 1.355. round 1.3544 to 1.354.
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Image of page 2
This is the end of the preview. Sign up to access the rest of the document.

This document was uploaded on 02/24/2010.

Page1 / 4

A4Tester - import junit.framework.TestCase import java.awt...

This preview shows document pages 1 - 2. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online