|
| 1 | +package org.hisrc.jsonix.xml.xsom.tests; |
| 2 | + |
| 3 | +import org.hisrc.jsonix.xml.xsom.ParticleMultiplicityCounter; |
| 4 | +import org.hisrc.xml.bind.model.util.MModelInfoLoader; |
| 5 | +import org.hisrc.xml.xsom.XSFunctionApplier; |
| 6 | +import org.junit.Assert; |
| 7 | +import org.junit.Before; |
| 8 | +import org.junit.Test; |
| 9 | +import org.jvnet.jaxb2_commons.xml.bind.model.MClassInfo; |
| 10 | +import org.jvnet.jaxb2_commons.xml.bind.model.MModelInfo; |
| 11 | +import org.jvnet.jaxb2_commons.xml.bind.model.MPropertyInfo; |
| 12 | + |
| 13 | +import com.sun.tools.xjc.model.Multiplicity; |
| 14 | +import com.sun.tools.xjc.model.nav.NClass; |
| 15 | +import com.sun.tools.xjc.model.nav.NType; |
| 16 | + |
| 17 | +public class MultiplicityCounterValue01Test { |
| 18 | + |
| 19 | + private MModelInfo<NType, NClass> model; |
| 20 | + |
| 21 | + @Before |
| 22 | + public void loadModel() throws Exception { |
| 23 | + model = MModelInfoLoader.INSTANCE |
| 24 | + .loadModel("jsonschema/minmaxoccurs/value01.xsd"); |
| 25 | + } |
| 26 | + |
| 27 | + @Test |
| 28 | + public void v01value() throws Exception { |
| 29 | + |
| 30 | + final MClassInfo<NType, NClass> v01Type = model |
| 31 | + .getClassInfo("test.V01"); |
| 32 | + |
| 33 | + Assert.assertNotNull(v01Type); |
| 34 | + |
| 35 | + final MPropertyInfo<NType, NClass> value = v01Type.getProperty("value"); |
| 36 | + |
| 37 | + Assert.assertNotNull(value); |
| 38 | + |
| 39 | + final Multiplicity multiplicity = new XSFunctionApplier<Multiplicity>( |
| 40 | + ParticleMultiplicityCounter.INSTANCE).apply(value.getOrigin()); |
| 41 | + |
| 42 | + Assert.assertNull(multiplicity); |
| 43 | + |
| 44 | + } |
| 45 | +} |
0 commit comments