test_class.declarator: cleanupService
test_class.modifier: @Autowired
  	private
test_class.original_string: @Autowired
  	private CleanupService cleanupService;
test_class.type: CleanupService
test_class.var_name: cleanupService
test_class.declarator: bankService
test_class.modifier: @Autowired
  	private
test_class.original_string: @Autowired
  	private BankService bankService;
test_class.type: BankService
test_class.var_name: bankService
test_class.file: spring-ddd/spring-ddd-bank/src/test/java/de/beuth/knabe/spring_ddd_bank/domain/ClientTest.java
test_class.identifier: ClientTest
test_case.body: @Test
  	public void addAccountManager() {
  		// GIVEN:
  		final Client jack = bankService.createClient("jack", LocalDate.parse("1966-12-31"));
  		final Account jacksGiro = jack.createAccount("Jack's Giro").getAccount();
  		final Account jacksSavings = jack.createAccount("Jack's Savings").getAccount();
  		final Client chloe = bankService.createClient("chloe", LocalDate.parse("1992-12-01"));
  
  		// Client cannot transfer from an account, if she is not manager of the account:
  		try {
  			chloe.transfer(jacksGiro, jacksSavings.accountNo(), new Amount(0, 01));
  			fail("Client.WithoutRightExc expected");
  		} catch (Client.WithoutRightExc expected) {
  		}
  
  		// Client cannot add an account manager, if she is not owner of the account:
  		try {
  			chloe.addAccountManager(jacksGiro, chloe);
  			fail("Client.NotOwnerExc expected");
  		} catch (Client.NotOwnerExc expected) {
  		}
  
  		// WHEN:
  		jack.addAccountManager(jacksGiro, chloe);
  
  		// THEN:
  		// Now chloe can transfer from jacksGiro account:
  		chloe.transfer(jacksGiro, jacksSavings.accountNo(), new Amount(0, 01));
  
  		// But chloe is only manager of the account, not owner. She cannot add another
  		// Manager to the account.
  		final Client tony = bankService.createClient("tony", LocalDate.parse("1964-03-22"));
  		try {
  			chloe.addAccountManager(jacksGiro, tony);
  			fail("Client.NotOwnerExc expected");
  		} catch (Client.NotOwnerExc expected) {
  		}
  
  		// No client can be added twice as a manager to the same account:
  		try {
  			jack.addAccountManager(jacksGiro, chloe);
  			fail("Client.DoubleManagerExc expected");
  		} catch (Client.DoubleManagerExc expected) {
  		}
  	}
test_case.class_method_signature: ClientTest.addAccountManager()
test_case.full_signature: @Test public void addAccountManager()
test_case.identifier: addAccountManager
test_case.invocations: createClient parse getAccount createAccount getAccount createAccount createClient parse transfer accountNo fail addAccountManager fail addAccountManager transfer accountNo createClient parse addAccountManager fail addAccountManager fail
test_case.modifiers: @Test public
test_case.parameters: ()
test_case.return: void
test_case.signature: void addAccountManager()
focal_class.declarator: username
focal_class.modifier: private
focal_class.original_string: private String username;
focal_class.type: String
focal_class.var_name: username
focal_class.declarator: birthDate
focal_class.modifier: private
focal_class.original_string: private LocalDate birthDate;
focal_class.type: LocalDate
focal_class.var_name: birthDate
focal_class.declarator: accountAccessRepository
focal_class.modifier: @Autowired
  	private transient
focal_class.original_string: @Autowired
  	private transient AccountAccessRepository accountAccessRepository;
focal_class.type: AccountAccessRepository
focal_class.var_name: accountAccessRepository
focal_class.declarator: accountRepository
focal_class.modifier: @Autowired
  	private transient
focal_class.original_string: @Autowired
  	private transient AccountRepository accountRepository;
