package com.accenture.multibank.generator;

import org.junit.Assert;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;

import java.util.HashSet;
import java.util.Set;

@RunWith(SpringJUnit4ClassRunner.class)
public class AccountNumberGeneratorTest {

	@Autowired
	private AccountNumberGeneratorDao generator;

	@Test
	public void createANumber() {
		int accountNumber = generator.save(new Account_Numbers()).getAccount_number();
		System.out.println(accountNumber);

	}

	@Test
	public void createMultipleNumbers() {
		Set<Integer> intSet = new HashSet<>();
		for (int i = 0; i < 1000; i++) {
			intSet.add(generator.save(new Account_Numbers()).getAccount_number());

		}
		Assert.assertEquals(1000, intSet.size());
	}

}

package com.accenture.multibank.generator;

import com.accenture.multibank.entities.AccountNumbers;
import org.junit.Assert;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;

@RunWith(SpringJUnit4ClassRunner.class)
public class AccountNumberGeneratorTest {

	@Autowired
	private AccountNumberGeneratorDao accountNumberGeneratorDao;

	@Test
	public void createANumber() {
		AccountNumbers accountNumbers = new AccountNumbers();
		accountNumbers = accountNumberGeneratorDao.save(accountNumbers);
		int actual = accountNumbers.getAccount_number(),
				expected = 1;
		Assert.assertEquals(expected, actual);
	}

	@Test
	public void createMultipleNumbers() {
		AccountNumbers actual = new AccountNumbers();
		int expected = 1000;
		for(int i = 0; i < expected; ++i) {
			actual = accountNumberGeneratorDao.save(new AccountNumbers());
		}
		Assert.assertEquals(expected, actual.getAccount_number());
	}
}
change test