ComputerTest - import student Unit tests for the [email protected]

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

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.
Image of page 1

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

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

  • '10
  • Staff
  • Subroutine, Intel, Test method, public void

{[ snackBarMessage ]}

What students are saying

  • Left Quote Icon

    As a current student on this bumpy collegiate pathway, I stumbled upon Course Hero, where I can find study resources for nearly all my courses, get online help from tutors 24/7, and even share my old projects, papers, and lecture notes with other students.

    Student Picture

    Kiran Temple University Fox School of Business ‘17, Course Hero Intern

  • Left Quote Icon

    I cannot even describe how much Course Hero helped me this summer. It’s truly become something I can always rely on and help me. In the end, I was not only able to survive summer classes, but I was able to thrive thanks to Course Hero.

    Student Picture

    Dana University of Pennsylvania ‘17, Course Hero Intern

  • Left Quote Icon

    The ability to access any university’s resources through Course Hero proved invaluable in my case. I was behind on Tulane coursework and actually used UCLA’s materials to help me move forward and get everything together on time.

    Student Picture

    Jill Tulane University ‘16, Course Hero Intern