Versions Compared

Key

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

...

Graph tests

GraphServiceTest class


Name

Expected result

Parameters

Actual result

SuccessComments
1getAllGraphs()

Returns a GraphsDTO with the following information.

GraphsDTO{

name = "test"

tabID =  1

id = 1

}


Returns the expected list of DTOs.YesThe 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.
2addGraph()Throws a DatabaseException.

tabID = 1

graphID = 1

graphType = "linechart"

A DatabaseException is thrown.YesThe return value cannot be tested, since this method returns a void. That is why the Exception is checked, instead of a return value.
3deleteGraphs()Throws a DatabaseException.

tabID = 1

graphID = 1

A DatabaseException is thrown.YesThe 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

SuccessComments
1addGraphTest()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

1getGraphs()All graphs with tabID are shown.tabID = 1All graphs with the given tabID, are returned to the user.Yes
2getUserTabsSqlException()A databaseException will be thrown after a SQLException. tabID = 1A SQLException is thrown.Yes
3addGraphsTestSqlException()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

SuccessComments
1getUserTabsCorrectly()All tabs from the user.username = 'Erik'All graphs are returned to the user.Yes
2getUserTabsSqlException()A databaseException will be thrown after a SQLException. username = 'Erik'A SQLException is thrown.YesWrong exception is thrown.

...