Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

The token usernameErik is defined as "eyJhbGciOiAiSFMyNTYiLCAidHlwIjogIkpXVCJ9.ewogICAgIm5hbWUiOiAiRXJpayIKfQ==.2d2c39f777b16f75c701e851e9ec20d45f4134a281155e0c6f909876228d7d80".

DAO Response

The response from the database is set manually, because testing is not a valid reason to change data in the database. Whenever a call is made to the DAO, the response will be set manually aswell, to prevent the test from testing more than one class.

...

Table 14: Tests in SensorWithGraphResourceTest

SensorWithGraphDAOTest


Name

Expected result

Parameters

Actual result

SuccessComments
1getSensorLinkedWithGraphsCorrectly()

Expect a result that is not null.


Returns something that is not null.Yes
2
getUserTabsSQLException()

Throws a SQLException that in return throws a DatabaseException.


A DatabaseException is thrown.Yes

Table 15: Tests in SensorWithGraphDAOTest

GaugeGraphSettings tests

SensorSettingsResourceTest


Name

Expected result

Parameters

Actual result

SuccessComments
1getSettingsWithGoodJWT()A 200 response code.token = usernameErik
sensor = "Oil temperature"
Returns a 200 response code, which means that the response is OK.Yes
2getSettingsWithWithWrongJWT()A 403 response code.token = "WrongToken"
sensor = "Oil temperature"
Returns a 403 response code, which means it was a FORBIDDEN request.Yes

Table 16: Tests in SensorSettingsResourceTest

GaugeGraphSettingsDAOTest


Name

Expected result

Parameters

Actual result

SuccessComments
1getSensorSettingsForGauge()

Expect a result that is not null.


Returns something that is not null.Yes
2
getSensorSettingsForLinechart()

Expect a result that is not null.


A DatabaseException is thrown.Yes
3getSensorSettingsForGaugeException()Throws a SQLException that in return throws a DatabaseException.
A DatabaseException is thrown.Yes

Table 17: Tests in GaugeGraphSettingsDAOTest

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.

...