Package org.junithelper.core.meta

Examples of org.junithelper.core.meta.ClassMeta


    }

    @Test
    public void extract_A$String_generics() throws Exception {
        String sourceCodeString = "package hoge.foo; import java.util.List; import java.util.Map; public class Sample { public Sample() {}\r\n public List<String> doSomething(Integer intVal, long longVal) { System.out.println(\"aaaa\") } }";
        ClassMeta classMeta = classMetaExtractor.extract(sourceCodeString);
        target.initialize(classMeta, sourceCodeString);
        List<MethodMeta> actual = target.extract(sourceCodeString);
        assertEquals(1, actual.size());
        assertEquals("doSomething", actual.get(0).name);
        assertEquals(2, actual.get(0).argNames.size());
View Full Code Here


        // given
        Configuration config = new Configuration();
        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);
View Full Code Here

    }

    @Test
    public void extract_A$String_nestedGenerics() throws Exception {
        String sourceCodeString = "package hoge.foo; import java.util.List; import java.util.Map; public class Sample { public Sample() {}\r\n public List< Map< String, Object>> doSomething(Integer intVal, long longVal) { System.out.println(\"aaaa\") } }";
        ClassMeta classMeta = classMetaExtractor.extract(sourceCodeString);
        target.initialize(classMeta, sourceCodeString);
        List<MethodMeta> actual = target.extract(sourceCodeString);
        assertEquals(1, actual.size());
        assertEquals("doSomething", actual.get(0).name);
        assertEquals(2, actual.get(0).argNames.size());
View Full Code Here

    }

    @Test
    public void extract_A$String_somethingWrong() throws Exception {
        String sourceCodeString = "package foo.var; public class Something {   public String toLable() {\r\n    String label = \"\";\r\n    try {\r\n      if(name.equals(relax.name)){\r\n        label = \"aaa\";\r\n      } else if(name.equals(nurturing.name)){\r\n        label = \"bbb\";\r\n      } else if(name.equals(word.name)){\r\n        label = \"ccc\";\r\n      }\r\n    }catch (Exception e) {}\r\n    return label;\r\n  }\r\n }";
        ClassMeta classMeta = classMetaExtractor.extract(sourceCodeString);
        target.initialize(classMeta, sourceCodeString);
        List<MethodMeta> actual = target.extract(sourceCodeString);
        assertEquals(1, actual.size());
        assertEquals("toLable", actual.get(0).name);
        assertEquals(0, actual.get(0).argTypes.size());
View Full Code Here

        // given
        Configuration config = new Configuration();
        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);
View Full Code Here

    @Test
    public void appendPreparingArgs_A$StringBuilder$TestMethodMeta() throws Exception {
        // given
        StringBuilder buf = new StringBuilder();
        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
        generator.appendPreparingArgs(buf, testMethodMeta);
View Full Code Here

    }

    @Test
    public void initialize_A$ClassMeta() throws Exception {
        // given
        ClassMeta classMeta = mock(ClassMeta.class);
        // e.g. : given(mocked.called()).willReturn(1);
        // when
        MethodMetaExtractor actual = target.initialize(classMeta);
        // then
        // e.g. : verify(mocked).called();
View Full Code Here

    @Test
    public void appendExecutingTargetMethod_A$StringBuilder$TestMethodMeta() throws Exception {
        // given
        StringBuilder buf = new StringBuilder();
        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
        generator.appendExecutingTargetMethod(buf, testMethodMeta);
View Full Code Here

    }

    @Test
    public void initialize_A$ClassMeta$String_StringIsNull() throws Exception {
        MethodMetaExtractor target = new MethodMetaExtractor(config);
        ClassMeta classMeta = new ClassMetaExtractor(config).extract("public class Sample {}");
        String sourceCodeString = null;
        MethodMetaExtractor actual = target.initialize(classMeta, sourceCodeString);
        assertThat(actual, notNullValue());
    }
View Full Code Here

    }

    @Test
    public void initialize_A$ClassMeta$String_StringIsEmpty() throws Exception {
        MethodMetaExtractor target = new MethodMetaExtractor(config);
        ClassMeta classMeta = new ClassMetaExtractor(config).extract("public class Sample {}");
        String sourceCodeString = "";
        MethodMetaExtractor actual = target.initialize(classMeta, sourceCodeString);
        assertThat(actual, notNullValue());
    }
View Full Code Here

TOP

Related Classes of org.junithelper.core.meta.ClassMeta

Copyright © 2018 www.massapicom. 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.