/parser-java/src/test/java/org/jboss/forge/test/parser/java/MethodSignatureTest.java
https://github.com/includeeasy/core · Java · 51 lines · 23 code · 4 blank · 24 comment · 0 complexity · ba9e055ab3984b02d5d602e26ec16998 MD5 · raw file
- /*
- * JBoss, Home of Professional Open Source
- * Copyright 2010, Red Hat, Inc., and individual contributors
- * by the @authors tag. See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
- package org.jboss.forge.test.parser.java;
- import static org.junit.Assert.assertEquals;
- import org.jboss.forge.parser.JavaParser;
- import org.jboss.forge.parser.java.JavaClass;
- import org.jboss.forge.parser.java.Method;
- import org.junit.Test;
- /**
- * @author <a href="mailto:lincolnbaxter@gmail.com">Lincoln Baxter, III</a>
- */
- public class MethodSignatureTest
- {
- @Test
- public void testEmptyMethodSignature() throws Exception
- {
- Method<JavaClass> method = JavaParser.create(JavaClass.class).addMethod("public void hello()");
- String signature = method.toSignature();
- assertEquals("public hello() : void", signature);
- }
- @Test
- public void testMethodSignatureParams() throws Exception
- {
- Method<JavaClass> method = JavaParser.create(JavaClass.class).addMethod("public void hello(String foo, int bar)");
- String signature = method.toSignature();
- assertEquals("public hello(String, int) : void", signature);
- }
- }