Permalink
Browse files

- removed unnecessary JUnit TemporaryDirectory usage

- cleaned up some test code and re-ordered some vars
  • Loading branch information...
1 parent 4e490ac commit 1611d5c9dbac5ab7581cbb459390f80513f3bf8c @kellyrob99 kellyrob99 committed Dec 30, 2010
@@ -16,10 +16,10 @@ class JSLintPluginConvention
/* jar reference is left untyped to allow more flexible configuration if needed */
def antjar = 'com.googlecode.jslint4java:jslint4java-ant:1.4.4'
+ String taskName = 'com.googlecode.jslint4java.ant.JSLintTask'
List<String> inputDirs = ['.']
String includes = '**/*.js'
String excludes = ''
- String taskName = 'com.googlecode.jslint4java.ant.JSLintTask'
String formatterType = 'plain'
String destFilename = 'jslint'
boolean haltOnFailure = true
@@ -12,15 +12,13 @@ import static org.hamcrest.Matchers.*
*/
class JSLintPluginConventionTest
{
- @Rule
- public TemporaryFolder tmpDir = new TemporaryFolder();
private Project project
private JSLintPluginConvention convention
@Before
public void setup()
{
- project = ProjectBuilder.builder().withProjectDir(tmpDir.folder).build()
+ project = ProjectBuilder.builder().build()
convention = new JSLintPluginConvention(project)
}
@@ -101,6 +99,6 @@ class JSLintPluginConventionTest
LinkedHashMap<String, String> properties = convention.mapTaskProperties()
assertThat(properties.size(), equalTo(2))
assertThat(properties.haltOnFailure, equalTo(convention.haltOnFailure))
- assertThat(properties.options, equalTo(myOptions))
+ assertThat(properties.options, equalTo(convention.options))
}
}
@@ -19,31 +19,27 @@ class JSLintPluginTest
private static final String ERROR_JS = 'errorjs.js'
private static final String PASSING_JS = 'simplejs.js'
- @Rule
- public TemporaryFolder tmpDir = new TemporaryFolder();
private Project project
private JSLintPlugin plugin
@Before
public void setup()
{
- project = ProjectBuilder.builder().withProjectDir(tmpDir.folder).build()
+ project = ProjectBuilder.builder().build()
plugin = new JSLintPlugin()
}
@Test
public void conventionShouldBeRegisteredOnApply()
{
plugin.apply(project)
-
assertThat(project.convention.plugins.jslint, instanceOf(JSLintPluginConvention))
}
@Test
public void taskShouldBeAddedOnApply()
{
plugin.apply(project)
-
Set<Task> tasks = project.getTasksByName(JSLintPlugin.TASK_NAME, false)
assertThat(tasks.size(), equalTo(1))
}

0 comments on commit 1611d5c

Please sign in to comment.