Thursday, October 22, 2009

LIST OF TESTS









































Prev don't be afraid of buying books Next






























LIST OF TESTS






Test 1:
defined on Pg. 207 and
implemented on Pg. 207





An empty list should have a size of zero.


















Test 2:
defined on Pg. 207 and
implemented on Pg. 209





Adding a movie to an empty list should result in
a list with a size of one.


















Test 3:
defined on Pg. 207 and
implemented on Pg. 211





Adding two movies to an empty list should result
in a list with a size of two.


















Test 4:
defined on Pg.207 and
implemented on Pg. 214





If we add a movie to a list, we should be able
to ask if it's there and receive a positive response. Conversely,
we should receive a negative response when we ask about a movie
that we haven't added.


















Test 5:
defined on Pg. 219 and
implemented on Pg. 219





The logical layer should send the appropriate
list of movies to the view for display.


















Test 6:
defined on Pg. 219 and
implemented on Pg. 221





The GUI should have a listbox and should display
a list of movies in it as requested.



















Test 7:
defined on Pg. 226 and
implemented on Pg. 226





When the logical layer is asked to add a movie,
it should request the required data from the view and update the
movie list to include a new movie based on the data provided.


















Test 8:
defined on Pg. 226 and
implemented on Pg. 229





The GUI should have a field for the movie name
and an add button. It should answer the contents of the name field
when asked, and request that the logical layer add a movie when the
add button is pushed.


















Test 9:
defined on Pg. 235 and
implemented on Pg. 235





Changing the name of a movie results in it using
the new name hereafter.


















Test 10:
defined on Pg. 235 and
implemented on Pg. 236





A movie can't be constructed with a null
name.


















Test 11:
defined on Pg. 235 and
implemented on Pg. 236





A movie can't be constructed with an empty
name.


















Test 12:
defined on Pg. 235 and
implemented on Pg. 237





A movie can't be renamed to a null name.


















Test 13:
defined on Pg. 235 and
implemented on Pg. 238





A movie can't be renamed to an empty name.


















Test 14:
defined on Pg. 239 and
implemented on Pg. 239





Indicating, to the logical layer, that a
selection is made from the list causes the view to be given a value
for the name field, that is, the selected movie's name.


















Test 15:
defined on Pg. 239 and
implemented on Pg. 241





Selecting from the list causes the name field to
be filled in with the selected movie's name.


















Test 16:
defined on Pg. 239 and
implemented on Pg. 242





When an update is requested, the selected movie
is renamed to whatever is answered by the view as the new name.


















Test 17:
defined on Pg. 239 and
implemented on Pg. 244





When the update button is pushed, the selected
movie is renamed to what-ever is in the name field.


















Test 18:
defined on Pg. 247 and
implemented on Pg. 247





Attempting to add a duplicate movie throws an
exception and leaves the list unchanged.


















Test 19:
defined on Pg. 247 and
implemented on Pg. 248





Asking the movielist to rename a movie results
in its name being changed.


















Test 20:
defined on Pg. 247 and
implemented on Pg. 251





Asking the logical layer to add a duplicate
movie causes it to inform the presentation layer that the operation
would result in a duplicate.


















Test 21:
defined on Pg. 247 and
implemented on Pg. 253







Asking the logical layer to update a movie that
would result in a duplicate causes it to inform the presentation
layer that the operation would result in a duplicate.


















Test 22:
defined on Pg. 247 and
implemented on Pg. 255





Trying to add a movie that is the same as one in
the list results in the display of a "Duplicate Movie" error
dialog.


















Test 23:
defined on Pg. 247 and
implemented on Pg. 256





Trying to rename a movie to the name of one in
the list results in the display of a "Duplicate Movie" error
dialog.


















Test 24:
defined on Pg. 261 and
implemented on Pg. 261





An unrated movie answers negative when asked if
it is rated.


















Test 25:
defined on Pg. 261 and
implemented on Pg. 261





A rated movie answers positive when asked if it
is rated, and it can answer its rating when asked.


















Test 26:
defined on Pg. 261 and
implemented on Pg. 263





Asking an unrated movie for its rating throws an
exception.


















Test 27:
defined on Pg. 264 and
implemented on Pg. 264





When asked for the renderer component, the
renderer returns itself.


















Test 28:
defined on Pg. 264 and
implemented on Pg. 265





When given a movie to render, the resulting test
and rating image corresponds to the movie being rendered.


















Test 29:
defined on Pg. 264 and
implemented on Pg. 266





When rendering an unselected item, the renderer
uses its list's unselected colors.


















Test 30:
defined on Pg. 264 and
implemented on Pg. 267





When rendering a selected item, the renderer
uses its list's selected colors.


















Test 31:
defined on Pg. 270 and
implemented on Pg. 270





Selecting a movie updates the rating in the
GUI.


















Test 32:
defined on Pg. 270 and
implemented on Pg. 272





Updating a movie changes its rating if a
different rating was selected for it.


















Test 33:
defined on Pg. 270 and
implemented on Pg. 273





Selecting a movie from the list updates the
displayed rating.


















Test 34:
defined on Pg. 270 and
implemented on Pg. 275





Updating a movie in the GUI changes its rating
if a different rating was selected for it, and updates the display
accordingly.


















Test 35:
defined on Pg. 277 and
implemented on Pg. 277





A movie that hasn't explicitly been given a
category should answer that it is uncategorized when asked for its
category.


















Test 36:
defined on Pg. 277 and
implemented on Pg. 278







If a movie is given a category when it is
created, it answers that when asked for its category.


















Test 37:
defined on Pg. 277 and
implemented on Pg. 279





Trying to create a movie with an invalid
category (i.e., not from the predefined set) throws an
exception.


















Test 38:
defined on Pg. 281 and
implemented on Pg. 282





Telling the logical layer that a movie is
selected causes the presentation layer to be told the category to
display.


















Test 39:
defined on Pg. 281 and
implemented on Pg. 283





Selecting a movie in the GUI causes the category
field to be updated.


















Test 40:
defined on Pg. 285 and
implemented on Pg. 285





Telling the logical layer to update and
providing it with data that indicates a category change results in
the GUI layer being given a new set of movies with that change
reflected.


















Test 41:
defined on Pg. 285 and
implemented on Pg. 286





Selecting a movie from the list, changing the
value of the category, and pressing Update updates the data for
that movie. When that movie is selected again, the new category is
displayed.


















Test 42:
defined on Pg. 289 and implemented on Pg.
290





Requesting a sublist filtered on a specific
category answers a list containing all movies of that category, and
only those movies.


















Test 43:
defined on Pg. 292 and
implemented on Pg. 293





Asking for a subset for the ALL category answers
the original list.


















Test 44:
defined on Pg. 293 and
implemented on Pg. 295





When the logical layer is told to filter on a
specific category, the presentation layer is given a new list to
display containing movies for the specified category.


















Test 45:
defined on Pg. 293 and
implemented on Pg. 296





Telling the logical layer to select a specific
movie in a filtered list rather than the complete list from
actually selects the appropriate movie, in spite of being selected
from a sublist.


















Test 46:
defined on Pg. 293 and
implemented on Pg. 297





Telling the logical layer to update a specific
movie in a filtered list rather than from the complete list
actually updates the appropriate movie properly.


















Test 47:
defined on Pg. 294 and
implemented on Pg. 298





A rename performed in the context of the logical
layer is done in the underlying full list; that is, potential
duplicates in the full list are detected.


















Test 48:
defined on Pg. 294 and
implemented on Pg. 299





Selecting a category to filter on in the GUI
causes the displayed list of movies to update accordingly.



















Test 49:
defined on Pg. 300 and
implemented on Pg. 301





Changing the category of a movie in a filtered
list causes that movie to be removed from the list. If that
category is filtered on, that movie will be in the list.


















Test 50:
defined on Pg. 309 and
implemented on Pg. 309





Writing an empty list to a stream writes
nothing.


















Test 51:
defined on Pg. 309 and
implemented on Pg. 310





Writing a list of one movie should write that
movie to the stream in the format <name> | <category> |
<rating>.


















Test 52:
defined on Pg. 309 and
implemented on Pg. 312





Writing a list containing several movies writes
each movie to the stream, one per line, in the format of the
previous test.


















Test 53:
defined on Pg. 313 and
implemented on Pg. 313





