FiAccount extends OrmActiveRecord<FiAccount> { public static FiAccount load(final OrmRepository rep, String accountId, String category, String currency) { return rep.tmpl().load("from FiAccount a where a.accountId=?1 and a.category=?2 and a.currency=?3", accountId, category, currency); }  static FiAccount load(final OrmRepository rep, String accountId, String category, String currency);  }
@Test public void 金融機関口座を取得する() { tx(() -> { assertThat(FiAccount.load(rep, "normal", "sample", "JPY"), allOf( hasProperty("accountId", is("normal")), hasProperty("category", is("sample")), hasProperty("currency", is("JPY")), hasProperty("fiCode", is("sample-JPY")), hasProperty("fiAccountId", is("FInormal")))); try { FiAccount.load(rep, "normal", "sample", "USD"); fail(); } catch (ValidationException e) { assertThat(e.getMessage(), is(ErrorKeys.EntityNotFound)); } }