CpSc 372
Exam 2
Name______________________________________________
Answer any FIVE of the six questions. If you answer all six, the one on which you scored the best will NOT be graded. All questions are counted the same: 20 points each.
INV: brickPile.getNumberOfBricks = OriginalNumberOfBricks
PRE: not mPiece = null
public void moved(MovablePiece mPiece) throws Collision {
for (int
i = 0; i < this.getSize(); i++) {
if(((Brick)_list.elementAt(i)).getBoundingBox().intersects(mPiece.getBoundingBox()))
{
_fieldPtr.clearCollisions();
throw new
Collision(mPiece,((Brick)_list.elementAt(i)),mPiece.getPosition());
}
}
}
POST: void OR
thrown Collision
The class invariant is evaluated before and after each test case to ensure the sanity of the object under test.
The weight reflects the importance placed on each decision criteria.
Inexperienced designers can make better decisions because of the work of more experienced designers.
Design patterns never exactly fit a problem.

A timer object sends the tick message to the gameBoard object. In response the gameBoard object sends the move message to a moveableSprite object. The movableSprite object sends itself the computeNew_Location message. The gameBoard object then sends the checkForCollision message to the movableSprite. The movableSprite then sends itself the collideWith message.
Functional sub-use case. There is no actor shown in this diagram so it represents a portion of a use.
The arrival of ticks (and therefore the movement of objects) would be less predictable

public void moved(MovablePiece mPiece) throws
Collision {
ArcadeGamePiece piece;
boolean
collided = false;
if
(!list.isEmpty()) {
for (int
i = 0; i < list.size(); i++) {
piece
= (ArcadeGamePiece)list.elementAt(i);
if((piece.getBoundingBox()).intersects(mPiece.getBoundingBox())
&& piece != lastPiece) {
lastPiece = piece;
throw new Collision(mPiece, piece, mPiece.getPosition());
}
}
}
}
The movablePiece != null; pass
in a MovablePiece that overlaps with
something on the list ; I expect a Collision exception will be thrown
The movablePiece != null; pass
in a MovablePiece that does not overlap
with something on the list ; I expect a void return
Technically, any single test case will do since
there is just a sequence of three statements
Eclipse is easier to install
because it fixes the CLASSPATH and Path variables automatically
It requires additional
development and testing time to achieve this
Self-tests are included in the deployment package. They are either run automatically or the installer is prompted to run them. The intent is to ensure that the program is operating correctly.
The sophistication of the
audience
The cost of the deployment
program
The complexity of the program
pieces
The development process produces code and the testing process produces test results that identify faults
Ø
Description – The unit test phase validates
completed units
Ø
Responsibility – The developer has responsibility to
test what they develop
Ø
Input – completed units; test criteria
Ø
Entry Criteria – unit is ready to be tested
Ø
Activities – test written, tests executed, test
results analyzed
Ø
Output – test results
Ø
Exit Criteria – iterate back if too many errors;
move forward if sufficient portion passes
Ø Metrics - %of tests that passed