From c4f302d9e513c1ecbdcd45157f7c0fa81b663044 Mon Sep 17 00:00:00 2001 From: Paul Campbell Date: Mon, 29 May 2017 13:22:25 +0100 Subject: [PATCH 1/5] KCR33: builder: ReadmeWriterTest: outputProperties: make local Fixes #33 --- .../kemitix/checkstyle/ruleset/builder/ReadmeWriterTest.java | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/builder/src/test/java/net/kemitix/checkstyle/ruleset/builder/ReadmeWriterTest.java b/builder/src/test/java/net/kemitix/checkstyle/ruleset/builder/ReadmeWriterTest.java index bc45598..fa8612f 100644 --- a/builder/src/test/java/net/kemitix/checkstyle/ruleset/builder/ReadmeWriterTest.java +++ b/builder/src/test/java/net/kemitix/checkstyle/ruleset/builder/ReadmeWriterTest.java @@ -27,8 +27,6 @@ public class ReadmeWriterTest { private TemplateProperties templateProperties; - private OutputProperties outputProperties; - private RulesProperties rulesProperties; @Mock @@ -59,7 +57,7 @@ public class ReadmeWriterTest { templateProperties = new TemplateProperties(); templateProperties.setReadmeTemplate(template); templateProperties.setReadmeFragments(fragments); - outputProperties = new OutputProperties(); + final OutputProperties outputProperties = new OutputProperties(); outputProperties.setReadme(readme); rulesProperties = new RulesProperties(); readmeWriter = From d754fdc0a394a7f304dcb40141b7e40631f74d3e Mon Sep 17 00:00:00 2001 From: Paul Campbell Date: Mon, 29 May 2017 13:23:37 +0100 Subject: [PATCH 2/5] KCR34: builder: ReadmeWriterTest: template: make local variable --- .../checkstyle/ruleset/builder/ReadmeWriterTest.java | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/builder/src/test/java/net/kemitix/checkstyle/ruleset/builder/ReadmeWriterTest.java b/builder/src/test/java/net/kemitix/checkstyle/ruleset/builder/ReadmeWriterTest.java index fa8612f..61b584e 100644 --- a/builder/src/test/java/net/kemitix/checkstyle/ruleset/builder/ReadmeWriterTest.java +++ b/builder/src/test/java/net/kemitix/checkstyle/ruleset/builder/ReadmeWriterTest.java @@ -35,8 +35,6 @@ public class ReadmeWriterTest { @Mock private ReadmeIndexBuilder indexBuilder; - private Path template; - private Path fragments; private Path readme; @@ -47,8 +45,8 @@ public class ReadmeWriterTest { @Before public void setUp() throws Exception { MockitoAnnotations.initMocks(this); - template = folder.newFile("README-template.md") - .toPath(); + final Path template = folder.newFile("README-template.md") + .toPath(); Files.write(template, Arrays.asList("i:%s", "ce:%s", "se:%s", "cd:%s", "sd:%s")); fragments = folder.newFolder("fragments") .toPath(); From 74690d8cdfd39356fdb7e8f3516359ea5fd32b74 Mon Sep 17 00:00:00 2001 From: Paul Campbell Date: Mon, 29 May 2017 13:25:50 +0100 Subject: [PATCH 3/5] KCR35: builder: ReadmeWriterTest: fragments: make local variable --- .../checkstyle/ruleset/builder/ReadmeWriterTest.java | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/builder/src/test/java/net/kemitix/checkstyle/ruleset/builder/ReadmeWriterTest.java b/builder/src/test/java/net/kemitix/checkstyle/ruleset/builder/ReadmeWriterTest.java index 61b584e..df3b34f 100644 --- a/builder/src/test/java/net/kemitix/checkstyle/ruleset/builder/ReadmeWriterTest.java +++ b/builder/src/test/java/net/kemitix/checkstyle/ruleset/builder/ReadmeWriterTest.java @@ -35,8 +35,6 @@ public class ReadmeWriterTest { @Mock private ReadmeIndexBuilder indexBuilder; - private Path fragments; - private Path readme; @org.junit.Rule @@ -48,14 +46,14 @@ public class ReadmeWriterTest { final Path template = folder.newFile("README-template.md") .toPath(); Files.write(template, Arrays.asList("i:%s", "ce:%s", "se:%s", "cd:%s", "sd:%s")); - fragments = folder.newFolder("fragments") - .toPath(); - readme = folder.newFile("README.md") - .toPath(); templateProperties = new TemplateProperties(); templateProperties.setReadmeTemplate(template); + final Path fragments = folder.newFolder("fragments") + .toPath(); templateProperties.setReadmeFragments(fragments); final OutputProperties outputProperties = new OutputProperties(); + readme = folder.newFile("README.md") + .toPath(); outputProperties.setReadme(readme); rulesProperties = new RulesProperties(); readmeWriter = From 701b64e2c6eaebd0132bdf4d68872ebeb25e54aa Mon Sep 17 00:00:00 2001 From: Paul Campbell Date: Mon, 29 May 2017 13:27:24 +0100 Subject: [PATCH 4/5] builder: ReadmeWriterTest: templateProperties: make local variable --- .../kemitix/checkstyle/ruleset/builder/ReadmeWriterTest.java | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/builder/src/test/java/net/kemitix/checkstyle/ruleset/builder/ReadmeWriterTest.java b/builder/src/test/java/net/kemitix/checkstyle/ruleset/builder/ReadmeWriterTest.java index df3b34f..51ad769 100644 --- a/builder/src/test/java/net/kemitix/checkstyle/ruleset/builder/ReadmeWriterTest.java +++ b/builder/src/test/java/net/kemitix/checkstyle/ruleset/builder/ReadmeWriterTest.java @@ -25,8 +25,6 @@ public class ReadmeWriterTest { private ReadmeWriter readmeWriter; - private TemplateProperties templateProperties; - private RulesProperties rulesProperties; @Mock @@ -46,7 +44,7 @@ public class ReadmeWriterTest { final Path template = folder.newFile("README-template.md") .toPath(); Files.write(template, Arrays.asList("i:%s", "ce:%s", "se:%s", "cd:%s", "sd:%s")); - templateProperties = new TemplateProperties(); + final TemplateProperties templateProperties = new TemplateProperties(); templateProperties.setReadmeTemplate(template); final Path fragments = folder.newFolder("fragments") .toPath(); From 4cca4286a15ad566d3a4d7e561fad488893c2609 Mon Sep 17 00:00:00 2001 From: Paul Campbell Date: Mon, 29 May 2017 13:31:56 +0100 Subject: [PATCH 5/5] KXR36: plugin: DefaultCheckstyleExecutorTest: artifactFile: make local variable --- .../ruleset/plugin/DefaultCheckstyleExecutorTest.java | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/plugin/src/test/java/net/kemitix/checkstyle/ruleset/plugin/DefaultCheckstyleExecutorTest.java b/plugin/src/test/java/net/kemitix/checkstyle/ruleset/plugin/DefaultCheckstyleExecutorTest.java index b230eeb..8abc7b1 100644 --- a/plugin/src/test/java/net/kemitix/checkstyle/ruleset/plugin/DefaultCheckstyleExecutorTest.java +++ b/plugin/src/test/java/net/kemitix/checkstyle/ruleset/plugin/DefaultCheckstyleExecutorTest.java @@ -72,8 +72,6 @@ public class DefaultCheckstyleExecutorTest { @Mock private Artifact artifact; - private File artifactFile; - @Mock private MavenXpp3Reader mavenXpp3Reader; @@ -122,8 +120,8 @@ public class DefaultCheckstyleExecutorTest { .level(level) .build(); - artifactFile = folder.newFile("pom.xml"); given(artifactRepository.find(any())).willReturn(artifact); + final File artifactFile = folder.newFile("pom.xml"); given(artifact.getFile()).willReturn(artifactFile); given(mavenXpp3Reader.read(any(FileReader.class))).willReturn(pomModel); final Properties properties = new Properties();