ComputervirusTester

ComputervirusTester - import junit.framework.TestCase A...

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

View Full Document Right Arrow Icon
import junit.framework.TestCase; /** * A JUnit test case class. * Every method starting with the word "test" will be called when running * the test with JUnit. */ public class ComputervirusTester extends TestCase { /** * A test method. * (Replace "X" with a name describing the test. You may write as * many "testSomething" methods in this class as you wish, and each * one will be called when running JUnit over this class.) */ public void testComputerVirus() { ComputerVirus v1 = new ComputerVirus ("spyware", 0, 2000, 'W'); assertEquals("spyware", v1.getName()); assertEquals(0, v1.getMOD()); assertEquals(2000, v1.getYOD()); assertEquals('W',v1.getType()); assertEquals(-1, v1.getId()); assertEquals(null, v1.getPredecessor()); assertEquals(0, v1.getVariations()); ComputerVirus v2 = new ComputerVirus ("daisy", 1, 2000, 'W'); assertEquals("daisy", v2.getName()); assertEquals(1, v2.getMOD()); assertEquals(2000, v2.getYOD()); assertEquals( 'W', v2.getType()); ComputerVirus v3 = new ComputerVirus("chocolate", 12, 2000, 'M'); assertEquals ("chocolate", v3.getName()); assertEquals (12, v3.getMOD()); assertEquals (2000, v3.getYOD()); assertEquals ('M', v3.getType()); ComputerVirus v4 = new ComputerVirus("pretzels", 10, 2000, 'L');
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 / 3

ComputervirusTester - import junit.framework.TestCase A...

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