Last active
August 29, 2015 13:56
-
-
Save fappel/8863732 to your computer and use it in GitHub Desktop.
JUnit 4 Templates for Eclipse
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?xml version="1.0" encoding="UTF-8" standalone="no"?><templates><template autoinsert="false" context="java-members" deleted="false" description="JUnit 4 test case set up method" enabled="true" name="setUp">@${testType:newType(org.junit.Before)} | |
public void setUp() { | |
${cursor} | |
}</template><template autoinsert="false" context="java-members" deleted="false" description="JUnit 4 test case clean up method" enabled="true" name="tearDown">@${testType:newType(org.junit.After)} | |
public void tearDown() { | |
${cursor} | |
}</template><template autoinsert="false" context="java-members" deleted="false" description="JUnit 4 test method" enabled="true" id="org.eclipse.jdt.ui.templates.test_junit4" name="test">@${testType:newType(org.junit.Test)} | |
public void test${Name}() { | |
${cursor} | |
}</template><template autoinsert="false" context="java-members" deleted="false" description="Data collection method for parameterized JUnit test cases based on an enum type" enabled="true" name="parametersOverEnum">${a:importStatic(com.google.common.collect.Lists.newLinkedList)}${b:import(java.util.Collection)}@${annotation:newType(org.junit.runners.Parameterized.Parameters)} | |
public static Collection<Object[]> data() { | |
Collection<Object[]> result = newLinkedList(); | |
for( ${EnumType} ${element} : ${EnumType}.values() ) { | |
result.add( new Object[] { ${element}${cursor} } ); | |
} | |
return result; | |
}</template><template autoinsert="false" context="java-members" deleted="false" description="JUnit 4 rule definition" enabled="true" name="rule">@${annotationType:newType(org.junit.Rule)} | |
public ${final} ${ruleType} ${variableName} = new ${ruleType}();${cursor}</template><template autoinsert="false" context="java-members" deleted="false" description="JUnit 4 test method with expected setting" enabled="true" name="testExpected">@${testType:newType(org.junit.Test)}( expected = ${throwableType}.class ) | |
public void test${Name}() { | |
${cursor} | |
}</template></templates> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment