public void Test_RIHarmony_compatible()
        {
            IlObjectInputStream i = null;

            try {
                NumberFormatInfo symbols = NumberFormatInfo.GetInstance(ILOG.J2CsMapping.Util.Culture.CultureInfoHelper.FRANCE);
                i = new IlObjectInputStream(
                    ILOG.J2CsMapping.IO.IOUtility.GetResourceAsStream(GetType().Assembly, "/serialization/java/text/DecimalFormatSymbols.ser"));
                NumberFormatInfo symbolsD = (NumberFormatInfo)i
                                            .ReadObject();
                Junit.Framework.Assert.AssertEquals(symbols, symbolsD);
            } finally {
                try {
                    if (i != null)
                    {
                        ((Stream)i).Close();
                    }
                } catch (Exception e) {
                    // ignore
                }
            }
        }
 private void CheckSerialization(IBM.ICU.Text.MessageFormat format)
 {
     try
     {
         MemoryStream         ba   = new MemoryStream();
         IlObjectOutputStream xout = new IlObjectOutputStream(ba);
         xout.WriteObject(format);
         ((Stream)xout).Close();
         IlObjectInputStream ins0 = new IlObjectInputStream(
             new MemoryStream(ba.ToArray()));
         IBM.ICU.Text.MessageFormat read = (IBM.ICU.Text.MessageFormat)ins0.ReadObject();
         NUnit.Framework.Assert.IsTrue(format.Equals(read), "Not equal: " + format.ToPattern());
     }
     catch (IOException e)
     {
         NUnit.Framework.Assert.Fail("Format: " + format.ToPattern() + " caused IOException: " + e);
     }
     catch (TypeLoadException e_0)
     {
         NUnit.Framework.Assert.Fail("Format: " + format.ToPattern()
                                     + " caused ClassNotFoundException: " + e_0);
     }
 }
        public void Test_serialization()
        {
            NumberFormatInfo symbols  = NumberFormatInfo.GetInstance(ILOG.J2CsMapping.Util.Culture.CultureInfoHelper.FRANCE);
            Currency         currency = symbols.GetCurrency();

            Junit.Framework.Assert.AssertNotNull(currency);

            // serialize
            MemoryStream         byteOStream   = new MemoryStream();
            IlObjectOutputStream objectOStream = new IlObjectOutputStream(byteOStream);

            objectOStream.WriteObject(symbols);

            // and deserialize
            IlObjectInputStream objectIStream = new IlObjectInputStream(
                new MemoryStream(byteOStream.ToArray()));
            NumberFormatInfo symbolsD = (NumberFormatInfo)objectIStream
                                        .ReadObject();

            // The associated currency will not persist
            currency = symbolsD.GetCurrency();
            Junit.Framework.Assert.AssertNotNull(currency);
        }