## Ex06 Task 2

jack_90
Mausschubser
Beiträge: 75
Registriert: 29. Sep 2009 22:38
Kontaktdaten:

### Ex06 Task 2

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.
EiSE Tutor WS 12/13

pabloarias
Erstie
Beiträge: 15
Registriert: 1. Okt 2009 09:05

### Re: Ex06 Task 2

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.

sproksch
Computerversteher
Beiträge: 346
Registriert: 15. Apr 2004 17:56

### Re: Ex06 Task 2

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?

pabloarias
Erstie
Beiträge: 15
Registriert: 1. Okt 2009 09:05

### Re: Ex06 Task 2

yes it is

DominikSchreiber
Windoof-User
Beiträge: 37
Registriert: 28. Sep 2009 16:03

### Re: Ex06 Task 2

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)?
Wer im Schlachthaus sitzt, sollte nicht mit Schweinen werfen.

sproksch
Computerversteher
Beiträge: 346
Registriert: 15. Apr 2004 17:56

### Re: Ex06 Task 2

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...