Java 类java.sql.SQLIntegrityConstraintViolationException 实例源码

项目:rotabuilder    文件:EmployeeMenu_IntegTest.java   
@Test
public void whenAlreadyExists() throws Exception {

    // given
    FixtureScript fs = new EmployeeTearDown();
    fixtureScripts.runFixtureScript(fs, null);
    transactionService.nextTransaction();
    wrap(menu).create("Faz", "123", null);
    transactionService.nextTransaction();

    // then
    expectedExceptions.expectCause(causalChainContains(SQLIntegrityConstraintViolationException.class));

    // when
    wrap(menu).create("Faz", "123", null);
    transactionService.nextTransaction();
}
项目:jdk8u-jdk    文件:SQLIntegrityConstraintViolationExceptionTests.java   
/**
 * Validate that the ordering of the returned Exceptions is correct
 * using for-each loop
 */
@Test
public void test11() {
    SQLIntegrityConstraintViolationException ex =
            new SQLIntegrityConstraintViolationException("Exception 1", t1);
    SQLIntegrityConstraintViolationException ex1 =
            new SQLIntegrityConstraintViolationException("Exception 2");
    SQLIntegrityConstraintViolationException ex2 =
            new SQLIntegrityConstraintViolationException("Exception 3", t2);
    ex.setNextException(ex1);
    ex.setNextException(ex2);
    int num = 0;
    for (Throwable e : ex) {
        assertTrue(msgs[num++].equals(e.getMessage()));
    }
}
项目:jdk8u-jdk    文件:SQLIntegrityConstraintViolationExceptionTests.java   
/**
 * Validate that the ordering of the returned Exceptions is correct
 * using traditional while loop
 */
@Test
public void test12() {
    SQLIntegrityConstraintViolationException ex =
            new SQLIntegrityConstraintViolationException("Exception 1", t1);
    SQLIntegrityConstraintViolationException ex1 =
            new SQLIntegrityConstraintViolationException("Exception 2");
    SQLIntegrityConstraintViolationException ex2 =
            new SQLIntegrityConstraintViolationException("Exception 3", t2);
    ex.setNextException(ex1);
    ex.setNextException(ex2);
    int num = 0;
    SQLException sqe = ex;
    while (sqe != null) {
        assertTrue(msgs[num++].equals(sqe.getMessage()));
        Throwable c = sqe.getCause();
        while (c != null) {
            assertTrue(msgs[num++].equals(c.getMessage()));
            c = c.getCause();
        }
        sqe = sqe.getNextException();
    }
}
项目:openjdk-jdk10    文件:SQLIntegrityConstraintViolationExceptionTests.java   
/**
 * Validate that the ordering of the returned Exceptions is correct
 * using for-each loop
 */
@Test
public void test11() {
    SQLIntegrityConstraintViolationException ex =
            new SQLIntegrityConstraintViolationException("Exception 1", t1);
    SQLIntegrityConstraintViolationException ex1 =
            new SQLIntegrityConstraintViolationException("Exception 2");
    SQLIntegrityConstraintViolationException ex2 =
            new SQLIntegrityConstraintViolationException("Exception 3", t2);
    ex.setNextException(ex1);
    ex.setNextException(ex2);
    int num = 0;
    for (Throwable e : ex) {
        assertTrue(msgs[num++].equals(e.getMessage()));
    }
}
项目:openjdk-jdk10    文件:SQLIntegrityConstraintViolationExceptionTests.java   
/**
 * Validate that the ordering of the returned Exceptions is correct
 * using traditional while loop
 */
@Test
public void test12() {
    SQLIntegrityConstraintViolationException ex =
            new SQLIntegrityConstraintViolationException("Exception 1", t1);
    SQLIntegrityConstraintViolationException ex1 =
            new SQLIntegrityConstraintViolationException("Exception 2");
    SQLIntegrityConstraintViolationException ex2 =
            new SQLIntegrityConstraintViolationException("Exception 3", t2);
    ex.setNextException(ex1);
    ex.setNextException(ex2);
    int num = 0;
    SQLException sqe = ex;
    while (sqe != null) {
        assertTrue(msgs[num++].equals(sqe.getMessage()));
        Throwable c = sqe.getCause();
        while (c != null) {
            assertTrue(msgs[num++].equals(c.getMessage()));
            c = c.getCause();
        }
        sqe = sqe.getNextException();
    }
}
项目:openjdk9    文件:SQLIntegrityConstraintViolationExceptionTests.java   
/**
 * Validate that the ordering of the returned Exceptions is correct
 * using for-each loop
 */
@Test
public void test11() {
    SQLIntegrityConstraintViolationException ex =
            new SQLIntegrityConstraintViolationException("Exception 1", t1);
    SQLIntegrityConstraintViolationException ex1 =
            new SQLIntegrityConstraintViolationException("Exception 2");
    SQLIntegrityConstraintViolationException ex2 =
            new SQLIntegrityConstraintViolationException("Exception 3", t2);
    ex.setNextException(ex1);
    ex.setNextException(ex2);
    int num = 0;
    for (Throwable e : ex) {
        assertTrue(msgs[num++].equals(e.getMessage()));
    }
}
项目:openjdk9    文件:SQLIntegrityConstraintViolationExceptionTests.java   
/**
 * Validate that the ordering of the returned Exceptions is correct
 * using traditional while loop
 */
@Test
public void test12() {
    SQLIntegrityConstraintViolationException ex =
            new SQLIntegrityConstraintViolationException("Exception 1", t1);
    SQLIntegrityConstraintViolationException ex1 =
            new SQLIntegrityConstraintViolationException("Exception 2");
    SQLIntegrityConstraintViolationException ex2 =
            new SQLIntegrityConstraintViolationException("Exception 3", t2);
    ex.setNextException(ex1);
    ex.setNextException(ex2);
    int num = 0;
    SQLException sqe = ex;
    while (sqe != null) {
        assertTrue(msgs[num++].equals(sqe.getMessage()));
        Throwable c = sqe.getCause();
        while (c != null) {
            assertTrue(msgs[num++].equals(c.getMessage()));
            c = c.getCause();
        }
        sqe = sqe.getNextException();
    }
}
项目:crudlet    文件:RestfulExceptionMapper.java   
@Override 
public Response toResponse(Exception ex) {
    if (Options.RETURN_EXCEPTION_BODY) {
        if (ex instanceof PersistenceException) {
            Throwable cause = ex.getCause();
            if (cause != null) { // The type of this exception is determined at runtime
                cause = cause.getCause();
                if (cause instanceof SQLIntegrityConstraintViolationException) {
                    return new RestErrorBuilder(cause).createResponse();
                }
            }
        }
    }

    ExceptionMapper exceptionMapper = providers.getExceptionMapper(ex.getClass());
    if (exceptionMapper == null || exceptionMapper == this) {
        return Response.serverError().build();
    }
    else {
        return exceptionMapper.toResponse(ex);
    }
}
项目:steve-plugsurfing    文件:OcppTagRepositoryImpl.java   
@Override
public int addOcppTag(OcppTagForm u) {
    try {
        return ctx.insertInto(OCPP_TAG)
                  .set(OCPP_TAG.ID_TAG, u.getIdTag())
                  .set(OCPP_TAG.PARENT_ID_TAG, u.getParentIdTag())
                  .set(OCPP_TAG.EXPIRY_DATE, toDateTime(u.getExpiration()))
                  .set(OCPP_TAG.NOTE, u.getNote())
                  .set(OCPP_TAG.BLOCKED, false)
                  .set(OCPP_TAG.IN_TRANSACTION, false)
                  .returning(OCPP_TAG.OCPP_TAG_PK)
                  .fetchOne()
                  .getOcppTagPk();

    } catch (DataAccessException e) {
        if (e.getCause() instanceof SQLIntegrityConstraintViolationException) {
            throw new SteveException("A user with idTag '%s' already exists.", u.getIdTag());
        } else {
            throw new SteveException("Execution of addOcppTag for idTag '%s' FAILED.", u.getIdTag(), e);
        }
    }
}
项目:jdk8u_jdk    文件:SQLIntegrityConstraintViolationExceptionTests.java   
/**
 * Validate that the ordering of the returned Exceptions is correct
 * using for-each loop
 */
@Test
public void test11() {
    SQLIntegrityConstraintViolationException ex =
            new SQLIntegrityConstraintViolationException("Exception 1", t1);
    SQLIntegrityConstraintViolationException ex1 =
            new SQLIntegrityConstraintViolationException("Exception 2");
    SQLIntegrityConstraintViolationException ex2 =
            new SQLIntegrityConstraintViolationException("Exception 3", t2);
    ex.setNextException(ex1);
    ex.setNextException(ex2);
    int num = 0;
    for (Throwable e : ex) {
        assertTrue(msgs[num++].equals(e.getMessage()));
    }
}
项目:jdk8u_jdk    文件:SQLIntegrityConstraintViolationExceptionTests.java   
/**
 * Validate that the ordering of the returned Exceptions is correct
 * using traditional while loop
 */
