Examples of MethodMeta


Examples of org.junithelper.core.meta.MethodMeta

        assertThat(GeneratorImplFunction.class, notNullValue());
    }

    @Test
    public void isPublicMethodAndTestingRequired_A$MethodMeta$TestingTarget() throws Exception {
        MethodMeta methodMeta = new MethodMeta();
        methodMeta.accessModifier = AccessModifier.Public;
        TestingTarget target_ = new TestingTarget();
        target_.isPublicMethodRequired = true;
        boolean actual = GeneratorImplFunction.isPublicMethodAndTestingRequired(methodMeta, target_);
        boolean expected = true;
View Full Code Here

Examples of org.junithelper.core.meta.MethodMeta

        assertThat(actual, is(equalTo(expected)));
    }

    @Test
    public void isProtectedMethodAndTestingRequired_A$MethodMeta$TestingTarget() throws Exception {
        MethodMeta methodMeta = new MethodMeta();
        methodMeta.accessModifier = AccessModifier.Protected;
        TestingTarget target_ = new TestingTarget();
        target_.isPublicMethodRequired = true;
        boolean actual = GeneratorImplFunction.isProtectedMethodAndTestingRequired(methodMeta, target_);
        boolean expected = true;
View Full Code Here

Examples of org.junithelper.core.meta.MethodMeta

        assertThat(actual, is(equalTo(expected)));
    }

    @Test
    public void isPackageLocalMethodAndTestingRequired_A$MethodMeta$TestingTarget() throws Exception {
        MethodMeta methodMeta = new MethodMeta();
        methodMeta.accessModifier = AccessModifier.PackageLocal;
        TestingTarget target_ = new TestingTarget();
        target_.isPublicMethodRequired = true;
        boolean actual = GeneratorImplFunction.isPackageLocalMethodAndTestingRequired(methodMeta, target_);
        boolean expected = true;
View Full Code Here

Examples of org.junithelper.core.meta.MethodMeta

    @Test
    public void getTestMethodMeta_A$MethodMeta() throws Exception {
        // given
        String sourceCodeString = "package hoge.foo; import java.util.List; public class Sample { public Sample() {}\r\n public int doSomething(String str, long longValue) throws Throwable { System.out.println(\"aaaa\") } }";
        ClassMeta targetClassMeta = classMetaExtractor.extract(sourceCodeString);
        MethodMeta targetMethodMeta = targetClassMeta.methods.get(0);
        generator.initialize(targetClassMeta);
        // when
        TestMethodMeta actual = generator.getTestMethodMeta(targetMethodMeta);
        // then
        assertEquals(false, actual.isTypeTest);
View Full Code Here

Examples of org.junithelper.core.meta.MethodMeta

    @Test
    public void getTestMethodMeta_A$MethodMeta$ExceptionMeta() throws Exception {
        // given
        String sourceCodeString = "package hoge.foo; import java.util.List; public class Sample { public Sample() {}\r\n public int doSomething(String str, long longValue) throws Throwable { System.out.println(\"aaaa\") } }";
        ClassMeta targetClassMeta = classMetaExtractor.extract(sourceCodeString);
        MethodMeta targetMethodMeta = targetClassMeta.methods.get(0);
        ExceptionMeta exception = new ExceptionMeta();
        exception.name = "Exception";
        exception.nameInMethodName = "Exception";
        generator.initialize(targetClassMeta);
        // when
View Full Code Here

Examples of org.junithelper.core.meta.MethodMeta

    public void getTestMethodNamePrefix_A$TestMethodMeta() throws Exception {
        // given
        String sourceCodeString = "package hoge.foo; import java.util.List; public class Sample { public Sample() {}\r\n public int doSomething(String str, long longValue) throws Throwable { System.out.println(\"aaaa\") } }";
        ClassMeta targetClassMeta = classMetaExtractor.extract(sourceCodeString);
        generator.initialize(targetClassMeta);
        MethodMeta targetMethodMeta = targetClassMeta.methods.get(0);
        TestMethodMeta testMethodMeta = generator.getTestMethodMeta(targetMethodMeta);
        // when
        String actual = generator.getTestMethodNamePrefix(testMethodMeta);
        // then
        String expected = "doSomething_A$String$long";
View Full Code Here

Examples of org.junithelper.core.meta.MethodMeta

    public void getTestMethodNamePrefix_A$TestMethodMeta$ExceptionMeta() throws Exception {
        // given
        String sourceCodeString = "package hoge.foo; import java.util.List; public class Sample { public Sample() {}\r\n public int doSomething(String str, long longValue) throws Throwable { System.out.println(\"aaaa\") } }";
        ClassMeta targetClassMeta = classMetaExtractor.extract(sourceCodeString);
        generator.initialize(targetClassMeta);
        MethodMeta targetMethodMeta = targetClassMeta.methods.get(0);
        TestMethodMeta testMethodMeta = generator.getTestMethodMeta(targetMethodMeta);
        ExceptionMeta exception = new ExceptionMeta();
        exception.name = "Exception";
        exception.nameInMethodName = "Exception";
        // when
View Full Code Here

Examples of org.junithelper.core.meta.MethodMeta

    public void getTestMethodSourceCode_A$TestMethodMeta_JUnit4() throws Exception {
        // given
        String sourceCodeString = "package hoge.foo; import java.util.List; public class Sample { public Sample() {}\r\n public int doSomething(String str, long longValue) throws Throwable { System.out.println(\"aaaa\") } }";
        ClassMeta targetClassMeta = classMetaExtractor.extract(sourceCodeString);
        generator.initialize(targetClassMeta);
        MethodMeta targetMethodMeta = targetClassMeta.methods.get(0);
        TestMethodMeta testMethodMeta = generator.getTestMethodMeta(targetMethodMeta);
        // when
        String actual = generator.getTestMethodSourceCode(testMethodMeta);
        // then
        String expected = "  @Test\r\n  public void doSomething_A$String$long() throws Throwable {\r\n    // TODO auto-generated by JUnit Helper.\r\n    Sample target = new Sample();\r\n    String str = null;\r\n    long longValue = 0L;\r\n    int actual = target.doSomething(str, longValue);\r\n    int expected = 0;\r\n    assertThat(actual, is(equalTo(expected)));\r\n  }\r\n";
View Full Code Here

Examples of org.junithelper.core.meta.MethodMeta

        config.testingPatternExplicitComment = TestingPatternExplicitComment.ArrangeActAssert;
        TestMethodGeneratorImpl localGenerator = new TestMethodGeneratorImpl(config, lineBreakProvider);
        String sourceCodeString = "package hoge.foo; import java.util.List; public class Sample { public Sample() {}\r\n public int doSomething(String str, long longValue) throws Throwable { System.out.println(\"aaaa\") } }";
        ClassMeta targetClassMeta = classMetaExtractor.extract(sourceCodeString);
        localGenerator.initialize(targetClassMeta);
        MethodMeta targetMethodMeta = targetClassMeta.methods.get(0);
        TestMethodMeta testMethodMeta = localGenerator.getTestMethodMeta(targetMethodMeta);
        // when
        String actual = localGenerator.getTestMethodSourceCode(testMethodMeta);
        // then
        String expected = "  public void test_doSomething_A$String$long() throws Throwable {\r\n    // TODO auto-generated by JUnit Helper.\r\n    // Arrange\r\n    Sample target = new Sample();\r\n    String str = null;\r\n    long longValue = 0L;\r\n    // Act\r\n    int actual = target.doSomething(str, longValue);\r\n    // Assert\r\n    int expected = 0;\r\n    assertEquals(expected, actual);\r\n  }\r\n";
View Full Code Here

Examples of org.junithelper.core.meta.MethodMeta

        config.testingPatternExplicitComment = TestingPatternExplicitComment.GivenWhenThen;
        TestMethodGeneratorImpl localGenerator = new TestMethodGeneratorImpl(config, lineBreakProvider);
        String sourceCodeString = "package hoge.foo; import java.util.List; public class Sample { public Sample() {}\r\n public int doSomething(String str, long longValue) throws Throwable { System.out.println(\"aaaa\") } }";
        ClassMeta targetClassMeta = classMetaExtractor.extract(sourceCodeString);
        localGenerator.initialize(targetClassMeta);
        MethodMeta targetMethodMeta = targetClassMeta.methods.get(0);
        TestMethodMeta testMethodMeta = localGenerator.getTestMethodMeta(targetMethodMeta);
        // when
        String actual = localGenerator.getTestMethodSourceCode(testMethodMeta);
        // then
        String expected = "  public void test_doSomething_A$String$long() throws Throwable {\r\n    // TODO auto-generated by JUnit Helper.\r\n    // Given\r\n    Sample target = new Sample();\r\n    String str = null;\r\n    long longValue = 0L;\r\n    // When\r\n    int actual = target.doSomething(str, longValue);\r\n    // Then\r\n    int expected = 0;\r\n    assertEquals(expected, actual);\r\n  }\r\n";
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.