generator.facet.test.SourceTest.mustache Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of component-starter-server Show documentation
Show all versions of component-starter-server Show documentation
Web application allowing to generate maven or gradle project skeleton to speed up component
development.
package {{classPackage}};
import static java.util.Arrays.asList;
import static org.junit.Assert.assertEquals;
import java.io.IOException;
import org.junit.ClassRule;
import org.junit.Ignore;
import org.junit.Test;
{{#isGeneric}}
import org.talend.sdk.component.api.record.Record;
{{/isGeneric}}
import org.talend.sdk.component.junit.SimpleComponentRule;
import org.talend.sdk.component.runtime.input.Mapper;
public class {{testClassName}} {
@ClassRule
public static final SimpleComponentRule COMPONENT_FACTORY = new SimpleComponentRule("{{rootPackage}}");
@Test
@Ignore("You need to complete this test")
public void produce() throws IOException {
// Source configuration
// Setup your component configuration for the test here
final {{configurationClassName}} configuration = new {{configurationClassName}}(){{^hasConfig}};{{/hasConfig}}
{{#configFields}}
{{#first}}/* {{/first}}{{^first}} {{/first}}.set{{value}}(){{#last}} */;{{/last}}
{{/configFields}}
// We create the component mapper instance using the configuration filled above
final Mapper mapper = COMPONENT_FACTORY.createMapper({{sourceClassName}}.class, configuration);
// Collect the source as a list
assertEquals(asList(/* TODO - give the expected data */), COMPONENT_FACTORY.collectAsList({{#isGeneric}}Record{{/isGeneric}}{{^isGeneric}}{{outputRecordName}}{{/isGeneric}}.class, mapper));
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy