@Test public void testRegisterAccount_New_Account_With_Empty_Key_Failed() { Assertions .assertThatThrownBy(() -> this.accountManager.registerAccount(null, null)) .isInstanceOf(IllegalKeyException.class) .hasMessage("DLT type is not found"); }
void registerAccount(String dlt, Account account) throws IllegalKeyException, EmptyAccountException { if (null == dlt) { throw new IllegalKeyException(); } else if (null == account) { throw new EmptyAccountException(); } if (null == this.accountMap) { this.accountMap = new HashMap<>(); } this.accountMap.put(dlt, account); }
AccountManager { void registerAccount(String dlt, Account account) throws IllegalKeyException, EmptyAccountException { if (null == dlt) { throw new IllegalKeyException(); } else if (null == account) { throw new EmptyAccountException(); } if (null == this.accountMap) { this.accountMap = new HashMap<>(); } this.accountMap.put(dlt, account); } }
AccountManager { void registerAccount(String dlt, Account account) throws IllegalKeyException, EmptyAccountException { if (null == dlt) { throw new IllegalKeyException(); } else if (null == account) { throw new EmptyAccountException(); } if (null == this.accountMap) { this.accountMap = new HashMap<>(); } this.accountMap.put(dlt, account); } private  AccountManager(); }
AccountManager { void registerAccount(String dlt, Account account) throws IllegalKeyException, EmptyAccountException { if (null == dlt) { throw new IllegalKeyException(); } else if (null == account) { throw new EmptyAccountException(); } if (null == this.accountMap) { this.accountMap = new HashMap<>(); } this.accountMap.put(dlt, account); } private  AccountManager();  }
AccountManager { void registerAccount(String dlt, Account account) throws IllegalKeyException, EmptyAccountException { if (null == dlt) { throw new IllegalKeyException(); } else if (null == account) { throw new EmptyAccountException(); } if (null == this.accountMap) { this.accountMap = new HashMap<>(); } this.accountMap.put(dlt, account); } private  AccountManager();   }