@Test @Category({P1, FAST, UNIT}) @Description("Test Ctype mixin with mtype. check the package and type information.") public void testMixin() { CompilationUnitDeclaration ast = prepareAst("mixinTranslatorTestFile.js.txt", null); // ITypeManager typeManager1 = ctx.getTypeManager(); IJstType jstType = SyntaxTreeFactory2.createJST(ast, ctx); assertNotNull(jstType); // ITypeManager typeManager2 = ctx.getTypeManager(); // assertTrue(typeManager1.equals(typeManager2)); assertEquals("com.ebay.vjet", jstType.getPackage().getName()); assertEquals("A", jstType.getSimpleName()); List<? extends IJstTypeReference> mixins = jstType.getMixinsRef(); assertNotNull(mixins); assertEquals(2, mixins.size()); IJstType mixin = mixins.get(0).getReferencedType(); assertTrue(mixin.isMixin()); IJstType mixin2 = mixins.get(1).getReferencedType(); assertTrue(mixin2.isMixin()); assertEquals("com.ebay.vjet.fld", mixin.getPackage().getName()); assertEquals("B", mixin.getSimpleName()); assertEquals(3, mixin.getMethods().size()); assertEquals(4, JstTypeHelper.getDeclaredProperties(mixin.getProperties()).size()); }
@Test @Category({P5, FAST, UNIT}) @Description( "Test incomplete VJET atype should parse non-null jst. " + "Also it should have bare minimum information baout vjet type") public void testProcessType1() { CompilationUnitDeclaration ast = prepareAst("typeTranslatorTestFile.js.txt", null); IJstType jstType = SyntaxTreeFactory2.createJST(ast, new TranslateCtx()); List<? extends IJstMethod> staticMethods = jstType.getStaticMethods(); assertNotNull(staticMethods); assertEquals(2, JstTypeHelper.getDeclaredMethods(staticMethods).size()); IJstMethod jstMethod = getMethodByName(staticMethods, "getRate"); assertNotNull(jstMethod); IJstMethod jstMethod2 = getMethodByName(staticMethods, "getDiscount"); assertNotNull(jstMethod2); assertNotNull(jstType.getMethod("chase")); }