Android Open Source - CucumberAndroidGradle Java Snippet






From Project

Back to project page CucumberAndroidGradle.

License

The source code is released under:

Apache License

If you think the Android project CucumberAndroidGradle listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.

Java Source Code

package cucumber.runtime.android;
/*from   ww  w .j  a v a  2  s. c  om*/
import cucumber.runtime.snippets.Snippet;

import java.util.List;

class JavaSnippet implements Snippet {

    @Override
    public String arguments(List<Class<?>> argumentTypes) {
        StringBuilder sb = new StringBuilder();
        int n = 1;
        for (Class<?> argType : argumentTypes) {
            if (n > 1) {
                sb.append(", ");
            }
            sb.append(argType.getSimpleName()).append(" ").append("arg").append(n++);
        }
        return sb.toString();
    }

    @Override
    public String template() {
        return "@{0}(\"{1}\")\n" +
                "public void {2}({3}) throws Throwable '{'\n" +
                "    // {4}\n" +
                "{5}    throw new PendingException();\n" +
                "'}'\n";
    }

    @Override
    public String tableHint() {
        return "    // For automatic conversion, change DataTable to List<YourType>\n";
    }

    @Override
    public String namedGroupStart() {
        return null;
    }

    @Override
    public String namedGroupEnd() {
        return null;
    }

    @Override
    public String escapePattern(String pattern) {
        return pattern.replace("\\", "\\\\").replace("\"", "\\\"");
    }
}




Java Source Code List

com.example.cucumberandroid.MainActivity.java
cucumber.api.android.CucumberInstrumentationTestRunner.java
cucumber.api.android.CucumberInstrumentation.java
cucumber.api.android.RunWithCucumber.java
cucumber.runtime.android.AndroidBackend.java
cucumber.runtime.android.AndroidClasspathMethodScanner.java
cucumber.runtime.android.AndroidFormatter.java
cucumber.runtime.android.AndroidJavaStepDefinition.java
cucumber.runtime.android.AndroidMethodFormat.java
cucumber.runtime.android.AndroidObjectFactory.java
cucumber.runtime.android.AndroidResourceLoader.java
cucumber.runtime.android.AndroidResource.java
cucumber.runtime.android.JavaHookDefinition.java
cucumber.runtime.android.JavaSnippet.java
ext.com.android.internal.os.LoggingPrintStream.java
ext.com.google.android.collect.Maps.java
ext.com.google.android.collect.Sets.java