Skip to content

Commit

Permalink
Remove redundant throws from ErrorProne tests.
Browse files Browse the repository at this point in the history
Automated with intellij, then reverted anything under //java/

RELNOTES: N/A

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=209939994
  • Loading branch information
graememorgan authored and ronshapiro committed Aug 29, 2018
1 parent 849c724 commit 0af4e18
Show file tree
Hide file tree
Showing 265 changed files with 1,428 additions and 1,476 deletions.
Expand Up @@ -64,7 +64,7 @@ final class BugPatternTestClass {}
} }


@Test @Test
public void linkTypeNoneButIncludesLink() throws Exception { public void linkTypeNoneButIncludesLink() {
@BugPattern( @BugPattern(
name = "LinkTypeNoneButIncludesLink", name = "LinkTypeNoneButIncludesLink",
summary = "linkType none but includes link", summary = "linkType none but includes link",
Expand Down Expand Up @@ -96,7 +96,7 @@ final class BugPatternTestClass {}
} }


@Test @Test
public void linkTypeCustomButNoLink() throws Exception { public void linkTypeCustomButNoLink() {
@BugPattern( @BugPattern(
name = "LinkTypeCustomButNoLink", name = "LinkTypeCustomButNoLink",
summary = "linkType custom but no link", summary = "linkType custom but no link",
Expand Down
Expand Up @@ -39,14 +39,14 @@
public class ErrorProneOptionsTest { public class ErrorProneOptionsTest {


@Test @Test
public void nonErrorProneFlagsPlacedInRemainingArgs() throws Exception { public void nonErrorProneFlagsPlacedInRemainingArgs() {
String[] args = {"-nonErrorProneFlag", "value"}; String[] args = {"-nonErrorProneFlag", "value"};
ErrorProneOptions options = ErrorProneOptions.processArgs(args); ErrorProneOptions options = ErrorProneOptions.processArgs(args);
assertThat(options.getRemainingArgs()).isEqualTo(args); assertThat(options.getRemainingArgs()).isEqualTo(args);
} }


@Test @Test
public void malformedOptionThrowsProperException() throws Exception { public void malformedOptionThrowsProperException() {
List<String> badArgs = List<String> badArgs =
Arrays.asList( Arrays.asList(
"-Xep:Foo:WARN:jfkdlsdf", // too many parts "-Xep:Foo:WARN:jfkdlsdf", // too many parts
Expand All @@ -64,7 +64,7 @@ public void malformedOptionThrowsProperException() throws Exception {
} }


@Test @Test
public void handlesErrorProneSeverityFlags() throws Exception { public void handlesErrorProneSeverityFlags() {
String[] args1 = {"-Xep:Check1"}; String[] args1 = {"-Xep:Check1"};
ErrorProneOptions options = ErrorProneOptions.processArgs(args1); ErrorProneOptions options = ErrorProneOptions.processArgs(args1);
Map<String, Severity> expectedSeverityMap = Map<String, Severity> expectedSeverityMap =
Expand All @@ -83,7 +83,7 @@ public void handlesErrorProneSeverityFlags() throws Exception {
} }


@Test @Test
public void handlesErrorProneCustomFlags() throws Exception { public void handlesErrorProneCustomFlags() {
String[] args = {"-XepOpt:Flag1", "-XepOpt:Flag2=Value2", "-XepOpt:Flag3=a,b,c"}; String[] args = {"-XepOpt:Flag1", "-XepOpt:Flag2=Value2", "-XepOpt:Flag3=a,b,c"};
ErrorProneOptions options = ErrorProneOptions.processArgs(args); ErrorProneOptions options = ErrorProneOptions.processArgs(args);
Map<String, String> expectedFlagsMap = Map<String, String> expectedFlagsMap =
Expand All @@ -96,7 +96,7 @@ public void handlesErrorProneCustomFlags() throws Exception {
} }


@Test @Test
public void combineErrorProneFlagsWithNonErrorProneFlags() throws Exception { public void combineErrorProneFlagsWithNonErrorProneFlags() {
String[] args = { String[] args = {
"-classpath", "-classpath",
"/this/is/classpath", "/this/is/classpath",
Expand All @@ -119,7 +119,7 @@ public void combineErrorProneFlagsWithNonErrorProneFlags() throws Exception {
} }


@Test @Test
public void lastSeverityFlagWins() throws Exception { public void lastSeverityFlagWins() {
String[] args = {"-Xep:Check1:ERROR", "-Xep:Check1:OFF"}; String[] args = {"-Xep:Check1:ERROR", "-Xep:Check1:OFF"};
ErrorProneOptions options = ErrorProneOptions.processArgs(args); ErrorProneOptions options = ErrorProneOptions.processArgs(args);
Map<String, Severity> expectedSeverityMap = Map<String, Severity> expectedSeverityMap =
Expand Down
20 changes: 10 additions & 10 deletions core/src/test/java/com/google/errorprone/CommandLineFlagTest.java
Expand Up @@ -117,7 +117,7 @@ public void setUp() {
/* Tests for new-style ("-Xep:") flags */ /* Tests for new-style ("-Xep:") flags */


@Test @Test
public void malformedFlag() throws Exception { public void malformedFlag() {
ErrorProneTestCompiler compiler = builder.build(); ErrorProneTestCompiler compiler = builder.build();


List<String> badArgs = List<String> badArgs =
Expand All @@ -137,7 +137,7 @@ public void malformedFlag() throws Exception {
// We have to use one of the built-in checkers for the following two tests because there is no // We have to use one of the built-in checkers for the following two tests because there is no
// way to specify a custom checker and have it be off by default. // way to specify a custom checker and have it be off by default.
@Test @Test
public void canEnableWithDefaultSeverity() throws Exception { public void canEnableWithDefaultSeverity() {
ErrorProneTestCompiler compiler = builder.build(); ErrorProneTestCompiler compiler = builder.build();
List<JavaFileObject> sources = List<JavaFileObject> sources =
compiler compiler
Expand All @@ -153,7 +153,7 @@ public void canEnableWithDefaultSeverity() throws Exception {
} }


@Test @Test
public void canEnableWithOverriddenSeverity() throws Exception { public void canEnableWithOverriddenSeverity() {
ErrorProneTestCompiler compiler = builder.build(); ErrorProneTestCompiler compiler = builder.build();
List<JavaFileObject> sources = List<JavaFileObject> sources =
compiler compiler
Expand All @@ -172,7 +172,7 @@ public void canEnableWithOverriddenSeverity() throws Exception {
} }


@Test @Test
public void canPromoteToError() throws Exception { public void canPromoteToError() {
ErrorProneTestCompiler compiler = ErrorProneTestCompiler compiler =
builder.report(ScannerSupplier.fromBugCheckerClasses(WarningChecker.class)).build(); builder.report(ScannerSupplier.fromBugCheckerClasses(WarningChecker.class)).build();
List<JavaFileObject> sources = List<JavaFileObject> sources =
Expand All @@ -187,7 +187,7 @@ public void canPromoteToError() throws Exception {
} }


@Test @Test
public void canDemoteToWarning() throws Exception { public void canDemoteToWarning() {
ErrorProneTestCompiler compiler = ErrorProneTestCompiler compiler =
builder.report(ScannerSupplier.fromBugCheckerClasses(ErrorChecker.class)).build(); builder.report(ScannerSupplier.fromBugCheckerClasses(ErrorChecker.class)).build();
List<JavaFileObject> sources = List<JavaFileObject> sources =
Expand All @@ -203,7 +203,7 @@ public void canDemoteToWarning() throws Exception {
} }


@Test @Test
public void canDisable() throws Exception { public void canDisable() {
ErrorProneTestCompiler compiler = ErrorProneTestCompiler compiler =
builder.report(ScannerSupplier.fromBugCheckerClasses(DisableableChecker.class)).build(); builder.report(ScannerSupplier.fromBugCheckerClasses(DisableableChecker.class)).build();
List<JavaFileObject> sources = List<JavaFileObject> sources =
Expand All @@ -219,7 +219,7 @@ public void canDisable() throws Exception {
} }


@Test @Test
public void cantDisableNondisableableCheck() throws Exception { public void cantDisableNondisableableCheck() {
ErrorProneTestCompiler compiler = ErrorProneTestCompiler compiler =
builder.report(ScannerSupplier.fromBugCheckerClasses(NondisableableChecker.class)).build(); builder.report(ScannerSupplier.fromBugCheckerClasses(NondisableableChecker.class)).build();
List<JavaFileObject> sources = List<JavaFileObject> sources =
Expand All @@ -231,7 +231,7 @@ public void cantDisableNondisableableCheck() throws Exception {
} }


@Test @Test
public void cantOverrideNonexistentCheck() throws Exception { public void cantOverrideNonexistentCheck() {
ErrorProneTestCompiler compiler = builder.build(); ErrorProneTestCompiler compiler = builder.build();
List<JavaFileObject> sources = List<JavaFileObject> sources =
compiler.fileManager().forResources(getClass(), "CommandLineFlagTestFile.java"); compiler.fileManager().forResources(getClass(), "CommandLineFlagTestFile.java");
Expand All @@ -250,7 +250,7 @@ public void cantOverrideNonexistentCheck() throws Exception {
} }


@Test @Test
public void cantOverrideByAltname() throws Exception { public void cantOverrideByAltname() {
ErrorProneTestCompiler compiler = ErrorProneTestCompiler compiler =
builder.report(ScannerSupplier.fromBugCheckerClasses(DisableableChecker.class)).build(); builder.report(ScannerSupplier.fromBugCheckerClasses(DisableableChecker.class)).build();
List<JavaFileObject> sources = List<JavaFileObject> sources =
Expand All @@ -262,7 +262,7 @@ public void cantOverrideByAltname() throws Exception {
} }


@Test @Test
public void ignoreUnknownChecksFlagAllowsOverridingUnknownCheck() throws Exception { public void ignoreUnknownChecksFlagAllowsOverridingUnknownCheck() {
ErrorProneTestCompiler compiler = builder.build(); ErrorProneTestCompiler compiler = builder.build();
List<JavaFileObject> sources = List<JavaFileObject> sources =
compiler.fileManager().forResources(getClass(), "CommandLineFlagTestFile.java"); compiler.fileManager().forResources(getClass(), "CommandLineFlagTestFile.java");
Expand Down
Expand Up @@ -72,7 +72,7 @@ public Description matchReturn(ReturnTree tree, VisitorState state) {
} }


@Test @Test
public void testError() throws Exception { public void testError() {
compilerBuilder.report(ScannerSupplier.fromBugCheckerClasses(ErrorChecker.class)); compilerBuilder.report(ScannerSupplier.fromBugCheckerClasses(ErrorChecker.class));
ErrorProneTestCompiler compiler = compilerBuilder.build(); ErrorProneTestCompiler compiler = compilerBuilder.build();
Result result = Result result =
Expand All @@ -99,7 +99,7 @@ public Description matchReturn(ReturnTree tree, VisitorState state) {
} }


@Test @Test
public void testWarning() throws Exception { public void testWarning() {
compilerBuilder.report(ScannerSupplier.fromBugCheckerClasses(WarningChecker.class)); compilerBuilder.report(ScannerSupplier.fromBugCheckerClasses(WarningChecker.class));
ErrorProneTestCompiler compiler = compilerBuilder.build(); ErrorProneTestCompiler compiler = compilerBuilder.build();
Result result = Result result =
Expand Down Expand Up @@ -127,7 +127,7 @@ public Description matchReturn(ReturnTree tree, VisitorState state) {
} }


@Test @Test
public void testSuggestion() throws Exception { public void testSuggestion() {
compilerBuilder.report(ScannerSupplier.fromBugCheckerClasses(SuggestionChecker.class)); compilerBuilder.report(ScannerSupplier.fromBugCheckerClasses(SuggestionChecker.class));
ErrorProneTestCompiler compiler = compilerBuilder.build(); ErrorProneTestCompiler compiler = compilerBuilder.build();
Result result = Result result =
Expand Down

0 comments on commit 0af4e18

Please sign in to comment.