Seite 1 von 1

Ex06 Task 2

Verfasst: 10. Jun 2012 13:48
von jack_90
Hi,

i was wondering if we need to implement the Database interface with a concrete class, since the testcases a-c only depend on that.
Or should we just mock them and display a possible usage scenario.

Re: Ex06 Task 2

Verfasst: 11. Jun 2012 16:39
von pabloarias
This would interest me as well!
I would say you have to provide a concrete implementation of the database interface, instead of mocking it. It wouldn't make sense to mock the database, since the given testcases (a-c) test the function of database and testing a mocked class directly is nonsense.

Re: Ex06 Task 2

Verfasst: 11. Jun 2012 16:52
von sproksch
You should implement the database but you don't need to persist the data... so a very simple in-memory implementation is ok. While it is true that a+b are tests for the database, c is more a test of an Employee, isn't it?

Re: Ex06 Task 2

Verfasst: 11. Jun 2012 17:50
von pabloarias
yes it is ;)

Re: Ex06 Task 2

Verfasst: 12. Jun 2012 10:58
von DominikSchreiber
Are we allowed to alter the Database interface? (i.e. change

Code: Alles auswählen

int[] getAllEmployeeIds()
to

Code: Alles auswählen

List<Integer> getAllEmployeeIds()
or remove the id from the Employee as it could just be assigned by the database?)

edit:
are we allowed to check for existing ids in Database.add(Employee)?

Re: Ex06 Task 2

Verfasst: 12. Jun 2012 11:13
von sproksch
As always, you are allowed to apply every meaningful change that does not change the task. I see no problem to alter the DB interface in your case...