Stumpf.Alex
Nerd
Beiträge: 644
Registriert: 1. Okt 2007 12:40
Kontaktdaten:

I think the excerise doesn't points out which things we are allowed to change. There is only the "contract" to preserve the features. Should this mean we are free to change ALL (including the contracts) with respect to preserve these features and having a desgin which complies the modified contracts in the end?

best wishes

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

### Re: Homework 4, Task 4

Yes.

mazbu
Mausschubser
Beiträge: 44
Registriert: 23. Nov 2008 23:44

### Re: Homework 4, Task 4

Do I have to make all the test succed with the modified design? Because I don't think we can withdraw 60 from JuniorCheckingAccount.

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

### Re: Homework 4, Task 4

You have to ensure that all features offered by the different account types are meaningful tested. In the case of a JuniorCheckingAccount it is a good idea to check if a withdrawal of 60 results in an exception.

If this helps you: You are allowed to alter the tests or split them into multiple files.

Senchy
Windoof-User
Beiträge: 37
Registriert: 6. Okt 2010 19:14

### Re: Homework 4, Task 4

is this template correct?

Code: Alles auswählen

/**
* Sets the line of credit for this account.
*
* @see #close() for additional constraints.
*
* @REQUIRE balance >= -lineOfCredit
* @ENSURE newValue must be positive
*/
@Requires({ "getBalance() >= (-getLineOfCredit())" })
public void setLineOfCredit(final int newValue);
I would assume somthing like:

Code: Alles auswählen

/**
* Sets the line of credit for this account.
*
* @see #close() for additional constraints.
*
* @REQUIRE balance >= -lineOfCredit
* @REQUIRE newValue must be positive
*/
@Requires({ "getBalance() >= (-getLineOfCredit())","newValue > 0" })
public void setLineOfCredit(final int newValue);
best regards

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

### Re: Homework 4, Task 4

Yes, you are absolutely correct. You just found a perfect example of a rotten comment.