Skip to content

Commit

Permalink
CauseParameterInExceptionCheck_195 Compilable UT Input
Browse files Browse the repository at this point in the history
  • Loading branch information
alexkravin authored and Daniil Yaroslavtsev committed Sep 1, 2014
1 parent bd49ec1 commit 237cf05
Show file tree
Hide file tree
Showing 5 changed files with 42 additions and 27 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ public void testNormalWork2() throws Exception

String[] expected = {
"3:1: " + getCheckMessage(MSG_KEY, "InputCauseParameterInException2"),
"22:5: " + getCheckMessage(MSG_KEY, "MyException2"),
"16:5: " + getCheckMessage(MSG_KEY, "MyException2"),
};

verify(checkConfig, getPath("InputCauseParameterInException2.java"), expected);
Expand All @@ -72,7 +72,7 @@ public void testIgnorePattern() throws Exception
checkConfig.addAttribute("allowedCauseTypes", "Throwable, Exception");

String[] expected = {
"22:5: " + getCheckMessage(MSG_KEY, "MyException2"),
"16:5: " + getCheckMessage(MSG_KEY, "MyException2"),
};

verify(checkConfig, getPath("InputCauseParameterInException2.java"), expected);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import project.ParentException;
package com.github.sevntu.checkstyle.checks.design;

public class InputCauseParameterInException extends ParentException
{
Expand Down Expand Up @@ -32,12 +32,15 @@ public InputCauseParameterInException(String str, int integer)
{
super(str, null);
}

private class ParentException {

// public InputCauseParameterInException(String str, Throwable ex)
// {
// super(str, ex);
// }
public ParentException(String str, Exception e) {
}

public ParentException(Exception cause) {
}

}



}
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import project.ParentException;
package com.github.sevntu.checkstyle.checks.design;

public class InputCauseParameterInException2 extends ParentException
{
Expand All @@ -13,12 +13,6 @@ public InputCauseParameterInException2(String str, int integer)
super(str, null);
}

// public InputCauseParameterInException2(String str, Throwable ex)
// {
// super(str, ex);
// }


class MyException2 {

public MyException2()
Expand All @@ -33,10 +27,16 @@ public MyException2(String str, int integer)
{
}

// public MyException2(String str, Exception ex) // Exception | Throwable only!
// {
// }

}

public class ParentException {

public ParentException(String str, Exception e) {
}

public ParentException(Exception cause) {
}

}

}
Original file line number Diff line number Diff line change
@@ -1,19 +1,20 @@
package com.github.sevntu.checkstyle.checks.design;
@SuppressWarnings("serial")
public class QueryException extends RuntimeException {
public class InputCauseParameterInException3 extends RuntimeException {

public QueryException() {
public InputCauseParameterInException3() {
super();
}

public QueryException(String message) {
public InputCauseParameterInException3(String message) {
super(message);
}

public QueryException(Throwable cause) {
public InputCauseParameterInException3(Throwable cause) {
super(cause);
}

public QueryException(String message, Throwable cause) {
public InputCauseParameterInException3(String message, Throwable cause) {
super(message, cause);
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,18 @@
public class CompanyRiscEditor extends WorkbenchEditor<CompanyRiscEditorInput> {
package com.github.sevntu.checkstyle.checks.design;

public ConcurentModificationException(Exception cause) {
public class InputCauseParameterInException4 extends ParentException {

public InputCauseParameterInException4(Exception cause) {
super(cause);
}
public class ParentException {

public ParentException(String str, Exception e) {
}

public ParentException(Exception cause) {
}

}
}

0 comments on commit 237cf05

Please sign in to comment.