@Test
public void test12() {
    SQLIntegrityConstraintViolationException ex =
            new SQLIntegrityConstraintViolationException("Exception 1", t1);
    SQLIntegrityConstraintViolationException ex1 =
            new SQLIntegrityConstraintViolationException("Exception 2");
    SQLIntegrityConstraintViolationException ex2 =
            new SQLIntegrityConstraintViolationException("Exception 3", t2);
    ex.setNextException(ex1);
    ex.setNextException(ex2);
    int num = 0;
    SQLException sqe = ex;
    while (sqe != null) {
        assertTrue(msgs[num++].equals(sqe.getMessage()));
        Throwable c = sqe.getCause();
        while (c != null) {
            assertTrue(msgs[num++].equals(c.getMessage()));
            c = c.getCause();
        }
        sqe = sqe.getNextException();
    }
}
项目:lookaside_java-1.8.0-openjdk    文件:SQLIntegrityConstraintViolationExceptionTests.java   
/**
 * Validate that the ordering of the returned Exceptions is correct
 * using for-each loop
 */
@Test
public void test11() {
    SQLIntegrityConstraintViolationException ex =
            new SQLIntegrityConstraintViolationException("Exception 1", t1);
    SQLIntegrityConstraintViolationException ex1 =
            new SQLIntegrityConstraintViolationException("Exception 2");
    SQLIntegrityConstraintViolationException ex2 =
            new SQLIntegrityConstraintViolationException("Exception 3", t2);
    ex.setNextException(ex1);
    ex.setNextException(ex2);
    int num = 0;
    for (Throwable e : ex) {
        assertTrue(msgs[num++].equals(e.getMessage()));
    }
}
项目:lookaside_java-1.8.0-openjdk    文件:SQLIntegrityConstraintViolationExceptionTests.java   
/**
 * Validate that the ordering of the returned Exceptions is correct
 * using traditional while loop
 */
@Test
public void test12() {
    SQLIntegrityConstraintViolationException ex =
            new SQLIntegrityConstraintViolationException("Exception 1", t1);
    SQLIntegrityConstraintViolationException ex1 =
            new SQLIntegrityConstraintViolationException("Exception 2");
    SQLIntegrityConstraintViolationException ex2 =
            new SQLIntegrityConstraintViolationException("Exception 3", t2);
    ex.setNextException(ex1);
    ex.setNextException(ex2);
    int num = 0;
    SQLException sqe = ex;
    while (sqe != null) {
        assertTrue(msgs[num++].equals(sqe.getMessage()));
        Throwable c = sqe.getCause();
        while (c != null) {
            assertTrue(msgs[num++].equals(c.getMessage()));
            c = c.getCause();
        }
        sqe = sqe.getNextException();
    }
}
项目:isis-agri    文件:SimpleObjectMenu_IntegTest.java   
@Test
public void whenAlreadyExists() throws Exception {

    // given
    FixtureScript fs = new SimpleObjectsTearDown();
    fixtureScripts.runFixtureScript(fs, null);
    transactionService.nextTransaction();
    wrap(menu).create("Faz");
    transactionService.nextTransaction();

    // then
    expectedExceptions.expectCause(causalChainContains(SQLIntegrityConstraintViolationException.class));

    // when
    wrap(menu).create("Faz");
    transactionService.nextTransaction();
}
项目:isis-app-quickstart    文件:QuickObjectMenuIntegTest.java   
@Test
public void whenAlreadyExists() throws Exception {

    // given
    FixtureScript fs = new QuickObjectsTearDown();
    fixtureScripts.runFixtureScript(fs, null);
    nextTransaction();
    wrap(quickObjectMenu).create("Faz");
    nextTransaction();

    // then
    expectedExceptions.expectCause(causalChainContains(SQLIntegrityConstraintViolationException.class));

    // when
    wrap(quickObjectMenu).create("Faz");
    nextTransaction();
}
项目:isis-app-simpledsl    文件:SimpleObjectsIntegTest.java   
@Test
public void whenAlreadyExists() throws Exception {

    // given
    FixtureScript fs = new SimpleObjectsTearDown();
    fixtureScripts.runFixtureScript(fs, null);
    nextTransaction();
    wrap(simpleObjects).create("Faz");
    nextTransaction();

    // then
    expectedExceptions.expectCause(causalChainContains(SQLIntegrityConstraintViolationException.class));

    // when
    wrap(simpleObjects).create("Faz");
    nextTransaction();
}
项目:isis-app-petclinic    文件:PetsTest.java   
@Test
public void whenAlreadyExists() throws Exception {

    // given
    fixtureScript = new OwnersFixture();
    fixtureScripts.runFixtureScript(fixtureScript, null);
    nextTransaction();

    final Owner owner = fixtureScript.lookup("owners-fixture/owner-for-bill/item-1", Owner.class);
    assertThat(owner, is(notNullValue()));

    wrap(pets).create("Bonzo", PetSpecies.Dog, owner);
    nextTransaction();

    // then
    expectedException.expectCause(causalChainContains(SQLIntegrityConstraintViolationException.class));

    // when
    wrap(pets).create("Bonzo", PetSpecies.Dog, owner);
    nextTransaction();
}
项目:isis-app-petclinic    文件:OwnersTest.java   
@Test
public void whenAlreadyExists() throws Exception {

    // given
    fixtureScript = new PetClinicAppTearDownFixture();
    fixtureScripts.runFixtureScript(fixtureScript, null);
    nextTransaction();

    wrap(owners).create("Bill");
    nextTransaction();

    // then
    expectedException.expectCause(causalChainContains(SQLIntegrityConstraintViolationException.class));

    // when
    wrap(owners).create("Bill");
    nextTransaction();
}
项目:motech    文件:ObjectException.java   
protected static String getMessageFromCause(Throwable cause) {
    String message = "Persistence error";
    if (cause instanceof ConstraintViolationException) {
        Set<ConstraintViolation<?>> violations = ((ConstraintViolationException) cause).getConstraintViolations();
        message = "";
        for (ConstraintViolation violation : violations) {
            message += (String.format("Field %s %s\n", violation.getPropertyPath(), violation.getMessage()));
        }
    } else if (cause instanceof JDODataStoreException) {
        for (Throwable exception : ((JDODataStoreException) cause).getNestedExceptions()) {
            if (exception instanceof SQLIntegrityConstraintViolationException) {
                message = exception.getMessage();
                break;
            }
        }
    }
    return message;
}
项目:cn1    文件:SQLIntegrityConstraintViolationExceptionTest.java   
/**
 * @test java.sql.SQLIntegrityConstraintViolationException(String)
 */
