package com.accenture.multibank.dao;

import static org.junit.Assert.assertEquals;

import java.util.HashMap;
import java.util.Map;

import org.junit.Test;

import com.accenture.multibank.accounts.AbstractAccount;
import com.accenture.multibank.accounts.SavingAccount;

public class TestHashMapAccountDao {

	Map map = new HashMap();
	AbstractAccount acc = new SavingAccount();

	// zu testen: AccountImpl
	AccountDaoImpl accDao = new AccountDaoImpl();


	@Test
	public void testSafeAndFindAccount() {
		
		accDao.save(acc);
		
		accDao.find(acc.getAccountNumber());
		
		assertEquals(2, acc.getAccountNumber());
		assertEquals(100, acc.getBalance());
		

	}


}

@@ -83,449 +83,797 @@
 s;%0D%0A
-%0D%0A
 import 
-java.util.HashMap;%0D%0Aimport java.util.Map;%0D%0A%0D%0Aimport org.junit.Test;%0D%0A%0D%0Aimport com.accenture.multibank.accounts.AbstractAccount;%0D%0Aimport com.accenture.multibank.accounts.SavingAccount;%0D%0A%0D%0Apublic class TestHashMapAccountDao %7B%0D%0A%0D%0A%09Map map = new HashMap();%0D%0A%09AbstractAccount acc = new SavingAccount();%0D%0A%0D%0A%09// zu testen: AccountImpl%0D%0A%09AccountDaoImpl accDao = new AccountDaoImpl();%0D%0A%0D%0A%0D%0A%09@Test%0D%0A%09public void testSafeAndFindAccount() %7B%0D%0A%09%09
+static org.mockito.Mockito.when;%0D%0A%0D%0Aimport com.accenture.multibank.accounts.AccountReadable;%0D%0Aimport com.accenture.multibank.generator.AccountNumberGenerator;%0D%0Aimport org.junit.Before;%0D%0Aimport org.junit.Test;%0D%0A%0D%0Aimport com.accenture.multibank.accounts.SavingAccount;%0D%0Aimport org.mockito.Mock;%0D%0Aimport org.mockito.Mockito;%0D%0A%0D%0Apublic class TestHashMapAccountDao %7B%0D%0A%0D%0A%09AbstractDAO%3CInteger, AccountReadable%3E accDao;%0D%0A%0D%0A%09@Mock%0D%0A%09AccountNumberGenerator generator;%0D%0A%0D%0A%09@Before%0D%0A%09public void setup() %7B%0D%0A%09%09accDao = new AccountDaoImpl();%0D%0A%09%09generator = Mockito.mock(AccountNumberGenerator.class);%0D%0A%09%7D%0D%0A%0D%0A%09@Test%0D%0A%09public void testSafeAndFindAccount() %7B%0D%0A%09%09int accNr = 1;%0D%0A%09%09when(generator.generateAccountNumber()).thenReturn(++accNr);%0D%0A%09%09AccountReadable actual = new SavingAccount(accNr, 100);
 %0D%0A%09%09
@@ -890,19 +890,47 @@
 e(ac
-c
+tual
 );%0D%0A
-%09%09
 %0D%0A%09%09
+AccountReadable expected = 
 accD
@@ -939,17 +939,20 @@
 .find(ac
-c
+tual
 .getAcco
@@ -966,18 +966,16 @@
 er());%0D%0A
-%09%09
 %0D%0A%09%09asse
@@ -987,14 +987,16 @@
 als(
-2, acc
+expected
 .get
@@ -1014,56 +1014,37 @@
 er()
-);%0D%0A%09%09assertEquals(100, acc.getBalance());%0D%0A%09%09%0D%0A
+, actual.getAccountNumber());
 %0D%0A%09%7D

add test case (safe and find)