...
Name | Expected result | Parameters | Actual result | Success | Comments | |
---|---|---|---|---|---|---|
1 | getAllGraphs() | Returns a GraphsDTO with the following information. GraphsDTO{ | Returns the expected list of DTOs. | Yes | ||
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. The method can however be tested by the mockito.verify function. |
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. The method can however be tested by the mockito.verify function. |
...
Name | Expected result | Parameters | Actual result | Success | Comments | |
---|---|---|---|---|---|---|
1 | getAllTabsTest() | GraphsDTO{ name = "test" tabID = 1 id = 1 } | ||||
Table 4: Tests in TabServiceTest
...
Name | Expected result | Parameters | Actual result | Success | Comments | |
---|---|---|---|---|---|---|
1 | getTabsWithGoodJWT() | Returns a 200 status code back to the user. | token = usernameErik | Returns a 200 response code, which means that the response is OK. | Yes | |
2 | createTabTest() | Returns a 200 status code back to the user. | token = usernameErik | Returns a 200 response code, which means that the response is OK. | Yes | |
3 | deleteTabTestdeleteGraphTest() | Returns a 200 status code back to the user. | token WrongToken= usernameErik | Returns a 403 200 response code, which means it was a FORBIDDEN requestthat the response is OK. | Yes | |
4 | getTabsWithBadJWT() | Returns a 403 status code back to the user. | token = "WrongToken" | Returns a 403 status code back to the user. | Yes | |
5 | createTabTestBadJWT() | Returns a 403 status code back to the user. | token = "WrongToken" tabName = "testTab" raceID = 1 | Returns a 403 status code back to the user. | Yes | |
6 | deleteTabTestBadJWT() | Returns a 403 status code back to the user. | token = "WrongToken" tabID = 1 | Returns a 403 status code back to the user. | Yes |
Table 5: Tests in TabResourceTest
...
SensorWithGraph tests
SensorServiceTest
Name | Expected result | Parameters | Actual result | Success | Comments | |
---|---|---|---|---|---|---|
1 | getAllSensors() | Returns a list of DTO's. In this case we only put the following DTO inside the list. SensorWithGraphDTO{ | Returns the expected list of DTO's with the correct DTO inside the list. | Yes |
SensorWithGraphResourceTest
Name | Expected result | Parameters | Actual result | Success | Comments | |
---|---|---|---|---|---|---|
1 | getGraphDataWithGoodJWT() | A 200 response code. | token = usernameErik | Returns a 200 response code, which means that the response is OK. | Yes | |
2 | returnsAllSensors() | Returns a list of DTO's. In this case we only put the following SensorWithGraphDTO's inside the list. sensorDTO{ sensorDTO2{ | token = usernameErik | Returns the expected list of DTO's. It does however, return it in an object type. It does return the same information as provided with the DTO, it still gives out a success. | Yes | The response from the service is set manually. This is done to prevent the test from executing code beyond the resource. If this is not set manually, it would test the DAO, service class and the database, which is not necessary for this class. These tests are done in their own classes seperate from this class. |
3 | getGraphDataWithBadJWT() | A 403 response code. | token = "WrongToken" | Returns a 403 response code, which means it was a FORBIDDEN request. | Yes |
DtoTest
This class tests if the DTO's do not contain any logic and only getters and setters. The testPojoStructureAndBehavior() function executes this test. Pojo is a dependency that can be used for this kind of testing.