public void test_Constructor_LString() {
    SQLIntegrityConstraintViolationException sQLIntegrityConstraintViolationException = new SQLIntegrityConstraintViolationException(
            "MYTESTSTRING");
    assertNotNull(sQLIntegrityConstraintViolationException);
    assertNull(
            "The SQLState of SQLIntegrityConstraintViolationException should be null",
            sQLIntegrityConstraintViolationException.getSQLState());
    assertEquals(
            "The reason of SQLIntegrityConstraintViolationException set and get should be equivalent",
            "MYTESTSTRING", sQLIntegrityConstraintViolationException
                    .getMessage());
    assertEquals(
            "The error code of SQLIntegrityConstraintViolationException should be 0",
            sQLIntegrityConstraintViolationException.getErrorCode(), 0);
}
项目:cn1    文件:SQLIntegrityConstraintViolationExceptionTest.java   
/**
 * @test java.sql.SQLIntegrityConstraintViolationException(String, String)
 */
public void test_Constructor_LStringLString() {
    SQLIntegrityConstraintViolationException sQLIntegrityConstraintViolationException = new SQLIntegrityConstraintViolationException(
            "MYTESTSTRING1", "MYTESTSTRING2");
    assertNotNull(sQLIntegrityConstraintViolationException);
    assertEquals(
            "The SQLState of SQLIntegrityConstraintViolationException set and get should be equivalent",
            "MYTESTSTRING2", sQLIntegrityConstraintViolationException
                    .getSQLState());
    assertEquals(
            "The reason of SQLIntegrityConstraintViolationException set and get should be equivalent",
            "MYTESTSTRING1", sQLIntegrityConstraintViolationException
                    .getMessage());
    assertEquals(
            "The error code of SQLIntegrityConstraintViolationException should be 0",
            sQLIntegrityConstraintViolationException.getErrorCode(), 0);

}
项目:cn1    文件:SQLIntegrityConstraintViolationExceptionTest.java   
/**
 * @test java.sql.SQLIntegrityConstraintViolationException(String, String)
 */
public void test_Constructor_LStringLString_1() {
    SQLIntegrityConstraintViolationException sQLIntegrityConstraintViolationException = new SQLIntegrityConstraintViolationException(
            "MYTESTSTRING", (String) null);
    assertNotNull(sQLIntegrityConstraintViolationException);
    assertNull(
            "The SQLState of SQLIntegrityConstraintViolationException should be null",
            sQLIntegrityConstraintViolationException.getSQLState());
    assertEquals(
            "The reason of SQLIntegrityConstraintViolationException set and get should be equivalent",
            "MYTESTSTRING", sQLIntegrityConstraintViolationException
                    .getMessage());
    assertEquals(
            "The error code of SQLIntegrityConstraintViolationException should be 0",
            sQLIntegrityConstraintViolationException.getErrorCode(), 0);
}
项目:cn1    文件:SQLIntegrityConstraintViolationExceptionTest.java   
/**
 * @test java.sql.SQLIntegrityConstraintViolationException(String, String)
 */
