Package org.jpox.enhancer.jdo

Source Code of org.jpox.enhancer.jdo.TestA05_4_9

package org.jpox.enhancer.jdo;

import org.jpox.exceptions.JPOXUserException;
import org.jpox.metadata.InvalidPrimaryKeyException;

/**
* @version $Revision: 1.3 $
*/
public abstract class TestA05_4_9 extends JDOTestBase
{
  public void testHaveSerializableProtectedField()
    {
    try
        {
      Class classes[] = getEnhancedClassesFromFile("org/jpox/enhancer/samples/A5_4_9.jdo");
      Class targetClass = findClass(classes, "org.jpox.enhancer.samples.FullProtectedClass");
      targetClass.newInstance();
      fail("must throw InvalidPrimaryKeyException with key 019010");
    }
        catch (JPOXUserException ue)
        {
            Throwable[] nested = ue.getNestedExceptions();
            assertEquals(nested.length, 1);
            assertEquals(nested[0].getClass(), InvalidPrimaryKeyException.class);
            InvalidPrimaryKeyException ipke = (InvalidPrimaryKeyException)nested[0];
            assertEquals("019010", ipke.getMessageKey());
        }
        catch (Throwable e)
        {
      e.printStackTrace();
      fail(e.getClass().getName() + ": " + e.getMessage());
    }
  }
}
TOP

Related Classes of org.jpox.enhancer.jdo.TestA05_4_9

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.