focal_class.type: AccountRepository
focal_class.var_name: accountRepository
focal_class.file: spring-ddd/spring-ddd-bank/src/main/java/de/beuth/knabe/spring_ddd_bank/domain/Client.java
focal_class.identifier: Client
focal_class.class_method_signature: Client.Client()
focal_class.full_signature: @SuppressWarnings("unused") private  Client()
focal_class.identifier: Client
focal_class.modifiers: @SuppressWarnings("unused") private
focal_class.parameters: ()
focal_class.signature:  Client()
focal_class.class_method_signature: Client.Client(final String username, final LocalDate birthDate)
focal_class.full_signature: public  Client(final String username, final LocalDate birthDate)
focal_class.identifier: Client
focal_class.modifiers: public
focal_class.parameters: (final String username, final LocalDate birthDate)
focal_class.signature:  Client(final String username, final LocalDate birthDate)
focal_class.class_method_signature: Client.getUsername()
focal_class.full_signature: @Column(unique = true, nullable = false) public String getUsername()
focal_class.identifier: getUsername
focal_class.modifiers: @Column(unique = true, nullable = false) public
focal_class.parameters: ()
focal_class.return: String
focal_class.signature: String getUsername()
focal_class.class_method_signature: Client.getBirthDate()
focal_class.full_signature: public LocalDate getBirthDate()
focal_class.identifier: getBirthDate
focal_class.modifiers: public
focal_class.parameters: ()
focal_class.return: LocalDate
focal_class.signature: LocalDate getBirthDate()
focal_class.class_method_signature: Client.toString()
focal_class.full_signature: @Override public String toString()
focal_class.identifier: toString
focal_class.modifiers: @Override public
focal_class.parameters: ()
focal_class.return: String
focal_class.signature: String toString()
focal_class.class_method_signature: Client.createAccount(final String accountName)
focal_class.full_signature: public AccountAccess createAccount(final String accountName)
focal_class.identifier: createAccount
focal_class.modifiers: public
focal_class.parameters: (final String accountName)
focal_class.return: AccountAccess
focal_class.signature: AccountAccess createAccount(final String accountName)
focal_class.class_method_signature: Client.deposit(final AccountNo destination, final Amount amount)
focal_class.full_signature: public void deposit(final AccountNo destination, final Amount amount)
focal_class.identifier: deposit
focal_class.modifiers: public
focal_class.parameters: (final AccountNo destination, final Amount amount)
focal_class.return: void
focal_class.signature: void deposit(final AccountNo destination, final Amount amount)
focal_class.class_method_signature: Client.transfer(final Account source, final AccountNo destination, final Amount amount)
focal_class.full_signature: public void transfer(final Account source, final AccountNo destination, final Amount amount)
focal_class.identifier: transfer
focal_class.modifiers: public
focal_class.parameters: (final Account source, final AccountNo destination, final Amount amount)
focal_class.return: void
focal_class.signature: void transfer(final Account source, final AccountNo destination, final Amount amount)
focal_class.class_method_signature: Client._findDestinationAccount(final AccountNo destination)
focal_class.full_signature: private Account _findDestinationAccount(final AccountNo destination)
focal_class.identifier: _findDestinationAccount
focal_class.modifiers: private
focal_class.parameters: (final AccountNo destination)
focal_class.return: Account
focal_class.signature: Account _findDestinationAccount(final AccountNo destination)
focal_class.class_method_signature: Client.addAccountManager(final Account account, Client manager)
focal_class.full_signature: public AccountAccess addAccountManager(final Account account, Client manager)
focal_class.identifier: addAccountManager
focal_class.modifiers: public
focal_class.parameters: (final Account account, Client manager)
focal_class.return: AccountAccess
focal_class.signature: AccountAccess addAccountManager(final Account account, Client manager)
focal_class.class_method_signature: Client.findMyAccount(final AccountNo accountNo)
focal_class.full_signature: public Account findMyAccount(final AccountNo accountNo)
focal_class.identifier: findMyAccount
focal_class.modifiers: public
focal_class.parameters: (final AccountNo accountNo)
focal_class.return: Account
focal_class.signature: Account findMyAccount(final AccountNo accountNo)
focal_class.class_method_signature: Client.accountsReport()
focal_class.full_signature: public String accountsReport()
focal_class.identifier: accountsReport
focal_class.modifiers: public
focal_class.parameters: ()
focal_class.return: String
focal_class.signature: String accountsReport()
focal_class.superclass: extends EntityBase<Client>
focal_method.body: public AccountAccess addAccountManager(final Account account, Client manager) {
  		final Optional<AccountAccess> ownerAccessOptional = accountAccessRepository.find(this, account);
  		if (!ownerAccessOptional.isPresent()) {
  			throw create(NotOwnerExc.class, this.username, account.accountNo());
  		}
  		final AccountAccess ownerAccess = ownerAccessOptional.get();
  		if (!ownerAccess.isOwner()) {
  			throw create(NotOwnerExc.class, this.username, account.accountNo());
  		}
  		final Optional<AccountAccess> managerAccessOptional = accountAccessRepository.find(manager, account);
  		if (managerAccessOptional.isPresent()) {
  			throw create(DoubleManagerExc.class, manager.username, account.accountNo());
  		}
  		final AccountAccess managerAccountAccess = new AccountAccess(manager, false, account);
  		return accountAccessRepository.save(managerAccountAccess);
  	}
focal_method.class_method_signature: Client.addAccountManager(final Account account, Client manager)
focal_method.full_signature: public AccountAccess addAccountManager(final Account account, Client manager)
focal_method.identifier: addAccountManager
focal_method.invocations: find isPresent create accountNo get isOwner create accountNo find isPresent create accountNo save
focal_method.modifiers: public
focal_method.parameters: (final Account account, Client manager)
focal_method.return: AccountAccess
focal_method.signature: AccountAccess addAccountManager(final Account account, Client manager)