First, you must think about how the state of the
DiscChanger
impacts the execution of each method. So,
you should certainly:
on
and off
both when the changer is on and when it is off.
ejectAll()
method both when all slots
are full and when all slots are empty.
and you should think about whether you need to:
next()
and previous
methods
when the current, previous and next slots are full and empty.
Second, you must think about how state transitions impact
each method (i.e., how the DiscChanger
might be used
over time and how this might cause difficulties). For example:
next()
and
previous()
methods.
loadDisc()
and eject()
methods.
on()
and off()
methods.
DiscChanger
it was designed for.
The first line of each file contains the correct output (preceeded
by //).
The following files contain some basic test loadDisc()
,
getID()
, next()
, previous()
,
and eject()
methods:
The following file contains a test of the on()
and off()
methods:
The following file contains a test of the loadDisc()
method under both full and empty conditions:
Copyright 2010