public void test_Constructor_LStringLString_2() {
    SQLIntegrityConstraintViolationException sQLIntegrityConstraintViolationException = new SQLIntegrityConstraintViolationException(
            null, "MYTESTSTRING");
    assertNotNull(sQLIntegrityConstraintViolationException);
    assertEquals(
            "The SQLState of SQLIntegrityConstraintViolationException set and get should be equivalent",
            "MYTESTSTRING", sQLIntegrityConstraintViolationException
                    .getSQLState());
    assertNull(
            "The reason of SQLIntegrityConstraintViolationException should be null",
            sQLIntegrityConstraintViolationException.getMessage());
    assertEquals(
            "The error code of SQLIntegrityConstraintViolationException should be 0",
            sQLIntegrityConstraintViolationException.getErrorCode(), 0);
}
项目:cn1    文件:SQLIntegrityConstraintViolationExceptionTest.java   
/**
 * @test java.sql.SQLIntegrityConstraintViolationException(String, String,
 *       int)
 */
public void test_Constructor_LStringLStringI() {
    SQLIntegrityConstraintViolationException sQLIntegrityConstraintViolationException = new SQLIntegrityConstraintViolationException(
            "MYTESTSTRING1", "MYTESTSTRING2", 1);
    assertNotNull(sQLIntegrityConstraintViolationException);
    assertEquals(
            "The SQLState of SQLIntegrityConstraintViolationException set and get should be equivalent",
            "MYTESTSTRING2", sQLIntegrityConstraintViolationException
                    .getSQLState());
    assertEquals(
            "The reason of SQLIntegrityConstraintViolationException set and get should be equivalent",
            "MYTESTSTRING1", sQLIntegrityConstraintViolationException
                    .getMessage());
    assertEquals(
            "The error code of SQLIntegrityConstraintViolationException should be 1",
            sQLIntegrityConstraintViolationException.getErrorCode(), 1);
}
项目:cn1    文件:SQLIntegrityConstraintViolationExceptionTest.java   
/**
 * @test java.sql.SQLIntegrityConstraintViolationException(String, String,
 *       int)
 */
public void test_Constructor_LStringLStringI_1() {
    SQLIntegrityConstraintViolationException sQLIntegrityConstraintViolationException = new SQLIntegrityConstraintViolationException(
            "MYTESTSTRING1", "MYTESTSTRING2", 0);
    assertNotNull(sQLIntegrityConstraintViolationException);
    assertEquals(
            "The SQLState of SQLIntegrityConstraintViolationException set and get should be equivalent",
            "MYTESTSTRING2", sQLIntegrityConstraintViolationException
                    .getSQLState());
    assertEquals(
            "The reason of SQLIntegrityConstraintViolationException set and get should be equivalent",
            "MYTESTSTRING1", sQLIntegrityConstraintViolationException
                    .getMessage());
    assertEquals(
            "The error code of SQLIntegrityConstraintViolationException should be 0",
            sQLIntegrityConstraintViolationException.getErrorCode(), 0);
}
项目:cn1    文件:SQLIntegrityConstraintViolationExceptionTest.java   
/**
 * @test java.sql.SQLIntegrityConstraintViolationException(String, String,
 *       int)
 */
public void test_Constructor_LStringLStringI_2() {
    SQLIntegrityConstraintViolationException sQLIntegrityConstraintViolationException = new SQLIntegrityConstraintViolationException(
            "MYTESTSTRING1", "MYTESTSTRING2", -1);
    assertNotNull(sQLIntegrityConstraintViolationException);
    assertEquals(
            "The SQLState of SQLIntegrityConstraintViolationException set and get should be equivalent",
            "MYTESTSTRING2", sQLIntegrityConstraintViolationException
                    .getSQLState());
    assertEquals(
            "The reason of SQLIntegrityConstraintViolationException set and get should be equivalent",
            "MYTESTSTRING1", sQLIntegrityConstraintViolationException
                    .getMessage());
    assertEquals(
            "The error code of SQLIntegrityConstraintViolationException should be -1",
            sQLIntegrityConstraintViolationException.getErrorCode(), -1);
}
项目:cn1    文件:SQLIntegrityConstraintViolationExceptionTest.java   
/**
 * @test java.sql.SQLIntegrityConstraintViolationException(String, String,
 *       int)
 */
public void test_Constructor_LStringLStringI_3() {
    SQLIntegrityConstraintViolationException sQLIntegrityConstraintViolationException = new SQLIntegrityConstraintViolationException(
            "MYTESTSTRING", null, 1);
    assertNotNull(sQLIntegrityConstraintViolationException);
    assertNull(
            "The SQLState of SQLIntegrityConstraintViolationException should be null",
            sQLIntegrityConstraintViolationException.getSQLState());
    assertEquals(
            "The reason of SQLIntegrityConstraintViolationException set and get should be equivalent",
            "MYTESTSTRING", sQLIntegrityConstraintViolationException
                    .getMessage());
    assertEquals(
            "The error code of SQLIntegrityConstraintViolationException should be 1",
            sQLIntegrityConstraintViolationException.getErrorCode(), 1);
}
项目:cn1    文件:SQLIntegrityConstraintViolationExceptionTest.java   
/**
 * @test java.sql.SQLIntegrityConstraintViolationException(String, String,
 *       int)
 */
