Skip to content

Eclipse Template

Anthony Attwood edited this page Dec 17, 2015 · 4 revisions

You can add this template to Eclipse by open its preferences and go to Java -> Editor -> Templates. Click New... on the right side and enter the following:

  • Name: dataProvider
  • Context: Java type members
  • Automatically insert: false
  • Description: Insert a junit dataprovider method
  • Use code formatter: false (unfortunately, this is a global setting for all templates)
  • Pattern:
@${dataProviderType:newType(com.tngtech.java.junit.dataprovider.DataProvider)}
public static Object[][] dataProvider${Name}() {
    // @formatter:off
    return new Object[][] {
        { ${cursor} },
    };
    // @formatter:on
}