package net.openhft.chronicle.wire;

import org.junit.Assert;
import org.junit.Ignore;
import org.junit.Test;

import java.time.ZoneId;

@Ignore("see https://github.com/OpenHFT/Chronicle-Wire/issues/347")
public class TestMarshallableZoneId {

    public static class MySelfDescribingMarshallable extends SelfDescribingMarshallable {
        ZoneId zoneId;
    }

    @Test
    public void testMySelfDescribingMarshallable() {

        final MySelfDescribingMarshallable expected = new MySelfDescribingMarshallable();
        expected.zoneId = ZoneId.of("UTC");

        JSONWire jsonWire = new JSONWire();
        jsonWire.getValueOut().object(expected);

        final MySelfDescribingMarshallable actual = jsonWire.getValueIn().object(MySelfDescribingMarshallable.class);
        Assert.assertEquals(expected, actual);
    }

    public static class MyAbstractMarshallableCfg extends AbstractMarshallableCfg {
        ZoneId zoneId;
    }

    @Test
    public void testMyAbstractMarshallableCfg() {

        final MyAbstractMarshallableCfg expected = new MyAbstractMarshallableCfg();
        expected.zoneId = ZoneId.of("UTC");

        JSONWire jsonWire = new JSONWire();
        jsonWire.getValueOut().object(expected);

        final MyAbstractMarshallableCfg actual = jsonWire.getValueIn().object(MyAbstractMarshallableCfg.class);
        Assert.assertEquals(expected, actual);
    }

}

@@ -59,33 +59,8 @@
 rt;%0A
-import org.junit.Ignore;%0A
 impo
@@ -109,76 +109,8 @@
 d;%0A%0A
-@Ignore(%22see https://github.com/OpenHFT/Chronicle-Wire/issues/347%22)%0A
 publ
@@ -497,32 +497,47 @@
 = new JSONWire()
+.useTypes(true)
 ;%0A        jsonWi
@@ -1090,16 +1090,31 @@
 ONWire()
+.useTypes(true)
 ;%0A      

Fix test (#349)