public void testAfterSaveError(){
{
    MyTestPO test=new MyTestPO(getCtx(),true,null);
    assertFalse("Object should not be saved -- " + test,test.save());
    assertFalse("Object should not be saved -- " + test,test.get_ID() <= 0);
    assertFalse("Object should not be saved(2) -- " + test,MyTestPO.exists(test.get_ID(),null));
  }
{
    MyTestPO test=new MyTestPO(getCtx(),false,null);
    assertTrue("Object *should* be saved -- " + test,test.save());
    MyTestPO test2=new MyTestPO(getCtx(),test.get_ID(),null);
    assertEquals("Object not found",test.get_ID(),test2.get_ID());
    test2.failOnSave=true;
    test2.setName(test2.getName() + "_2");
    assertFalse("Object should not be saved -- " + test2,test2.save());
    String name=MyTestPO.getName(test2.get_ID(),null);
    assertEquals("Object should not be modified(2) -- id=" + test2,test.getName(),name);
  }
}

public void testAfterSaveError ( ) { { MyTestPO test = new MyTestPO ( getCtx ( ) , true , null ) ; assertFalse ( "Object should not be saved -- " + test , test . save ( ) ) ; assertFalse ( "Object should not be saved -- " + test , test . get_ID ( ) <= 0 ) ; assertFalse ( "Object should not be saved(2) -- " + test , MyTestPO . exists ( test . get_ID ( ) , null ) ) ; } { MyTestPO test = new MyTestPO ( getCtx ( ) , false , null ) ; assertTrue ( "Object *should* be saved -- " + test , test . save ( ) ) ; MyTestPO test2 = new MyTestPO ( getCtx ( ) , test . get_ID ( ) , null ) ; assertEquals ( "Object not found" , test . get_ID ( ) , test2 . get_ID ( ) ) ; test2 . failOnSave = true ; test2 . setName ( test2 . getName ( ) + "_2" ) ; assertFalse ( "Object should not be saved -- " + test2 , test2 . save ( ) ) ; String name = MyTestPO . getName ( test2 . get_ID ( ) , null ) ; assertEquals ( "Object should not be modified(2) -- id=" + test2 , test . getName ( ) , name ) ; } }
object should not be saved if aftersave fails even if is outside transaction ( trxname = null )
