import java.net.URL;
import java.net.URLClassLoader;
import org.junit.Test;
+import org.opendaylight.mdsal.binding.spec.naming.BindingMapping;
/**
* Union constructor with indentityref. Previously identityref was ignored so that there is no constructor for
Class<?> unionTypeClass = Class.forName(CompilationTestUtils.BASE_PKG
+ ".urn.opendaylight.yang.union.test.rev160509.UnionType", true, loader);
+ Object identOneValue = identOneClass.getDeclaredField(BindingMapping.VALUE_STATIC_FIELD_NAME).get(null);
+
// test UnionType with IdentOne argument
Constructor<?> unionTypeIdentBaseConstructor = CompilationTestUtils.assertContainsConstructor(unionTypeClass,
- Class.class);
- Object unionType = unionTypeIdentBaseConstructor.newInstance(identOneClass);
+ identBaseClass);
+ Object unionType = unionTypeIdentBaseConstructor.newInstance(identOneValue);
Method getUint8 = unionTypeClass.getDeclaredMethod("getUint8");
Object actualUint8 = getUint8.invoke(unionType);
Method getIdentityref = unionTypeClass.getDeclaredMethod("getIdentityref");
Object actualIdentityref = getIdentityref.invoke(unionType);
- assertEquals(identOneClass, actualIdentityref);
+ assertEquals(identOneValue, actualIdentityref);
CompilationTestUtils.cleanUp(sourcesOutputDir, compiledOutputDir);
}