@Test @SuppressWarnings("unchecked") public void testAttributes() { Map<String, Object> attrib = (Map<String, Object>) model.get("i1"); ModelUtils.checkType(attrib, "ceylon.language::Integer"); Assert.assertEquals( "Wrong model type for i1", MetamodelGenerator.METATYPE_ATTRIBUTE, attrib.get(MetamodelGenerator.KEY_METATYPE)); attrib = (Map<String, Object>) model.get("s1"); ModelUtils.checkType(attrib, "ceylon.language::String"); ModelUtils.checkAnnotations(attrib, "shared"); attrib = (Map<String, Object>) model.get("pi"); ModelUtils.checkType(attrib, "ceylon.language::Float"); ModelUtils.checkAnnotations(attrib, "variable"); attrib = (Map<String, Object>) model.get("seq"); ModelUtils.checkType(attrib, "ceylon.language::Sequence<ceylon.language::Integer>"); ModelUtils.checkAnnotations(attrib, "shared", "variable"); attrib = (Map<String, Object>) model.get("union"); ModelUtils.checkType(attrib, "ceylon.language::Integer|ceylon.language::String"); attrib = (Map<String, Object>) model.get("useq"); ModelUtils.checkType( attrib, "ceylon.language::Iterable<ceylon.language::Singleton<ceylon.language::Integer>|ceylon.language::String>"); }
@Test @SuppressWarnings("unchecked") public void testSimpleMethods() { // simple1 Map<String, Object> method = (Map<String, Object>) model.get("simple1"); Assert.assertNotNull(method); ModelUtils.checkMap( method, MetamodelGenerator.KEY_NAME, "simple1", MetamodelGenerator.KEY_METATYPE, MetamodelGenerator.METATYPE_METHOD); ModelUtils.checkType(method, "ceylon.language::Anything"); method = (Map<String, Object>) model.get("simple2"); ModelUtils.checkMap( method, MetamodelGenerator.KEY_NAME, "simple2", MetamodelGenerator.KEY_METATYPE, MetamodelGenerator.METATYPE_METHOD); ModelUtils.checkAnnotations(method, "shared"); ModelUtils.checkType(method, "ceylon.language::Integer"); method = (Map<String, Object>) model.get("simple3"); ModelUtils.checkMap( method, MetamodelGenerator.KEY_NAME, "simple3", MetamodelGenerator.KEY_METATYPE, MetamodelGenerator.METATYPE_METHOD); ModelUtils.checkType(method, "ceylon.language::Anything"); ModelUtils.checkParam(method, 0, "p1", "ceylon.language::Integer", false, false); ModelUtils.checkParam(method, 1, "p2", "ceylon.language::String", false, false); }