MCFullGenericTypesPrettyPrinter extends MCSimpleGenericTypesPrettyPrinter implements MCFullGenericTypesVisitor { public String prettyprint(ASTMCWildcardTypeArgument a) { getPrinter().clearBuffer(); a.accept(getRealThis()); return getPrinter().getContent(); } MCFullGenericTypesPrettyPrinter(IndentPrinter printer);  MCFullGenericTypesPrettyPrinter(IndentPrinter printer, MCFullGenericTypesVisitor realThis); @Override MCFullGenericTypesVisitor getRealThis(); @Override void setRealThis(MCFullGenericTypesVisitor realThis); @Override void handle(ASTMCWildcardTypeArgument node); @Override void handle(ASTMCInnerType innerType); @Override void handle(ASTMCMultipleGenericType node); @Override void handle(ASTMCArrayType node); String prettyprint(ASTMCWildcardTypeArgument a);  }
@Test public void testMCWildcardTypeArgumentExtends() throws IOException { MCFullGenericTypesTestParser parser = new MCFullGenericTypesTestParser(); Optional<ASTMCWildcardTypeArgument> ast = parser.parse_StringMCWildcardTypeArgument("? extends java.util.List"); assertTrue(ast.isPresent()); assertFalse(parser.hasErrors()); ASTMCWildcardTypeArgument wildcardType = ast.get(); MCFullGenericTypesPrettyPrinter printer = new MCFullGenericTypesPrettyPrinter(new IndentPrinter()); String output = printer.prettyprint(ast.get()); ast = parser.parse_StringMCWildcardTypeArgument(output); assertFalse(parser.hasErrors()); assertTrue(ast.isPresent()); assertTrue(wildcardType.deepEquals(ast.get())); }
@Test public void testMCWildcardTypeArgumentSuper() throws IOException { MCFullGenericTypesTestParser parser = new MCFullGenericTypesTestParser(); Optional<ASTMCWildcardTypeArgument> ast = parser.parse_StringMCWildcardTypeArgument("? super de.monticore.ASTNode"); assertTrue(ast.isPresent()); assertFalse(parser.hasErrors()); ASTMCWildcardTypeArgument wildcardType = ast.get(); MCFullGenericTypesPrettyPrinter printer = new MCFullGenericTypesPrettyPrinter(new IndentPrinter()); String output = printer.prettyprint(ast.get()); ast = parser.parse_StringMCWildcardTypeArgument(output); assertFalse(parser.hasErrors()); assertTrue(ast.isPresent()); assertTrue(wildcardType.deepEquals(ast.get())); }
@Test public void testMCMultipleGenericType() throws IOException { MCFullGenericTypesTestParser parser = new MCFullGenericTypesTestParser(); Optional<ASTMCMultipleGenericType> ast = parser.parse_StringMCMultipleGenericType("java.util.List<Integer>.some.util.Set<String>.Opt<List<String>>"); assertTrue(ast.isPresent()); assertFalse(parser.hasErrors()); ASTMCMultipleGenericType complexReferenceType = ast.get(); MCFullGenericTypesPrettyPrinter printer = new MCFullGenericTypesPrettyPrinter(new IndentPrinter()); String output = printer.prettyprint(ast.get()); ast = parser.parse_StringMCMultipleGenericType(output); assertFalse(parser.hasErrors()); assertTrue(ast.isPresent()); assertTrue(complexReferenceType.deepEquals(ast.get())); }
@Test public void testMCArrayType() throws IOException { MCFullGenericTypesTestParser parser = new MCFullGenericTypesTestParser(); Optional<ASTMCType> ast = parser.parse_StringMCType("String[][]"); assertTrue(ast.isPresent()); assertFalse(parser.hasErrors()); ASTMCType type = ast.get(); MCFullGenericTypesPrettyPrinter printer = new MCFullGenericTypesPrettyPrinter(new IndentPrinter()); String output = printer.prettyprint(ast.get()); ast = parser.parse_StringMCType(output); assertFalse(parser.hasErrors()); assertTrue(ast.isPresent()); assertTrue(type.deepEquals(ast.get())); }