nfeign.experimental.feign-apt-test-generator.12.3.source-code.stub.mustache Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of feign-apt-test-generator Show documentation
Show all versions of feign-apt-test-generator Show documentation
Feign code generation tool for mocked clients
package {{client.jpackage}};
import java.util.concurrent.atomic.AtomicInteger;
import feign.Experimental;
public class {{client.className}}Stub
implements {{client.fullQualifiedName}} {
@Experimental
public class {{client.className}}Invokations {
{{#each methods as |method|}}
private final AtomicInteger {{method.name}} = new AtomicInteger(0);
public int {{method.name}}() {
return {{method.name}}.get();
}
{{/each}}
}
@Experimental
public class {{client.className}}Anwsers {
{{#each methods as |method|}}
{{#unless method.isVoid}}
private {{method.returnType}} {{method.name}}Default;
{{/unless}}
{{/each}}
}
public {{client.className}}Invokations invokations;
public {{client.className}}Anwsers answers;
public {{client.className}}Stub() {
this.invokations = new {{client.className}}Invokations();
this.answers = new {{client.className}}Anwsers();
}
{{#each methods as |method|}}
{{#unless method.isVoid}}
@Experimental
public {{client.className}}Stub with{{method.uname}}({{method.returnType}} {{method.name}}) {
answers.{{method.name}}Default = {{method.name}};
return this;
}
{{/unless}}
@Override
public {{method.returnType}} {{method.name}}({{#each method.args as |arg|}}{{arg.type}} {{arg.name}}{{#unless @last}},{{/unless}}{{/each}}) {
invokations.{{method.name}}.incrementAndGet();
{{#unless method.isVoid}}
return answers.{{method.name}}Default;
{{/unless}}
}
{{/each}}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy