



Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
Prepare for your exams
Study with the several resources on Docsity
Earn points to download
Earn points by helping other students or get them with a premium plan
Material Type: Project; Professor: Mercer; Class: Object-Oriented Programming and Design; Subject: COMPUTER SCIENCE; University: University of Arizona; Term: Fall 2000;
Typology: Study Guides, Projects, Research
1 / 6
This page cannot be seen from the preview
Don't miss anything!




Eclipse.lnk
Browse to wherever you JUnit was unzipped (may differ at home) and Click on junit.jar
The Specification for the Class You are to Write (finally)
// For C Sc 335 project 1: Make the following tests pass import junit.framework.*; public class BowlingLineTest extends TestCase { private BowlingLine g; // The setUp method executes before each and every method in this // class that begins with test and has 1 or more characters after test. public void setUp() { g = new BowlingLine (); // Create a new line to score bowling }
public void testTwoThrowsNoMark() { g.pinsDowned(5); g.pinsDowned(4); assertEquals(9, g.scoreAtFrame(1)); } public void testFourThrowsNoMark() { g.pinsDowned(7); g.pinsDowned(2); g.pinsDowned(5); g.pinsDowned(4); assertEquals(18, g.scoreAtFrame(2)); } public void testSimpleSpare() { g.pinsDowned(3); g.pinsDowned(7); g.pinsDowned(3); assertEquals(13, g.scoreAtFrame(1)); } public void testSimpleFrameAfterSpare() { g.pinsDowned(3); g.pinsDowned(7); g.pinsDowned(3); g.pinsDowned(2); assertEquals(13, g.scoreAtFrame(1)); assertEquals(18, g.scoreAtFrame(2)); assertEquals(18, g.scoreSoFar()); } public void testSimpleStrike() { g.pinsDowned(10); g.pinsDowned(3); g.pinsDowned(6); assertEquals(19, g.scoreAtFrame(1)); assertEquals(28, g.scoreSoFar()); } public void testPerfectGame() { for ( int i = 0; i < 12; i++) g.pinsDowned(10); assertEquals(300, g.scoreSoFar()); } public void testEndOfArray() { for ( int i = 1; i <= 9; i++) { g.pinsDowned(0); g.pinsDowned(0); } g.pinsDowned(2); g.pinsDowned(8); // 10th frame spare g.pinsDowned(10); // Strike in last position of array. assertEquals(20, g.scoreSoFar()); }