From ead1a5e5dca96e2ad15426696f48a9c244385aff Mon Sep 17 00:00:00 2001 From: Roman Ivanov Date: Wed, 5 Aug 2015 17:06:17 +0300 Subject: [PATCH] 100% UTs coverage for Checker (no way to reproduce/mock IOException). #1294 --- pom.xml | 2 -- src/main/java/com/puppycrawl/tools/checkstyle/Checker.java | 7 ------- .../checks/whitespace/FileTabCharacterCheckTest.java | 2 +- 3 files changed, 1 insertion(+), 10 deletions(-) diff --git a/pom.xml b/pom.xml index 5e7272d2c..7761d689a 100644 --- a/pom.xml +++ b/pom.xml @@ -1078,8 +1078,6 @@ 89 95 - .*.Checker10097 - .*.checks.AbstractOptionCheck10080 .*.checks.AbstractTypeAwareCheck8784 .*.checks.AbstractTypeAwareCheck\$.*5080 diff --git a/src/main/java/com/puppycrawl/tools/checkstyle/Checker.java b/src/main/java/com/puppycrawl/tools/checkstyle/Checker.java index d56761b8f..c8f04fb30 100644 --- a/src/main/java/com/puppycrawl/tools/checkstyle/Checker.java +++ b/src/main/java/com/puppycrawl/tools/checkstyle/Checker.java @@ -20,7 +20,6 @@ package com.puppycrawl.tools.checkstyle; import java.io.File; -import java.io.FileNotFoundException; import java.io.IOException; import java.io.UnsupportedEncodingException; import java.nio.charset.Charset; @@ -262,12 +261,6 @@ public class Checker extends AutomaticBean implements MessageDispatcher { fileMessages.addAll(fsc.process(f, theText)); } } - catch (final FileNotFoundException fnfe) { - LOG.debug("FileNotFoundException occured.", fnfe); - fileMessages.add(new LocalizedMessage(0, - Definitions.CHECKSTYLE_BUNDLE, "general.fileNotFound", null, - null, this.getClass(), null)); - } catch (final IOException ioe) { LOG.debug("IOException occured.", ioe); fileMessages.add(new LocalizedMessage(0, diff --git a/src/test/java/com/puppycrawl/tools/checkstyle/checks/whitespace/FileTabCharacterCheckTest.java b/src/test/java/com/puppycrawl/tools/checkstyle/checks/whitespace/FileTabCharacterCheckTest.java index 97e584e51..71d4f118a 100644 --- a/src/test/java/com/puppycrawl/tools/checkstyle/checks/whitespace/FileTabCharacterCheckTest.java +++ b/src/test/java/com/puppycrawl/tools/checkstyle/checks/whitespace/FileTabCharacterCheckTest.java @@ -78,7 +78,7 @@ public class FileTabCharacterCheckTest final DefaultConfiguration checkConfig = createConfig(false); final String path = getPath("Claira"); final String[] expected = { - "0: File not found!", + "0: Got an exception - " + path + " (No such file or directory)", }; final File[] files = { new File(path),