@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 testProcessFType() { CompilationUnitDeclaration ast = prepareAst("fTypeTranslatorTestFile.txt", null); IJstType jstType = SyntaxTreeFactory2.createJST(ast, new TranslateCtx()); assertNotNull(jstType); assertTrue("ftype yet parsed correctly", jstType.isFType()); assertNotNull(jstType.getSimpleName()); }
@Test // @Description("Partial Mtype JS file should produce meaningful JSTType. " + // "Type name and package should be proper along with expects for itype") public void testExpects() { CompilationUnitDeclaration ast = prepareAst("expectsTranslatorTestFile.js.txt", null); IJstType jstType = SyntaxTreeFactory2.createJST(ast, new TranslateCtx()); assertNotNull(jstType); assertTrue(jstType.isMixin()); assertEquals("com.ebay.vjet", jstType.getPackage().getName()); assertEquals("M", jstType.getSimpleName()); List<? extends IJstType> expects = jstType.getExpects(); assertNotNull(expects); assertEquals(1, expects.size()); assertEquals("com.ebay.vjet", expects.get(0).getPackage().getName()); assertEquals("I", expects.get(0).getSimpleName()); }