package hw02;

import static org.junit.jupiter.api.Assertions.*;

import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;

class TestAccount {
	private Account acc;

	@BeforeEach
	void setUp() throws Exception {
		acc=new Account(new Money(1000.0),0.05);
	}

	@Test
	void testAccount() {
		assertEquals(1000.0,acc.getBalance().toDouble());
		assertEquals(0.05,acc.getInterest());
	}

	@Test
	void testDeposit() { 
		acc.deposit(new Money(250,0));
		assertEquals(1250.0,acc.getBalance().toDouble());
	}

	@Test
	void testAddInterest() { 
		acc.addInterest();
		assertEquals(1050.0,acc.getBalance().toDouble());
	}

	@Test
	void testWithdraw() { 
		acc.withdraw(new Money(350.0));
		assertEquals(650.0,acc.getBalance().toDouble());
	}

	@Test
	void testToString() { 
		assertEquals("Account balance=$1000.00 interest=0.05",acc.toString());
	}

}
