Versions Compared

Key

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

...

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

RaceServiceTest


Name

Expected result

Parameters

Actual result

SuccessComments
1getAllRaces()

Returns a RaceDTo with the following information.

RaceDTO{

raceID = 1

raceName = "BMW Race"

date = "2022-05-22"

}


Returns the expected RaceDTO.YesThe response from the database is set manually, because a connection to the real database is not safe in tests. The response is the same RaceDTO, to see if the getter works en returns the list from RaceDAO.

RaceResourceTest


Name

Expected result

Parameters

Actual result

SuccessComments
1getRacesWithGoodJWT()

A 200 response code.

token = usernameErik

Returns a 200 response code, which means that the response is OK.Yes
2returnsAllRaces()

Returns a list of DTO's. In this case we only put the following DTO inside the list.

RaceDTO{

raceID = 1

raceName = "BMW Race"

date = "2022-05-22"

}

token = usernameErikReturns
a
the expected list of DTO's. It does however, return it in
a object, but since it
an object type. It does return the same information as provided with the DTO, it still gives out a
succes
success.YesThe 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.
3getRacesWithBadJWT()A 403 response code.token = "WrongToken"Returns a 403 response code, which means it was a FORBIDDEN request.Yes

RaceDAOTest


Name

Expected result

Parameters

Actual result

SuccessComments
1getAllRaces()

A 200 response code.

token = usernameErik

Returns a 200 response code, which means that the response is OK.Yes






2
returnsAllRaces()

Returns a list of DTO's. In this case we only put the following DTO inside the list.

RaceDTO{

raceID = 1

raceName = "BMW Race"

date = "2022-05-22"

}

token = usernameErikReturns a the expected list of DTO's. It does return it in a object, but since it does return the same information as provided with the DTO, it still gives out a succes.YesThe 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.
getAllRacesSqlException()






3getRacesWithBadJWT()
A 403 response code.token = "WrongToken"Returns a 403 response code, which means it was a FORBIDDEN request.





4testDataAllRaces()
Yes