Skip to content
Snippets Groups Projects
Commit 58e5f65f authored by surkat's avatar surkat
Browse files

created a new branch for login

parent 275dea65
No related branches found
No related tags found
No related merge requests found
Pipeline #198214 passed
package no.ntnu.idatt1002.demo.data;
public class Account {
private String name;
private double balance;
public Account(final String name) {
this.name = name;
}
public boolean deposit(double amount) {
if(amount > 0) {
balance += amount;
return true;
} else {
return false;
}
}
}
package no.ntnu.idatt1002.demo.data;
import org.junit.jupiter.api.Test;
import static org.junit.jupiter.api.Assertions.assertFalse;
import static org.junit.jupiter.api.Assertions.assertTrue;
public class AcoountTest {
@Test
public void testThatAccountDepositSucceed() {
Account account = new Account("demosinkonto");
assertTrue(account.deposit(100))
;
}
@Test
public void testThatAccountDepositFeil() {
Account account = new Account("demosinkonto");
assertFalse(account.deposit(-100))
;
}
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment