100% UTs coverage for Checker (no way to reproduce/mock IOException). #1294

This commit is contained in:
Roman Ivanov 2015-08-05 17:06:17 +03:00
parent 3fe08f2968
commit ead1a5e5dc
3 changed files with 1 additions and 10 deletions

View File

@ -1078,8 +1078,6 @@
<totalBranchRate>89</totalBranchRate>
<totalLineRate>95</totalLineRate>
<regexes>
<regex><pattern>.*.Checker</pattern><branchRate>100</branchRate><lineRate>97</lineRate></regex>
<regex><pattern>.*.checks.AbstractOptionCheck</pattern><branchRate>100</branchRate><lineRate>80</lineRate></regex>
<regex><pattern>.*.checks.AbstractTypeAwareCheck</pattern><branchRate>87</branchRate><lineRate>84</lineRate></regex>
<regex><pattern>.*.checks.AbstractTypeAwareCheck\$.*</pattern><branchRate>50</branchRate><lineRate>80</lineRate></regex>

View File

@ -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,

View File

@ -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),