A4Tester_Solutions

A4Tester_Solutions - Assignment 4 import...

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

View Full Document Right Arrow Icon
Sheet1 Page 1 // Assignment 4 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 { /** Test methods complement, truncateTo5, toString(Color rgb), toString(HSV hsv), and toString(CMYK cmyk) */ public void testStrings() { assertEquals(new Color(5, 255, 255-71), A4Methods.complementRGB(new Color(250, 0, 71))) assertEquals("", A4Methods.truncateTo5("")) assertEquals("A", A4Methods.truncateTo5("A")) assertEquals("ABCDE", A4Methods.truncateTo5("ABCDE")) assertEquals("ABCDE", A4Methods.truncateTo5("ABCDEF")) assertEquals("ABCDE", A4Methods.truncateTo5("ABCDEFGHI")) assertEquals("[30, 240, 230]", A4Methods.toString(new Color(30, 240, 230))) assertEquals("[4.0, 1.0, 5.5, 6.5]", A4Methods.toString(new CMYK(4,1,5.5,6.5))) assertEquals("[4.544, 4.5, 5.5, 6.5]", A4Methods.toString(new CMYK(4.544566778876,4.5,5.5,6.5))) assertEquals("[4.0, 1.0, 5.5]",
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 homework help was uploaded on 02/20/2009 for the course CS 100 taught by Professor Fan/vanloan during the Spring '07 term at Cornell.

Page1 / 4

A4Tester_Solutions - Assignment 4 import...

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