ComputerTest

ComputerTest - * It's a way of checking the code. */ public...

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

View Full Document Right Arrow Icon
import student.*; /** * Unit tests for the {@link Computer} class. * * @author Ran Wang (ranwang ) * @author Rithvik Kasireddy (rrk24) * @version (2010.08.27) */ public class ComputerTest extends TestCase { Computer comp;// creating a new computer test object public ComputerTest() { // The constructor is usually empty in unit tests, since it runs // once for the whole class, not once for each test method. // Per-test initialization should be placed in setUp() instead. } /** * Sets up the test fixture. * Called before every test case method. */ public void setUp() { comp= new Computer ("intel", 2, 1.0); /*Inserted our own values which were assigned into the computer object */ } /** * These methods serve the purpose of testing. * These methods all the setters and getters in the computer class and return the values * and see if they equate to each other.
Background image of page 1

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

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

Unformatted text preview: * It's a way of checking the code. */ public void testGetProcessor () { assertEquals("intel",comp.getProcessor()); } public void testGetNumCores () { assertEquals(2,comp.getNumCores()); } public void testGetProcessorSpeed () { assertEquals(1.0,comp.getProcessorSpeed(),.01); } public void testsetProcessor () { comp.setProcessor("AMD"); assertEquals("AMD",comp.getProcessor()); } public void testsetNumCores () { comp.setNumCores(5); assertEquals(5,comp.getNumCores()); } public void testsetProcessorSpeed () { comp.setProcessorSpeed(2.0); assertEquals(2.0,comp.getProcessorSpeed(),.01); } public void testcomputePower () { assertEquals(2.0,comp.computePower(),.01); } public void testtoString() { assertEquals("intel, 2 cores at 1.0GHz", comp.toString()); } }...
View Full Document

This note was uploaded on 12/03/2010 for the course CS 2114 taught by Professor Staff during the Fall '10 term at Virginia Tech.

Page1 / 2

ComputerTest - * It's a way of checking the code. */ public...

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