Examples of ClassMeta


Examples of org.junithelper.core.meta.ClassMeta

     * @see {@link http://code.google.com/p/junithelper/issues/detail?id=65}
     */
    @Test
    public void getNewTestCaseSourceCode_A$_testCaseClassNameToExtendIsEmpty() throws Exception {
        String sourceCodeString = "package com.example; public class Sample {}";
        ClassMeta targetClassMeta = classMetaExtractor.extract(sourceCodeString);
        target.initialize(targetClassMeta);
        config.testCaseClassNameToExtend = "";
        String actual = target.getNewTestCaseSourceCode();
        String expected = "package com.example;\r\n\r\nimport com.example.Sample.*;\r\nimport static org.hamcrest.CoreMatchers.*;\r\nimport static org.junit.Assert.*;\r\nimport org.junit.Test;\r\n\r\n\r\npublic class SampleTest {\r\n\r\n  @Test\r\n  public void type() throws Exception {\r\n    // TODO auto-generated by JUnit Helper.\r\n    assertThat(Sample.class, notNullValue());\r\n  }\r\n\r\n  @Test\r\n  public void instantiation() throws Exception {\r\n    // TODO auto-generated by JUnit Helper.\r\n    Sample target = new Sample();\r\n    assertThat(target, notNullValue());\r\n  }\r\n\r\n}\r\n";
        assertThat(actual, is(equalTo(expected)));
View Full Code Here

Examples of org.junithelper.core.meta.ClassMeta

     * @see {@link http://code.google.com/p/junithelper/issues/detail?id=66}
     */
    @Test
    public void getNewTestCaseSourceCode_A$_packageIsEmpty() throws Exception {
        String sourceCodeString = "public class Sample {}";
        ClassMeta targetClassMeta = classMetaExtractor.extract(sourceCodeString);
        target.initialize(targetClassMeta);
        config.testCaseClassNameToExtend = "";
        String actual = target.getNewTestCaseSourceCode();
        String expected = "import Sample.*;\r\nimport static org.hamcrest.CoreMatchers.*;\r\nimport static org.junit.Assert.*;\r\nimport org.junit.Test;\r\n\r\npublic class SampleTest {\r\n\r\n  @Test\r\n  public void type() throws Exception {\r\n    // TODO auto-generated by JUnit Helper.\r\n    assertThat(Sample.class, notNullValue());\r\n  }\r\n\r\n  @Test\r\n  public void instantiation() throws Exception {\r\n    // TODO auto-generated by JUnit Helper.\r\n    Sample target = new Sample();\r\n    assertThat(target, notNullValue());\r\n  }\r\n\r\n}\r\n";
        assertThat(actual, is(equalTo(expected)));
View Full Code Here

Examples of org.junithelper.core.meta.ClassMeta

        // ext config
        InputStream is = this.getClass().getClassLoader().getResourceAsStream("junithelper-extension.xml");
        config.extConfiguration = new ExtConfigurationLoader().load(is);

        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\") } public void overload(String str) { } public void overload(String str, Object obj) { } }";
        ClassMeta targetClassMeta = classMetaExtractor.extract(sourceCodeString);
        target.initialize(targetClassMeta);
        String currentTestCaseSourceCode = "package hoge.foo; public class SampleTest extends TestCase { public void test_overload_A$String$Object() throws Exception { } }";
        List<TestMethodMeta> actual = target.getLackingTestMethodMetaList(currentTestCaseSourceCode);
        assertEquals(4, actual.size());
        assertEquals(true, actual.get(0).isTypeTest);
View Full Code Here

Examples of org.junithelper.core.meta.ClassMeta

        config.extConfiguration = new ExtConfigurationLoader().load(is);

        String sourceCodeString = "package hoge.foo; import java.util.List; public class Sample { "
                + "public int doSomething(Something something, String str, String str2, long longValue) throws Throwable { System.out.println(\"aaaa\") } "
                + "public void overload(String str) { } " + "public void overload(String str, Object obj) { } }";
        ClassMeta targetClassMeta = classMetaExtractor.extract(sourceCodeString);
        target.initialize(targetClassMeta);
        String currentTestCaseSourceCode = "package hoge.foo; public class SampleTest extends TestCase { public void test_overload_A$String$Object() throws Exception { } }";
        List<TestMethodMeta> actual = target.getLackingTestMethodMetaList(currentTestCaseSourceCode);
        assertEquals(4, actual.size());
        assertEquals(true, actual.get(0).isTypeTest);
View Full Code Here

Examples of org.junithelper.core.meta.ClassMeta

        InputStream is = this.getClass().getClassLoader().getResourceAsStream("junithelper-extension.xml");
        config.isExtensionEnabled = true;
        config.extConfiguration = new ExtConfigurationLoader().load(is);

        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\") } public void overload(String str) { } public void overload(String str, Object obj) { } }";
        ClassMeta targetClassMeta = classMetaExtractor.extract(sourceCodeString);
        target.initialize(targetClassMeta);
        String currentTestCaseSourceCode = "package hoge.foo; public class SampleTest extends TestCase { public void test_overload_A$String$Object() throws Exception { } }";
        List<TestMethodMeta> actual = target.getLackingTestMethodMetaList(currentTestCaseSourceCode);
        assertEquals(10, actual.size());
        assertEquals(true, actual.get(0).isTypeTest);
View Full Code Here

Examples of org.junithelper.core.meta.ClassMeta

        config.extConfiguration = new ExtConfigurationLoader().load(is);

        String sourceCodeString = "package hoge.foo; import java.util.List; public class Sample { "
                + "public int doSomething(Something something, String str, String str2, long longValue) throws Throwable { System.out.println(\"aaaa\") } "
                + "public void overload(String str) { } " + "public void overload(String str, Object obj) { } }";
        ClassMeta targetClassMeta = classMetaExtractor.extract(sourceCodeString);
        target.initialize(targetClassMeta);
        String currentTestCaseSourceCode = "package hoge.foo; public class SampleTest extends TestCase { public void test_overload_A$String$Object() throws Exception { } }";
        List<TestMethodMeta> actual = target.getLackingTestMethodMetaList(currentTestCaseSourceCode);
        assertEquals(10, actual.size());
        assertEquals(true, actual.get(0).isTypeTest);
View Full Code Here

Examples of org.junithelper.core.meta.ClassMeta

    public void getLackingTestMethodMetaList_A$String_Slim3_AbstractModelRef() throws Exception {
        String encoding = UniversalDetectorUtil.getDetectedEncoding(IOUtil
                .getResourceAsStream("inputs/Slim3_AbstractModelRef.txt"));
        String sourceCodeString = IOUtil.readAsString(IOUtil.getResourceAsStream("inputs/Slim3_AbstractModelRef.txt"),
                encoding);
        ClassMeta targetClassMeta = classMetaExtractor.extract(sourceCodeString);
        target.initialize(targetClassMeta);
        String currentTestCaseSourceCode = "";
        List<TestMethodMeta> actual = target.getLackingTestMethodMetaList(currentTestCaseSourceCode);
        assertEquals("", 6, actual.size());
    }
View Full Code Here

Examples of org.junithelper.core.meta.ClassMeta

    @Test
    public void getLackingTestMethodMetaList_A$String_IOUtil() throws Exception {
        String encoding = UniversalDetectorUtil.getDetectedEncoding(IOUtil.getResourceAsStream("inputs/IOUtil.txt"));
        String sourceCodeString = IOUtil.readAsString(IOUtil.getResourceAsStream("inputs/IOUtil.txt"), encoding);
        ClassMeta targetClassMeta = classMetaExtractor.extract(sourceCodeString);
        target.initialize(targetClassMeta);
        String currentTestCaseSourceCode = "";
        List<TestMethodMeta> actual = target.getLackingTestMethodMetaList(currentTestCaseSourceCode);
        assertThat(actual.size(), is(equalTo(10)));
        assertThat(actual.get(2).methodMeta.argTypes.get(0).name, is(equalTo("InputStream")));
View Full Code Here

Examples of org.junithelper.core.meta.ClassMeta

    }

    @Test
    public void getLackingTestMethodMetaList_A$String() throws Exception {
        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\") } public void overload(String str) { } public void overload(String str, Object obj) { } }";
        ClassMeta targetClassMeta = classMetaExtractor.extract(sourceCodeString);
        target.initialize(targetClassMeta);
        String currentTestCaseSourceCode = "package hoge.foo; public class SampleTest extends TestCase { public void test_overload_A$String$Object() throws Exception { } }";
        List<TestMethodMeta> actual = target.getLackingTestMethodMetaList(currentTestCaseSourceCode);
        assertEquals(4, actual.size());
        assertEquals(true, actual.get(0).isTypeTest);
View Full Code Here

Examples of org.junithelper.core.meta.ClassMeta

    }

    @Test
    public void getLackingTestMethodMetaList_A$String_Overload() throws Exception {
        String sourceCodeString = "public class Sample { public void doSomething(String str) throws Throwable {} public void doSomething() throws Throwable {} }";
        ClassMeta targetClassMeta = classMetaExtractor.extract(sourceCodeString);
        target.initialize(targetClassMeta);
        String currentTestCaseSourceCode = "package hoge.foo; public class SampleTest extends TestCase { public void test_doSomething_A$String() throws Exception { } }";
        List<TestMethodMeta> actual = target.getLackingTestMethodMetaList(currentTestCaseSourceCode);
        assertEquals(3, actual.size());
        assertEquals(true, actual.get(0).isTypeTest);
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.