package com.accenture.multibank.generator;

import org.junit.Assert;
import org.junit.Before;
import org.junit.Test;

public class TestNumberGenerator {

	AccountNumberGenerator generator;

	@Before
	public void setup() {


	}

	@Test
	public void callGeneratorAndGetAcoountNumberSimple2() {
		generator = new AccountNumberGeneratorImplMock();
		int accNum = generator.generateAccountNumber();
		accNum = generator.generateAccountNumber();
		Assert.assertEquals(2, accNum);
	}

	@Test
	public void callGeneratorAndGetAcoountNumberSimple1() {
		generator = new AccountNumberGeneratorImplMock();
		int accNum = generator.generateAccountNumber();

		Assert.assertEquals(1, accNum);
	}
}

@@ -109,16 +109,110 @@
 it.Test;
+%0Aimport org.mockito.Mock;%0Aimport org.mockito.Mockito;%0A%0Aimport static org.mockito.Mockito.when;
 %0A%0Apublic
@@ -242,16 +242,24 @@
 tor %7B%0A%0A%09
+private 
 AccountN
@@ -318,17 +318,16 @@
 up() %7B%0A%0A
-%0A
 %09%7D%0A%0A%09@Te
@@ -346,301 +346,113 @@
 oid 
-callGeneratorAndGetAcoountNumberSimple2() %7B%0A%09%09generator = new AccountNumberGeneratorImplMock();%0A%09%09int accNum = generator.generateAccountNumber();%0A%09%09accNum = generator.generateAccountNumber();%0A%09%09Assert.assertEquals(2, accNum);%0A%09%7D%0A%0A%09@Test%0A%09public void callGeneratorAndGetAcoountNumberSimple1() %7B
+testSimpleAccountNumberGeneratorCount1() %7B%0A%09%09int startAccNr = 0, timesGenerated = 2, accNum = startAccNr;
 %0A%09%09g
@@ -466,16 +466,22 @@
 r = new 
+Simple
 AccountN
@@ -498,26 +498,67 @@
 ator
-ImplMock();%0A%09%09int 
+(startAccNr);%0A%09%09for (int i = timesGenerated; i %3E 0;--i)%0A%09%09%09
 accN
@@ -620,17 +620,41 @@
 tEquals(
-1
+startAccNr+timesGenerated
 , accNum
@@ -659,10 +659,11 @@
 um);%0A%09%7D%0A
+%0A
 %7D%0A

test SimpleAccountNumberGenerator