Telling the logical layer to "save–as"
causes it to ask the presentation layer to specify a file into
which it writes the movie list.


















Test 54:
defined on Pg. 313 and
implemented on Pg. 316





Selecting "Save As" from the "File" menu prompts
for a file using the standard file chooser. The list is written
into the selected file.


















Test 55:
defined on Pg. 313 and
implemented on Pg. 321





If the file selection is cancelled, nothing is
written to any file.


















Test 56:
defined on Pg. 322 and
implemented on Pg. 322





Telling the logical layer to "Save" causes it to
save the current list to the same file as the previous "Save As"
operation.


















Test 57:
defined on Pg. 322 and
implemented on Pg. 325





Selecting "Save" from the "File" menu causes the
list to be written into the previously selected file.


















Test 58:
defined on Pg. 329 and
implemented on Pg. 329





Reading from an empty stream results in an empty
list of movies.


















Test 59:
defined on Pg. 329 and
implemented on Pg. 330





Reading from a stream containing the data for a
single movie results in a list containing the single movie.


















Test 60:
defined on Pg. 329 and
implemented on Pg. 332





Reading from a stream containing the data for
several movies results in a list containing those movies.


















Test 61:
defined on Pg. 333 and
implemented on Pg. 333





With the list empty, telling the logical layer
to load from a file that contains data for a set of movies results
in the list containing those movies.


















Test 62:
defined on Pg. 333 and
implemented on Pg. 335





Choosing "Load" from the "File" menu and
selecting a file containing a specific set of movie data causes the
corresponding movies to be placed in the list.



















Test 63:
defined on Pg. 333 and
implemented on Pg. 336





With a set of movies loaded, cancelling the load
of a different set leaves the originally loaded set unchanged.


















Test 64:
defined on Pg. 339 and implemented on Pg.
340





Comparing two movies with the same name, based
on name, should answer 0.


















Test 65:
defined on Pg. 339 and implemented on Pg.
340





Comparing two movies, the first having a
lexically smaller name, based on name, should answer a negative
integer.


















Test 66:
defined on Pg. 339 and implemented on Pg.
341





Comparing two movies, the first having a
lexically greater name, based on name, should answer a positive
integer.


















Test 67:
defined on Pg. 339 and implemented on Pg.
342





Comparing two movies with the same rating, based
on rating, should answer 0.


















Test 68:
defined on Pg. 339 and implemented on Pg.
342





Comparing two movies, the first having a lower
rating, based on rating, should answer a negative integer.


















Test 69:
defined on Pg. 339 and
implemented on Pg. 342





Comparing two movies, the first having a higher
rating, based on rating, should answer a positive integer.


















Test 70:
defined on Pg. 339 and implemented on Pg.
342





For the purposes of comparison, an unrated movie
always has a lower rating.


















Test 71:
defined on Pg. 343 and
implemented on Pg. 343





Sorting an empty list has no effect on it.


















Test 72:
defined on Pg. 343 and
implemented on Pg. 344





Sorting a list, by name, that is already sorted
has no effect on it.


















Test 73:
defined on Pg. 343 and
implemented on Pg. 345





Sorting a list, by name, that is in reverse
order puts it in order.


















Test 74:
defined on Pg. 343 and
implemented on Pg. 347





Sorting a list, by rating, that is already
sorted has no effect on it.


















Test 75:
defined on Pg. 343 and
implemented on Pg. 347





Sorting a list, by rating, that is in reverse
order puts it in order.


















Test 76:
defined on Pg. 343 and
implemented on Pg. 347





Sorting a list, by rating, that has duplicates
puts it in order; the duplicates being in their original order
relative to one another.


















Test 77:
defined on Pg. 343 and
implemented on Pg. 348





Sorting a randomly ordered list by name puts it
in order, by name.


















Test 78:
defined on Pg. 343 and
implemented on Pg. 348







Sorting a randomly ordered list by rating puts
it in order, by name.


















Test 79:
defined on Pg. 349 and
implemented on Pg. 349





Asking the logical layer to sort its list causes
the associated view's list to be updated to one that is in order
(order depends on what is being sorted on).


















Test 80:
defined on Pg. 350 and
implemented on Pg. 351





