| Test Number | Reason Tested | Method / Data Used | Expected Result | Actual Result | Correct |
|---|---|---|---|---|---|
Media Class <Abstract> |
|||||
| 1.1 | Test if can create a Object that is inherited from the Media Class |
Create the following objects:
|
Objects are created | As Expected | Yes |
| 1.2 | Test if can change the Title of a Media Object/td> |
Create a Object of type Media with a title and then change it First Title: "Old Title" Second Title: "New Title" |
Title of the Media changes. | As Expected | Yes |
| 1.3 | Test if an error is thrown if a Null reference is passed to the method setTitle(String title) |
Create a Object of type Media. Pass a Null reference to the setTitle(String title) method. |
A NullPointerException is thrown. | java.lang.NullPointerException: Title cannot be of Null Reference | Yes |
| 1.4 | Test if can assign a picture to the Media |
Create a Object of type Media. Call the method setPictureFile(File pictureFile) with the arguments of a picture file Retrieve the picture file with the getPicture() method. |
The picture file can be set and retrieved without any errors. | As Expected | Yes |
| 1.5 | Test if can assign a Null reference as a picture file to a Media without errors. |
Create a Object of type Media. Call the method setPictureFile(File pictureFile) with the arguments of a Null reference Retrieve the picture file with the getPicture() method. |
No errors will result from handling a Null reference. | As Expected | Yes |
| 1.6 | Test if the Media Object properly implements Serializable and can be saved to a file |
Create a Object of type Media. Save the object to a file and then reload it. |
Object can be saved and retrieved from a file. | As Expected | Yes |
Movie Class <Abstract> |
|||||
| 2.1 | Test if can create a Object that is inherited from the Movie Class |
Create the following objects:
|
Objects are created | As Expected | Yes |
| 2.2 | Test if the correct toString() is called for a Movie Object | Create a Object of type Movie with the title of "New Movie" br> Call the toString() method. | Correct output is displayed | As Expected | Yes |
| 2.3 | Test if a correct Runtime can be assigned to a movie. | Create a Object of type Movie. br> Call the setRuntime(int runtime) method and give the movie a time of 120 minutes. | The Runtime is set correctly. | As Expected | Yes |
| 2.4 | Test if an error is thrown if an invalid Runtime is passed to the method setRuntime(int runtime) | Create a Object of type Movie. br> Call the setRuntime(int runtime) method and give the movie a time of -10 minutes. | A IllegalArgumentException is thrown | java.lang.IllegalArgumentException: Runtime must be greater or equal to 0 | Yes |
Music Class <Abstract> |
|||||
| 3.1 | Test if can create a Object that is inherited from the Music Class |
Create the following objects:
|
Objects are created | As Expected | Yes |
| 3.2 | Test if the correct toString() is called for a Music Object | Create a Object of type Music with the title of "New Music" and Artist of "New Artist" br> Call the toString() method. | Correct output is displayed | As Expected | Yes |
| 3.3 | Test if the Artist can be set with the method setArtist(String artist). | Create a Object of type Music with the title of "Test Music" and Artist of "Old Artist" br> Call the setArtist(String artist) method with the Artist name of "New Artist". | The Artist name is changed. | As Expected | Yes |
| 3.4 | Test if an error is thrown if a Null reference is passed to the method setArtist(String artist) |
Create a Object of type Music. Pass a Null reference to the setArtist(String artist) method. |
A NullPointerException is thrown. | java.lang.NullPointerException: Artist cannot be of Null Reference | Yes |
CD Class |
|||||
| 4.1 | Test if can create a CD Object |
StockNo: 10 Title: 10,000 Days Artist: Tool |
CD object is created with all the correct information | As Expected | Yes |
| 4.2 | Test if the correct information is displayed with the mediaType() and the getMediaTypeStr() | - | The number 2 is returned from mediaType() and the String "CD" for getMediaTypeStr() | As Expected | Yes |
DVD Class |
|||||
| 5.1 | Test if can create a DVD Object |
StockNo: 10 Title: Fight Club Runtime: 133 |
DVD object is created with all the correct information | As Expected | Yes |
| 5.2 | Test if the correct information is displayed with the mediaType() and the getMediaTypeStr() | - | The number 4 is returned from mediaType() and the String "DVD" for getMediaTypeStr() | As Expected | Yes |
Record Class |
|||||
| 6.1 | Test if can create a Record Object |
StockNo: 10 Title: Where are you Moriarty? Artist: The Goon Show Type: Record.Album |
Record object is created with all the correct information | As Expected | Yes |
| 6.2 | Test if the correct information is displayed with the mediaType() and the getMediaTypeStr() | - | The number 3 is returned from mediaType() and the String "Record" for getMediaTypeStr() | As Expected | Yes |
| 6.3 | Test if different types of Records can be set |
Create three different Record Objects. Try and set each Record to a different type of record ie Record.ALBUM, Record.EP and Record.SINGLE |
Records are changed to different Record types | As Expected | Yes |
| 6.4 | Test if an Error is thrown if an invalid Record type is sent to the method setTypeOfRecord(int typeOfRecord) |
Create a Record Object Pass the invalid types -1 and 3 to the method setTypeOfRecord(int typeOfRecord). |
An IllegalArgument Exception is thrown both times. | IllegalArgumentException: Invalid Type of Record entered | Yes |
Video Class |
|||||
| 7.1 | Test if can create a Video Object |
StockNo: 10 Title: The Shining Runtime: 115 |
Video object is created with all the correct information | As Expected | Yes |
| 7.2 | Test if the correct information is displayed with the mediaType() and the getMediaTypeStr() | - | The number 5 is returned from mediaType() and the String "Video" for getMediaTypeStr() | As Expected | Yes |
Store Class |
|||||
| 8.1 | Test if can create a Store Object | - | A Store object is successfully created | As Expected Created a toString() method to aid display. |
Yes |
| 8.2 | Test if the fundamental method isStockNumberPresent(int stockNumber) works |
Add a CD with a Stock number 1 to the store Test if the Stock number 1 and 2 exists in the store |
Stock Number 1 will return True. Stock Number 2 will return False. | As Expected | Yes |
| 8.3 | Test if different types of Media can be added to the Store |
Add a CD, DVD, Record and a Video to the store. Print out all the Media in the Store |
All Media is successfully added to the store and can be retrieved | As Expected | Yes |
| 8.4 | Test if an error is thrown if a Media item is added to the Store with the same stock number of one of the Media items already in the store. |
Add several pieces of Media to the store including a piece of Media with a Stock Number of
1 Try and add a DVD with a stock number of 1 |
A StoreException is thrown | StoreException: Stock Number 1 is already assigned to an item in the store | Yes |
| 8.5 | Test if a Media item can be removed from the Store. |
Add several pieces of Media to the Store including a piece of Media with a Stock Number of
1 Try and remove the Media item with the stock number of 1 |
The Media Item is removed | As Expected | Yes |
| 8.6 | Test if a exception is thrown if the method removeMedia(int stockNumber) is called with a Stock Number that does not exists. |
Add several pieces of Media to the Store. Try and remove the Media item with the stock number of 100 |
A StoreException is thrown | StoreException: Media for Stock Number 100 does not exist | Yes |
| 8.7 | Test if the method loadTXTFile(File inFile) can load Fran's products.txt file |
Create a Store Object and call loadTXTFile(File inFile) with Fran's
file as the prameter. Ensure that all products are read in properly. |
All data from Fran's file is loaded with the correct type, quantities and assigned a Stock Number |
1 - DVD - Sun Ra A Joyful Noise 2 - DVD - Sun Ra A Joyful Noise 3 - DVD - Sun Ra Space Is The Place 4 - DVD - Ghost Dog The Way of the Samurai 5 - DVD - Woman of the Year 6 - DVD - Woman of the Year 7 - DVD - Woman of the Year 8 - Video - All Apologies Kurt Cobain 9 - Video - All Apologies Kurt Cobain 10 - Video - All Apologies Kurt Cobain 11 - Video - All Apologies Kurt Cobain 12 - Video - All Apologies Kurt Cobain 13 - Video - All Apologies Kurt Cobain 14 - Video - All Apologies Kurt Cobain 15 - Video - Sun Ra A Joyful Noise 16 - Video - Sun Ra A Joyful Noise 17 - Video - Sun Ra A Joyful Noise 18 - Video - Sun Ra A Joyful Noise 19 - Video - Sun Ra A Joyful Noise 20 - Video - Screaming Fields of Sonic Youth 21 - Video - Screaming Fields of Sonic Youth 22 - Video - Screaming Fields of Sonic Youth 23 - Video - Screaming Fields of Sonic Youth 24 - Video - Screaming Fields of Sonic Youth 25 - Video - Screaming Fields of Sonic Youth 26 - Video - Screaming Fields of Sonic Youth 27 - CD - Strange Angels 28 - CD - Strange Angels 29 - CD - The Ugly One with the Jewels 30 - CD - The Ugly One with the Jewels 31 - CD - Sounds of the Satellites 32 - CD - Blastula 33 - CD - Dub Housing 34 - CD - Dub Housing 35 - CD - Dub Housing 36 - CD - Concerto Grosso 37 - CD - Concerto Grosso 38 - CD - Fun House 39 - Record - Big Science 40 - Record - Big Science 41 - Record - Strange Angels 42 - Record - Strange Angels 43 - Record - Softly 44 - Record - Softly 45 - Record - Softly 46 - Record - Softly 47 - Record - Softly 48 - Record - Softly 49 - Record - Softly 50 - Record - Softly 51 - Record - Softly 52 - Record - Softly 53 - Record - Softly 54 - Record - Softly 55 - Record - Softly 56 - Record - Softly 57 - Record - Softly 58 - Record - Softly 59 - Record - Softly 60 - Record - Softly 61 - Record - Softly 62 - Record - Softly 63 - Record - Just Like Honey 64 - Record - Just Like Honey 65 - Record - Just Like Honey 66 - Record - Just Like Honey 67 - Record - Just Like Honey 68 - Record - Just Like Honey 69 - Record - Just Like Honey 70 - Record - Just Like Honey 71 - Record - Just Like Honey |
|
| 8.8 | Test the result of a non existant file been passed to the loadTXTFile(File inFile) |
Create a Store Object and call loadTXTFile(File inFile) with the file
name nonExist.txt as the parameter |
A FileNotFoundException gets passed from the Store Object to the executing program where it will get caught in the catch block. |
In Catch Block java.io.FileNotFoundException: nonExistFile.txt (The system cannot find the file specified) Java Result: 1 |
Yes |
| 8.9 | Test if an exception is thrown if a Null reference is passed to the loadTXTFile(File inFile) method | Create a Store Object and call loadTXTFile(File inFile) inFile as a Null reference. | A StoreException is thrown. | StoreException: inFile cannot be a Null Reference | Yes |
| 8.10 | Test if the saveToObjectFile(File outFile, Store storeToSave) and loadFromObjectFile(File inFile) methods work correctly. |
|
Store object is sucessfully saved and reloaded. | As Expected. | Yes |
| 8.11 | Test if an exception is thrown if a file that does not exist is passed to the loadFromObjectFile(File inFile) method. | Try and load a Store Object with the file name of nonExist.sdb | A FileNotFoundException gets passed from the Store Object to the executing program where it will get caught in the catch block. |
In Catch Block java.io.FileNotFoundException: nonExist.sdb (The system cannot find the file specified) Java Result: 1 |
Yes |
| 8.12 | Test if an exception is thrown if the program tries to load a badly formatted file with the loadFromObjectFile(File inFile) method. | Try and load file that is not created by the program. In this case the html document Assignment 2 INT21OOP 2006.htm | A StoreException is thrown | StreamCorruptedException: invalid stream header | Unexpected |
| 8.13 | Test the result if a Null reference is passed to saveToObjectFile(File outFile, Store storeToSave) or loadFromObjectFile(File inFile) instead of a file. |
Try and load file with the loadFromObjectFile(File inFile) with inFile as a Null reference. Try and save a Store with data in it with the loadFromObjectFile(File inFile) with inFile as a Null reference. |
A StoreException is thrown in both cases. |
|
Yes |
| 8.14 | Test if the method getQuantity(String title) works correctly |
Load up Fran's textfile. Test the quantity of the following titles:
|
The correct Quantities are returned. |
Sun Ra A Joyful Noise: 7 Blastula: 1 Softly: 20 Just Like Honey: 9 SUN RA A JOYFUL NOISE: 7 This album does not exists: 0 Null Reference: 0 |
Yes |
| 8.15 | Test if the quantity changes depending if we add or remove media from the store. |
Create a empty Store Add ten pieces of media to the store with the same title and monitor the change in quantity. Remove the Media until the store is empty and monitor the change in quantity. |
The quantity changes correctly. |
Quantity did not decrease as expected. A variable was not referenced properly and went out of scope |
No (Fixed) |
MainFrame Class |
|||||
| 9.1 | Test if the Frame starts up and displays all elements correctly. | - | Frame starts, displays and enables all necessary controls and fields. | As Expected. | Yes |
| 9.2 | Test if the Frame starts in the correct state called EMPTY_MODE | - |
|
As Expected. | Yes |
| 9.3 | Test if the the Frame can Import Fran's file. |
Start Frame. Go to File -> Import -> Import from Fran's File Open up Fran's text file. |
File is imported without errors. Program is switched to NAV_MODE |
As Expected. | Yes |
| 9.4 | Test if the NAV_MODE state functions correctly. | Follow on from Test 9.3 |
|
As Expected. | Yes |
| 9.5 | Test if can Navigate through the Media with the Prev and Next button. |
Follow on from Test 9.3 Press the Next until the last record is reached. Press the Prev until the first record is reached. |
The Program can navigate through the Media correctly and disable the appropriate buttons if at the first and last record. | As Expected. | Yes |
| 9.6 | Test if the Media details displays correctly. |
Follow on from Test 9.5 Navigate to different types of Media |
|
As Expected. | Yes |
| 9.7 | Test if the Navigation Tree displays correctly and works. |
Follow on from Test 9.5 Navigate to different types of Media using the Navigation Tree |
|
As Expected. | Yes |
| 9.8 | Test if the Delete button works. |
Load up a Fran's file with only a few records in it. Delete all the records in the files observing if:
|
|
|
No (To be fixed) |
| 9.9 | Test if can change to the state ADD_MODE and exit it. |
Start with a blank Store Click the Add button Click the Cancel button to exit the Add mode. |
When click the Add button, appropriate buttons and fields are
enabled and disabled. When click Cancel the program returns to NAV_MODE. |
Some buttons were not enabling or displaying right when Cancel was clicked | No (Fixed) |
| 9.10 | Test if all types of Media can be added to the Store. |
Start with a blank Store
Add a CD with the details of
Add a DVD with the details of
Add a Record with the details of
Add a Video with the details of |
All Media is added successfully. | As Expected. | Yes |
| 9.11 | Test if the Program handles properly when a new piece of media is added with a conflicting Stock number. |
Follow on from Test 9.10 Try and add a CD with a Stock Number of 1. |
An Error message appears advising that the stock number is already used up. | As Expected. | Yes |
| 9.12 | Test if the Runtime field only accepts numbers. | Add a DVD and try and put the String "No a Number" in the Runtime field. | The value gets changed to 0. | As Expected. | Yes |
| 9.13 | Test if the Stock Number field only accepts numbers. | Add a DVD and try and put the String "No a Number" in the Stock Number field. |
The Add button gets disabled so the record cannot be added. The Add re-enables itself when a proper number is entered in. |
As Expected. | Yes |
| 9.14 | Test if different types of Records can be added to the Store. |
Start a new Store. Add three different types of Records: Record.ALBUM, Record.SINGLE and Record.EP. Navigate through the records to see if the types remain the same. |
The Records can get assigned a type and the Program remembers the types. | As Expected. | Yes |
| 9.15 | Test if can change to the state EDIT_MODE and exit it. |
Start a new Store and load some Media into the Store. Click the Edit button and then click the Cancel button to return to the NAV_MODE. |
When click the Edit button, appropriate buttons and fields are
enabled and disabled. When click Cancel the program returns to NAV_MODE. |
As Expected. | Yes |
| 9.16 | Test if non critical data can be changed. |
Start a new Store and load some Media into the Store. Edit fields like Runtime and Artist that will not conflict other parts of the system. |
When Update is clicked details are saved to the Store. The Navigation Tree is updated to reflect changes. |
As Expected. | Yes |
| 9.17 | Test to see if the Title can be changed in EDIT_MODE. |
Start a new Store and load some Media into the Store. Edit the Title field so it is the same Title as another Media in the Store. Eit the same piece of Media again and Change the Title field to different Title. |
When Update is clicked details are saved to the Store. The Quantity updates to reflect the changes. |
As Expected. | Yes |
| 9.18 | Test see if the Stock Number can be changed. |
Start a new Store and load some Media into the Store. Edit the Stock Number field so it reads a unique Stock Number. Click Update. |
The Stock Number is changed sucessfully. | As Expected. | Yes |
| 9.19 | Test see if the Stock Number cannot be changed if it conflicts with another Stock Number already in the store. |
Start a new Store and load some Media into the Store. Edit the Stock Number field so it reads a the Stock Number that lready exists in the Store. |
The Stock Number gets reverted to its origional number when it loses focus so it cannot conflict with another Stock Number. | As Expected. | Yes |
| 9.20 | Test see if can change the Picture in EDIT_MODE. |
Start a new Store and load some Media into the Store. Edit a record and try and change the Picture to a different file. |
The Picture is changed and re-displayed. | As Expected. | Yes |
| 9.21 | Test see if can remove the Picture in EDIT_MODE. |
Start a new Store and load some Media into the Store. Edit a record and give it a picture. Click Remove Picture button. |
The Picture is changed to the default image and re-displayed. | As Expected. | Yes |
| 9.22 | Test see if the Save and Load menu functions work. |
Start a new Store and import Fran's file. Save the database with File -> Save Database... Save to a file and close the Program. Restart the Program and load the file with File -> Open Existing Database... |
The database to save without any errors. The database to open and display correctly. |
Database did not display correctly after loading due to incorrect code placed
in a finally block. Navigation Tree did not refresh to the new data. |
No (Fixed) |