public void test_Constructor_LStringLStringI_4() {
    SQLIntegrityConstraintViolationException sQLIntegrityConstraintViolationException = new SQLIntegrityConstraintViolationException(
            "MYTESTSTRING", null, 0);
    assertNotNull(sQLIntegrityConstraintViolationException);
    assertNull(
            "The SQLState of SQLIntegrityConstraintViolationException should be null",
            sQLIntegrityConstraintViolationException.getSQLState());
    assertEquals(
            "The reason of SQLIntegrityConstraintViolationException set and get should be equivalent",
            "MYTESTSTRING", sQLIntegrityConstraintViolationException
                    .getMessage());
    assertEquals(
            "The error code of SQLIntegrityConstraintViolationException should be 0",
            sQLIntegrityConstraintViolationException.getErrorCode(), 0);
}
项目:cn1    文件:SQLIntegrityConstraintViolationExceptionTest.java   
/**
 * @test java.sql.SQLIntegrityConstraintViolationException(String, String,
 *       int)
 */
public void test_Constructor_LStringLStringI_5() {
    SQLIntegrityConstraintViolationException sQLIntegrityConstraintViolationException = new SQLIntegrityConstraintViolationException(
            "MYTESTSTRING", null, -1);
    assertNotNull(sQLIntegrityConstraintViolationException);
    assertNull(
            "The SQLState of SQLIntegrityConstraintViolationException should be null",
            sQLIntegrityConstraintViolationException.getSQLState());
    assertEquals(
            "The reason of SQLIntegrityConstraintViolationException set and get should be equivalent",
            "MYTESTSTRING", sQLIntegrityConstraintViolationException
                    .getMessage());
    assertEquals(
            "The error code of SQLIntegrityConstraintViolationException should be -1",
            sQLIntegrityConstraintViolationException.getErrorCode(), -1);
}
项目:cn1    文件:SQLIntegrityConstraintViolationExceptionTest.java   
/**
 * @test java.sql.SQLIntegrityConstraintViolationException(String, String,
 *       int)
 */
public void test_Constructor_LStringLStringI_6() {
    SQLIntegrityConstraintViolationException sQLIntegrityConstraintViolationException = new SQLIntegrityConstraintViolationException(
            null, "MYTESTSTRING", 1);
    assertNotNull(sQLIntegrityConstraintViolationException);
    assertEquals(
            "The SQLState of SQLIntegrityConstraintViolationException set and get should be equivalent",
            "MYTESTSTRING", sQLIntegrityConstraintViolationException
                    .getSQLState());
    assertNull(
            "The reason of SQLIntegrityConstraintViolationException should be null",
            sQLIntegrityConstraintViolationException.getMessage());
    assertEquals(
            "The error code of SQLIntegrityConstraintViolationException should be 1",
            sQLIntegrityConstraintViolationException.getErrorCode(), 1);
}
项目:cn1    文件:SQLIntegrityConstraintViolationExceptionTest.java   
/**
 * @test java.sql.SQLIntegrityConstraintViolationException(String, String,
 *       int)
 */
public void test_Constructor_LStringLStringI_7() {
    SQLIntegrityConstraintViolationException sQLIntegrityConstraintViolationException = new SQLIntegrityConstraintViolationException(
            null, "MYTESTSTRING", 0);
    assertNotNull(sQLIntegrityConstraintViolationException);
    assertEquals(
            "The SQLState of SQLIntegrityConstraintViolationException set and get should be equivalent",
            "MYTESTSTRING", sQLIntegrityConstraintViolationException
                    .getSQLState());
    assertNull(
            "The reason of SQLIntegrityConstraintViolationException should be null",
            sQLIntegrityConstraintViolationException.getMessage());
    assertEquals(
            "The error code of SQLIntegrityConstraintViolationException should be 0",
            sQLIntegrityConstraintViolationException.getErrorCode(), 0);
}
项目:cn1    文件:SQLIntegrityConstraintViolationExceptionTest.java   
/**
 * @test java.sql.SQLIntegrityConstraintViolationException(String, String,
 *       int)
 */
public void test_Constructor_LStringLStringI_8() {
    SQLIntegrityConstraintViolationException sQLIntegrityConstraintViolationException = new SQLIntegrityConstraintViolationException(
            null, "MYTESTSTRING", -1);
    assertNotNull(sQLIntegrityConstraintViolationException);
    assertEquals(
            "The SQLState of SQLIntegrityConstraintViolationException set and get should be equivalent",
            "MYTESTSTRING", sQLIntegrityConstraintViolationException
                    .getSQLState());
    assertNull(
            "The reason of SQLIntegrityConstraintViolationException should be null",
            sQLIntegrityConstraintViolationException.getMessage());
    assertEquals(
            "The error code of SQLIntegrityConstraintViolationException should be -1",
            sQLIntegrityConstraintViolationException.getErrorCode(), -1);
}
项目:cn1    文件:SQLIntegrityConstraintViolationExceptionTest.java   
/**
 * @test java.sql.SQLIntegrityConstraintViolationException(Throwable)
 */
