예제 #1
0
        private void testExcp6Import(String msg, int code, Object[] value)
        {
            StructValue sv = new StructValue(ValueFactoryTest1._mt_org_apache_etch_tests_Test1_Excp6, vf);

            sv.Add(ValueFactoryTest1._mf_msg, msg);
            sv.Add(ValueFactoryTest1._mf_code, code);
            sv.Add(ValueFactoryTest1._mf_x, value);
            Excp6 e = ( Excp6 )vf.ImportCustomValue(sv);

            Assert.AreEqual(msg, e.msg);
            Assert.AreEqual(code, e.code);
            Assert.AreEqual(value, e.x);
        }
예제 #2
0
        private void testExcp6Helper(int sz, String msg, int code, Object value)
        {
            Object[] myObject = test.fillObject(sz, value);

            Excp6 e = new Excp6(msg, code, myObject);

            Assert.AreEqual(msg, e.msg);
            Assert.AreEqual(code, e.code);

            for (int i = 0; i < myObject.Length; i++)
            {
                Assert.AreEqual(value, myObject[i]);
            }

            e = new Excp6(null, null, null);
            Assert.IsNull(e.msg);
            Assert.IsNull(e.code);
            Assert.IsNull(e.x);

            e = new Excp6();
            Assert.IsNull(e.msg);
            Assert.IsNull(e.code);
            Assert.IsNull(e.x);

            e.msg  = msg;
            e.code = code;
            e.x    = myObject;

            Assert.AreEqual(msg, e.msg);
            Assert.AreEqual(code, e.code);

            for (int i = 0; i < myObject.Length; i++)
            {
                Assert.AreEqual(value, myObject[i]);
            }

            e.msg  = null;
            e.code = null;
            e.x    = null;

            Assert.IsNull(e.msg);
            Assert.IsNull(e.code);
            Assert.IsNull(e.x);


            //Exception t = e;
            Assert.IsTrue(e is Exception);
            // assertFalse( t is RuntimeException );
        }