Changed assertion to check for javax.persistence.PersistenceException rather than org.apache.openjpa.persistence.PersistenceException, since the API may wrap the PersistenceException.

git-svn-id: https://svn.apache.org/repos/asf/incubator/openjpa/trunk@505159 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Marc Prud'hommeaux 2007-02-09 03:45:17 +00:00
parent 7ea424bf0b
commit a384218429
1 changed files with 5 additions and 1 deletions

View File

@ -18,12 +18,12 @@ package org.apache.openjpa.conf;
import java.util.*; import java.util.*;
import javax.persistence.*; import javax.persistence.*;
import javax.persistence.PersistenceException;
import junit.framework.*; import junit.framework.*;
import org.apache.openjpa.lib.util.ParseException; import org.apache.openjpa.lib.util.ParseException;
import org.apache.openjpa.persistence.*; import org.apache.openjpa.persistence.*;
import org.apache.openjpa.persistence.PersistenceException;
public class TestBadAutoDetachProperty extends TestCase { public class TestBadAutoDetachProperty extends TestCase {
public void testEmptyValue() { public void testEmptyValue() {
@ -47,6 +47,8 @@ public class TestBadAutoDetachProperty extends TestCase {
emf.close(); emf.close();
} catch (PersistenceException e) { } catch (PersistenceException e) {
Throwable cause = e.getCause(); Throwable cause = e.getCause();
while (cause instanceof PersistenceException)
cause = ((PersistenceException) cause).getCause();
if (!(cause instanceof ParseException)) { if (!(cause instanceof ParseException)) {
fail("Should have caught PersistenceException whose cause was " fail("Should have caught PersistenceException whose cause was "
+ "a ParseException. " + "Instead the cause was: " + "a ParseException. " + "Instead the cause was: "
@ -69,6 +71,8 @@ public class TestBadAutoDetachProperty extends TestCase {
emf.close(); emf.close();
} catch (PersistenceException e) { } catch (PersistenceException e) {
Throwable cause = e.getCause(); Throwable cause = e.getCause();
while (cause instanceof PersistenceException)
cause = ((PersistenceException) cause).getCause();
if (!(cause instanceof ParseException)) { if (!(cause instanceof ParseException)) {
fail("Should have caught PersistenceException whose cause was " fail("Should have caught PersistenceException whose cause was "
+ "a ParseException. " + "Instead the cause was: " + "a ParseException. " + "Instead the cause was: "