...
Graph tests
GraphServiceTest class
Name | Expected result | Parameters | Actual result | Success | Comments | |
---|---|---|---|---|---|---|
1 | getAllGraphs() | Returns a GraphsDTO with the following information. GraphsDTO{ name = "test" tabID = 1 id = 1 } | Returns the expected list of DTOs. | Yes | The response from the DAO is set manually, because a connection to the real database is not safe in tests. The response is the same GraphsDTO, to see if the getter works en returns the list from GraphDAO. | |
2 | addGraph() | Throws a DatabaseException. | tabID = 1 graphID = 1 graphType = "linechart" | A DatabaseException is thrown. | Yes | The return value cannot be tested, since this method returns a void. That is why the Exception is checked, instead of a return value. |
3 | deleteGraphs() | Throws a DatabaseException. | tabID = 1 graphID = 1 | A DatabaseException is thrown. | Yes | The return value cannot be tested, since this method returns a void. That is why the Exception is checked, instead of a return value. |
GraphResourceTest class
Name | Expected result | Parameters | Actual result | Success | Comments | |
---|---|---|---|---|---|---|
1 | addGraphTest() | Returns a 200 status code back to the user. | tabID = 1 graphID = 1 graphType = "line" | Returns a 200 response code, which means that the response is OK. | Yes | |
2 | deleteGraphTest() | Returns a 200 status code back to the user. | Returns a 200 response code, which means that the response is OK. | Yes (see comments) | This method does work, but doesn't test if it works with a wrong input given. This is because the thrown exception gets mapped by the mapper with the Provider annotation. This test strictly tests if the mapper does return the 403 code given by the user. |
GraphDAOTest class
Name | Expected result | Parameters | Actual result | Success | Comments | |
---|---|---|---|---|---|---|
1 | getGraphs() | All graphs with tabID are shown. | tabID = 1 | All graphs with the given tabID, are returned to the user. | Yes | |
2 | getUserTabsSqlException() | A databaseException will be thrown after a SQLException. | tabID = 1 | A SQLException is thrown. | Yes | |
3 | addGraphsTestSqlException() | A databaseException will be thrown after a SQLException. | tabID = 1 graphID = 1 graphType = "Linechart" | A SQLException is thrown. | Yes |
Table 1: Tests in GraphDAOTest
Tab tests
TabDAOTest class
Name | Expected result | Parameters | Actual result | Success | Comments | |
---|---|---|---|---|---|---|
1 | getUserTabsCorrectly() | All tabs from the user. | username = 'Erik' | All graphs are returned to the user. | Yes | |
2 | getUserTabsSqlException() | A databaseException will be thrown after a SQLException. | username = 'Erik' | A SQLException is thrown. | Yes | Wrong exception is thrown. |
...