Package org.junithelper.core.meta

Examples of org.junithelper.core.meta.ClassMeta


    }

    @Test
    public void initialize_A$ClassMeta() 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\") } }";
        ClassMeta targetClassMeta = classMetaExtractor.extract(sourceCodeString);
        target.initialize(targetClassMeta);
    }
View Full Code Here


    public void getNewTestCaseMeta_A$() throws Exception {

        // given
        String sourceCodeString = "package hoge.foo; import java.util.List; import java.util.Map; public class Sample { public Sample() {}\r\n public Map<String, List<String>> doSomething(String str, long longValue, Map<String,Obeject> map, Map<String,List<String>> nested, List<List<String>> nestedList, String arr[], String arrOfArr[][]) throws Throwable { System.out.println(\"aaaa\") } }";
        // when
        ClassMeta targetClassMeta = classMetaExtractor.extract(sourceCodeString);
        target.initialize(targetClassMeta);
        TestCaseMeta actual = target.getNewTestCaseMeta();

        // then
        assertEquals("Sample", actual.target.name);
View Full Code Here

    public void getNewTestCaseMeta_A$_2() throws Exception {
        String encoding = UniversalDetectorUtil.getDetectedEncoding(IOUtil
                .getResourceAsStream("inputs/DefaultTestCaseGenerator.txt"));
        String sourceCodeString = IOUtil.readAsString(
                IOUtil.getResourceAsStream("inputs/DefaultTestCaseGenerator.txt"), encoding);
        ClassMeta targetClassMeta = classMetaExtractor.extract(sourceCodeString);
        target.initialize(targetClassMeta);
        TestCaseMeta actual = target.getNewTestCaseMeta();
        assertEquals("DefaultTestCaseGenerator", actual.target.name);
        assertEquals(1, actual.target.constructors.size());
        assertEquals(6, actual.target.methods.size());
View Full Code Here

    @Test
    public void getNewTestCaseMeta_A$_3() throws Exception {
        String encoding = UniversalDetectorUtil.getDetectedEncoding(IOUtil
                .getResourceAsStream("inputs/DefaultTestCaseGenerator.txt"));
        String sourceCodeString = IOUtil.readAsString(IOUtil.getResourceAsStream("inputs/ObjectUtil.txt"), encoding);
        ClassMeta targetClassMeta = classMetaExtractor.extract(sourceCodeString);
        target.initialize(targetClassMeta);
        TestCaseMeta actual = target.getNewTestCaseMeta();
        assertEquals("ObjectUtil", actual.target.name);
        assertEquals(1, actual.target.constructors.size());
        assertEquals(AccessModifier.Private, actual.target.constructors.get(0).accessModifier);
View Full Code Here

    public void getNewTestCaseMeta_A$_Log() throws Exception {
        String encoding = UniversalDetectorUtil.getDetectedEncoding(IOUtil
                .getResourceAsStream("inputs/DefaultTestCaseGenerator_Log.txt"));
        String sourceCodeString = IOUtil.readAsString(IOUtil
                .getResourceAsStream("inputs/DefaultTestCaseGenerator_Log.txt"), encoding);
        ClassMeta targetClassMeta = classMetaExtractor.extract(sourceCodeString);
        target.initialize(targetClassMeta);
        TestCaseMeta actual = target.getNewTestCaseMeta();
        assertEquals("Log", actual.target.name);
        assertEquals(2, actual.target.constructors.size());
        assertEquals("Class", actual.target.constructors.get(0).argTypes.get(0).name);
View Full Code Here

    public void getNewTestCaseSourceCode_A$_SimpleHttpClient() throws Exception {
        String encoding = UniversalDetectorUtil.getDetectedEncoding(IOUtil
                .getResourceAsStream("inputs/DefaultTestCaseGenerator_SimpleHttpClient.txt"));
        String sourceCodeString = IOUtil.readAsString(IOUtil
                .getResourceAsStream("inputs/DefaultTestCaseGenerator_SimpleHttpClient.txt"), encoding);
        ClassMeta targetClassMeta = classMetaExtractor.extract(sourceCodeString);
        target.initialize(targetClassMeta);
        String actual = target.getNewTestCaseSourceCode();
        assertNotNull(actual);
    }
View Full Code Here

    public void getNewTestCaseSourceCode_A$_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 actual = target.getNewTestCaseSourceCode();
        assertNotNull(actual);
    }
View Full Code Here

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

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

     * @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

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.