OPENJPA-1529 Committing test case updates contributed by Dianne Richards.

git-svn-id: https://svn.apache.org/repos/asf/openjpa/trunk@915904 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Jeremy Bauer 2010-02-24 18:09:01 +00:00
parent fb57d61322
commit 8ef5a5dda1
2 changed files with 6 additions and 0 deletions

View File

@ -32,6 +32,7 @@ public class TestCacheModeInvalid extends AbstractCacheTestCase {
public void setUp() {} public void setUp() {}
public void testInvalidElement() { public void testInvalidElement() {
boolean exceptionCaught = false;
try { try {
Map<String, Object> propertiesMap = getPropertiesMap("openjpa.DataCache", "true", Map<String, Object> propertiesMap = getPropertiesMap("openjpa.DataCache", "true",
"openjpa.QueryCache", "true", "openjpa.QueryCache", "true",
@ -40,10 +41,12 @@ public class TestCacheModeInvalid extends AbstractCacheTestCase {
emf = (OpenJPAEntityManagerFactorySPI) OpenJPAPersistence.createEntityManagerFactory("cache-mode-invalid", emf = (OpenJPAEntityManagerFactorySPI) OpenJPAPersistence.createEntityManagerFactory("cache-mode-invalid",
"META-INF/caching-persistence-invalid.xml", propertiesMap ); "META-INF/caching-persistence-invalid.xml", propertiesMap );
} catch (Throwable e) { } catch (Throwable e) {
exceptionCaught = true;
assertException(e, org.apache.openjpa.util.GeneralException.class); assertException(e, org.apache.openjpa.util.GeneralException.class);
String msg = e.getMessage(); String msg = e.getMessage();
assertTrue(msg.contains("org.xml.sax.SAXException")); assertTrue(msg.contains("org.xml.sax.SAXException"));
} }
assertTrue(exceptionCaught);
} }
@Override @Override

View File

@ -32,15 +32,18 @@ public class TestPropertyCacheModeInvalid extends AbstractCacheTestCase {
public void setUp() {} public void setUp() {}
public void testInvalidPropertyValue() { public void testInvalidPropertyValue() {
boolean exceptionCaught = false;
try { try {
Map<String, Object> propertyMap = new HashMap<String, Object>(); Map<String, Object> propertyMap = new HashMap<String, Object>();
propertyMap.put("javax.persistence.sharedCache.mode", "INVALID"); propertyMap.put("javax.persistence.sharedCache.mode", "INVALID");
emf = createEntityManagerFactory("cache-mode-empty",propertyMap); emf = createEntityManagerFactory("cache-mode-empty",propertyMap);
} catch (Throwable e) { } catch (Throwable e) {
exceptionCaught = true;
assertException(e, java.lang.IllegalArgumentException.class); assertException(e, java.lang.IllegalArgumentException.class);
String msg = e.getMessage(); String msg = e.getMessage();
assertTrue(msg.contains("javax.persistence.SharedCacheMode.INVALID")); assertTrue(msg.contains("javax.persistence.SharedCacheMode.INVALID"));
} }
assertTrue(exceptionCaught);
} }
@Override @Override