public void test_Constructor_LThrowable() {
    Throwable cause = new Exception("MYTHROWABLE");
    SQLIntegrityConstraintViolationException sQLIntegrityConstraintViolationException = new SQLIntegrityConstraintViolationException(
            cause);
    assertNotNull(sQLIntegrityConstraintViolationException);
    assertEquals(
            "The reason of SQLIntegrityConstraintViolationException should be equals to cause.toString()",
            "java.lang.Exception: MYTHROWABLE",
            sQLIntegrityConstraintViolationException.getMessage());
    assertNull(
            "The SQLState of SQLIntegrityConstraintViolationException should be null",
            sQLIntegrityConstraintViolationException.getSQLState());
    assertEquals(
            "The error code of SQLIntegrityConstraintViolationException should be 0",
            sQLIntegrityConstraintViolationException.getErrorCode(), 0);
    assertEquals(
            "The cause of SQLIntegrityConstraintViolationException set and get should be equivalent",
            cause, sQLIntegrityConstraintViolationException.getCause());
}
项目:cn1    文件:SQLIntegrityConstraintViolationExceptionTest.java   
/**
 * @test java.sql.SQLIntegrityConstraintViolationException(Throwable)
 */
public void test_Constructor_LThrowable_1() {
    SQLIntegrityConstraintViolationException sQLIntegrityConstraintViolationException = new SQLIntegrityConstraintViolationException(
            (Throwable) null);
    assertNotNull(sQLIntegrityConstraintViolationException);
    assertNull(
            "The SQLState of SQLIntegrityConstraintViolationException should be null",
            sQLIntegrityConstraintViolationException.getSQLState());
    assertNull(
            "The reason of SQLIntegrityConstraintViolationException should be null",
            sQLIntegrityConstraintViolationException.getMessage());
    assertEquals(
            "The error code of SQLIntegrityConstraintViolationException should be 0",
            sQLIntegrityConstraintViolationException.getErrorCode(), 0);
    assertNull(
            "The cause of SQLIntegrityConstraintViolationException should be null",
            sQLIntegrityConstraintViolationException.getCause());
}
项目:cn1    文件:SQLIntegrityConstraintViolationExceptionTest.java   
/**
 * @test java.sql.SQLIntegrityConstraintViolationException(String,
 *       Throwable)
 */
public void test_Constructor_LStringLThrowable() {
    Throwable cause = new Exception("MYTHROWABLE");
    SQLIntegrityConstraintViolationException sQLIntegrityConstraintViolationException = new SQLIntegrityConstraintViolationException(
            "MYTESTSTRING", cause);
    assertNotNull(sQLIntegrityConstraintViolationException);
    assertEquals(
            "The reason of SQLIntegrityConstraintViolationException set and get should be equivalent",
            "MYTESTSTRING", sQLIntegrityConstraintViolationException
                    .getMessage());
    assertNull(
            "The SQLState of SQLIntegrityConstraintViolationException should be null",
            sQLIntegrityConstraintViolationException.getSQLState());
    assertEquals(
            "The error code of SQLIntegrityConstraintViolationException should be 0",
            sQLIntegrityConstraintViolationException.getErrorCode(), 0);
    assertEquals(
            "The cause of SQLIntegrityConstraintViolationException set and get should be equivalent",
            cause, sQLIntegrityConstraintViolationException.getCause());
}
项目:cn1    文件:SQLIntegrityConstraintViolationExceptionTest.java   
/**
 * @test java.sql.SQLIntegrityConstraintViolationException(String,
 *       Throwable)
 */
public void test_Constructor_LStringLThrowable_1() {
    SQLIntegrityConstraintViolationException sQLIntegrityConstraintViolationException = new SQLIntegrityConstraintViolationException(
            "MYTESTSTRING", (Throwable) null);
    assertNotNull(sQLIntegrityConstraintViolationException);
    assertEquals(
            "The reason of SQLIntegrityConstraintViolationException set and get should be equivalent",
            "MYTESTSTRING", sQLIntegrityConstraintViolationException
                    .getMessage());
    assertNull(
            "The SQLState of SQLIntegrityConstraintViolationException should be null",
            sQLIntegrityConstraintViolationException.getSQLState());
    assertEquals(
            "The error code of SQLIntegrityConstraintViolationException should be 0",
            sQLIntegrityConstraintViolationException.getErrorCode(), 0);
    assertNull(
            "The cause of SQLIntegrityConstraintViolationException should be null",
            sQLIntegrityConstraintViolationException.getCause());
}
项目:cn1    文件:SQLIntegrityConstraintViolationExceptionTest.java   
/**
 * @test java.sql.SQLIntegrityConstraintViolationException(String,
 *       Throwable)
 */
public void test_Constructor_LStringLThrowable_2() {
    Throwable cause = new Exception("MYTHROWABLE");
    SQLIntegrityConstraintViolationException sQLIntegrityConstraintViolationException = new SQLIntegrityConstraintViolationException(
            null, cause);
    assertNotNull(sQLIntegrityConstraintViolationException);
    assertNull(
            "The reason of SQLIntegrityConstraintViolationException should be null",
            sQLIntegrityConstraintViolationException.getMessage());
    assertNull(
            "The SQLState of SQLIntegrityConstraintViolationException should be null",
            sQLIntegrityConstraintViolationException.getSQLState());
    assertEquals(
            "The error code of SQLIntegrityConstraintViolationException should be 0",
            sQLIntegrityConstraintViolationException.getErrorCode(), 0);
}
项目:cn1    文件:SQLIntegrityConstraintViolationExceptionTest.java   
/**
 * @test java.sql.SQLIntegrityConstraintViolationException(String,
 *       Throwable)
 */
public void test_Constructor_LStringLThrowable_3() {
    SQLIntegrityConstraintViolationException sQLIntegrityConstraintViolationException = new SQLIntegrityConstraintViolationException(
            (String) null, (Throwable) null);
    assertNotNull(sQLIntegrityConstraintViolationException);
    assertNull(
            "The SQLState of SQLIntegrityConstraintViolationException should be null",
            sQLIntegrityConstraintViolationException.getSQLState());
    assertNull(
            "The reason of SQLIntegrityConstraintViolationException should be null",
            sQLIntegrityConstraintViolationException.getMessage());
    assertEquals(
            "The error code of SQLIntegrityConstraintViolationException should be 0",
            sQLIntegrityConstraintViolationException.getErrorCode(), 0);
    assertNull(
            "The cause of SQLIntegrityConstraintViolationException should be null",
            sQLIntegrityConstraintViolationException.getCause());
}
项目:cn1    文件:SQLIntegrityConstraintViolationExceptionTest.java   
/**
 * @test java.sql.SQLIntegrityConstraintViolationException(String, String,
 *       Throwable)
 */
public void test_Constructor_LStringLStringLThrowable() {
    Throwable cause = new Exception("MYTHROWABLE");
    SQLIntegrityConstraintViolationException sQLIntegrityConstraintViolationException = new SQLIntegrityConstraintViolationException(
            "MYTESTSTRING1", "MYTESTSTRING2", cause);
    assertNotNull(sQLIntegrityConstraintViolationException);
    assertEquals(
            "The SQLState of SQLIntegrityConstraintViolationException set and get should be equivalent",
            "MYTESTSTRING2", sQLIntegrityConstraintViolationException
                    .getSQLState());
    assertEquals(
            "The reason of SQLIntegrityConstraintViolationException set and get should be equivalent",
            "MYTESTSTRING1", sQLIntegrityConstraintViolationException
                    .getMessage());
    assertEquals(
            "The error code of SQLIntegrityConstraintViolationException should be 0",
            sQLIntegrityConstraintViolationException.getErrorCode(), 0);
    assertEquals(
            "The cause of SQLIntegrityConstraintViolationException set and get should be equivalent",
            cause, sQLIntegrityConstraintViolationException.getCause());
}
项目:cn1    文件:SQLIntegrityConstraintViolationExceptionTest.java   
/**
 * @test java.sql.SQLIntegrityConstraintViolationException(String, String,
 *       Throwable)
 */
public void test_Constructor_LStringLStringLThrowable_1() {
    SQLIntegrityConstraintViolationException sQLIntegrityConstraintViolationException = new SQLIntegrityConstraintViolationException(
            "MYTESTSTRING1", "MYTESTSTRING2", null);
    assertNotNull(sQLIntegrityConstraintViolationException);
    assertEquals(
            "The SQLState of SQLIntegrityConstraintViolationException set and get should be equivalent",
            "MYTESTSTRING2", sQLIntegrityConstraintViolationException
                    .getSQLState());
    assertEquals(
            "The reason of SQLIntegrityConstraintViolationException set and get should be equivalent",
            "MYTESTSTRING1", sQLIntegrityConstraintViolationException
                    .getMessage());
    assertEquals(
            "The error code of SQLIntegrityConstraintViolationException should be 0",
            sQLIntegrityConstraintViolationException.getErrorCode(), 0);
    assertNull(
            "The cause of SQLIntegrityConstraintViolationException should be null",
            sQLIntegrityConstraintViolationException.getCause());
}