Selecting "Sort by name" from the "View" menu
causes the displayed list to be sorted by name.


















Test 81:
defined on Pg. 350 and
implemented on Pg. 352





Selecting "Sort by rating" from the "View" menu
causes the displayed list to be sorted by rating.


















Test 82:
defined on Pg. 355 and implemented on Pg.
356





Constructing a Movie with no arguments creates
an unrated Movie.


















Test 83:
defined on Pg. 355 and implemented on Pg.
356





Add a single rating to an unrated movie. Asking
for the average rating answers the rating just added.


















Test 84:
defined on Pg. 355 and implemented on Pg.
357





Add several ratings: 3, 5, and 4. Asking for the
average rating answers 4.


















Test 85:
defined on Pg. 355 and implemented on Pg.
358





Add several ratings: 3, 5, 5, and 3. Asking for
the average rating answers 4.


















Test 86:
defined on Pg. 355 and implemented on Pg.
360





Writing movies uses for format: <name>
|
<category> | <total rating> | <number of ratings>.


















Test 87:
defined on Pg. 355 and implemented on Pg.
361





Reading movies uses for format: <name>
|
<category> | <total rating> | <number of ratings>.


















Test 88:
defined on Pg. 362 and
implemented on Pg. 362





A rating without a specified source should be
anonymous.


















Test 89:
defined on Pg. 362 and
implemented on Pg. 366





If we add a rating with a source to a movie, we
should be able to later retrieve the source associated with the
rating.


















Test 90:
defined on Pg. 370 and
implemented on Pg. 371





Writing an empty list outputs an empty <movielist> pair.


















Test 91:
defined on Pg. 370 and
implemented on Pg. 372





Writing a list containing one movie outputs in
the adopted XML format.


















Test 92:
defined on Pg. 370 and
implemented on Pg. 375





Writing a list containing one movie with
multiple ratings outputs in the adopted XML format.



















Test 93:
defined on Pg. 370 and
implemented on Pg. 375





Writing a list containing multiple movies
outputs in the adopted XML format.


















Test 94:
defined on Pg. 370 and
implemented on Pg. 379





Reading an empty <movielist> pair results in an empty list.


















Test 95:
defined on Pg. 370 and
implemented on Pg. 379





Reading an appropriate XML stream containing a
single movie definition results in a list containing the single
movie defined in the stream.


















Test 96:
defined on Pg. 370 and
implemented on Pg. 383





Reading an appropriate XML stream containing
more than one movie definition results in a list containing the
movies defined in the stream.


















Test 97:
defined on Pg. 390 and
implemented on Pg. 390





Telling the logical layer to select a movie and
add a rating to it, and providing specific rating value and source,
causes that rating to be added to the movie that was selected.


















Test 98:
defined on Pg. 390 and
implemented on Pg. 393





Selecting a movie, setting the rating value, and
source to specific values and pressing the "Add Rating" button
causes that rating to be added to the selected movie.


















Test 99:
defined on Pg. 397 and implemented on Pg.
398





A rating created without a review should answer
an empty string when asked for its review.


















Test 100:
defined on Pg. 397 and implemented on Pg.
399





A rating created with a review should answer
that string when asked for its review.


















Test 101:
defined on Pg. 400 and
implemented on Pg. 400





If a rating has an attached review, the review
is saved as the text of the <rating> element.


















Test 102:
defined on Pg. 401 and
implemented on Pg. 402





Reading an XML stream that contains text for a
rating element results in that rating having an attached
review.


















Test 103:
defined on Pg. 403 and
implemented on Pg. 403





Telling the logical layer that a rating is
selected that has no review results in the view being told to put
an empty string in the review field.


















Test 104:
defined on Pg. 403 and
implemented on Pg. 404





Telling the logical layer that a rating is
selected that has a review results in the view being told to put
the review string in the review field.


















Test 105:
defined on Pg. 407 and
implemented on Pg. 407





Selecting a rating that doesn't have a review
puts an empty string in the review field.


















Test 106:
defined on Pg. 407 and
implemented on Pg. 409





Telling the logical layer that a rating is
selected that has a review results in the view being told to put
the review string in the review field.































































Amazon






No comments: