public void test_batchInsert_unique_constraint_OriginalException() { // ## Arrange ## List<Member> memberList = new ArrayList<Member>(); { Member member = new Member(); member.setMemberName("testName1"); member.setMemberAccount("testAccount1"); member.setMemberStatusCode_Formalized(); // 正式会員 memberList.add(member); } { Member member = new Member(); member.setMemberName("testName2"); member.setMemberAccount("testAccount2"); member.setMemberStatusCode_Formalized(); // 正式会員 memberList.add(member); } // ## Act & Assert ## memberBhv.batchInsert(memberList); try { memberBhv.batchInsert(memberList); fail(); } catch (EntityAlreadyExistsException e) { SQLException cause = e.getSQLException(); log(e.getMessage()); log("/* * * * * * * * * * * * * * * * *"); log("SQLState=" + cause.getSQLState() + ", ErrorCode=" + cause.getErrorCode()); log("* * * * * * * * * */"); assertEquals(MY_SQLSTATE, cause.getSQLState()); assertEquals(MY_ERRORCODE, cause.getErrorCode()); } }
public void test_batchUpdateNonstrict_unique_constraint_OriginalException() { // ## Arrange ## List<Member> memberList = new ArrayList<Member>(); { Member member = memberBhv.selectByPKValueWithDeletedCheck(memberIdTwo); member.setMemberAccount("AAA"); memberList.add(member); } { Member member = memberBhv.selectByPKValueWithDeletedCheck(memberIdThree); member.setMemberAccount("Pixy"); memberList.add(member); } // ## Act & Assert ## try { memberBhv.batchUpdateNonstrict(memberList); fail(); } catch (EntityAlreadyExistsException e) { SQLException cause = e.getSQLException(); log(e.getMessage()); log("/* * * * * * * * * * * * * * * * *"); log("SQLState=" + cause.getSQLState() + ", ErrorCode=" + cause.getErrorCode()); log("* * * * * * * * * */"); assertEquals(MY_SQLSTATE, cause.getSQLState()); assertEquals(MY_ERRORCODE, cause.getErrorCode()); } }
public void test_updateNonstrict_unique_constraint_OriginalException() { // ## Arrange ## Member member = new Member(); member.setMemberId(memberIdThree); member.setMemberAccount("Pixy"); // ## Act & Assert ## try { memberBhv.updateNonstrict(member); fail(); } catch (EntityAlreadyExistsException e) { SQLException cause = e.getSQLException(); log(e.getMessage()); log("/* * * * * * * * * * * * * * * * *"); log("SQLState=" + cause.getSQLState() + ", ErrorCode=" + cause.getErrorCode()); log("* * * * * * * * * */"); assertEquals(MY_SQLSTATE, cause.getSQLState()); assertEquals(MY_ERRORCODE, cause.getErrorCode()); } }
public void test_queryUpdate_unique_constraint_OriginalException() { // ## Arrange ## Member member = new Member(); member.setMemberAccount("Pixy"); MemberCB cb = new MemberCB(); cb.query().setMemberName_PrefixSearch("S"); // ## Act & Assert ## try { memberBhv.queryUpdate(member, cb); fail(); } catch (EntityAlreadyExistsException e) { SQLException cause = e.getSQLException(); log(e.getMessage()); log("/* * * * * * * * * * * * * * * * *"); log("SQLState=" + cause.getSQLState() + ", ErrorCode=" + cause.getErrorCode()); log("* * * * * * * * * */"); assertEquals(MY_SQLSTATE, cause.getSQLState()); assertEquals(MY_ERRORCODE, cause.getErrorCode()); } }