@@ -50,8 +50,6 @@ protected void setUp() throws Exception {
50
50
51
51
/**
52
52
* Test CPDReport given the default configuration
53
- *
54
- * @throws Exception
55
53
*/
56
54
public void testDefaultConfiguration () throws Exception {
57
55
File generatedReport =
@@ -72,8 +70,6 @@ public void testDefaultConfiguration() throws Exception {
72
70
73
71
/**
74
72
* Test CPDReport with the text renderer given as "format=txt"
75
- *
76
- * @throws Exception
77
73
*/
78
74
public void testTxtFormat () throws Exception {
79
75
generateReport (getGoal (), "custom-configuration/cpd-txt-format-configuration-plugin-config.xml" );
@@ -94,8 +90,6 @@ public void testTxtFormat() throws Exception {
94
90
95
91
/**
96
92
* Test CpdReport using custom configuration
97
- *
98
- * @throws Exception
99
93
*/
100
94
public void testCustomConfiguration () throws Exception {
101
95
File generatedReport =
@@ -118,8 +112,6 @@ public void testCustomConfiguration() throws Exception {
118
112
119
113
/**
120
114
* Test CPDReport with invalid format
121
- *
122
- * @throws Exception
123
115
*/
124
116
public void testInvalidFormat () throws Exception {
125
117
try {
@@ -130,8 +122,9 @@ public void testInvalidFormat() throws Exception {
130
122
mojo , "compileSourceRoots" , mojo .getProject ().getCompileSourceRoots ());
131
123
generateReport (mojo , testPom );
132
124
133
- fail ("MavenReportException must be thrown" );
134
- } catch (Exception e ) {
125
+ // TODO this should be a more specific subclass
126
+ fail ("RuntimeException must be thrown" );
127
+ } catch (RuntimeException e ) {
135
128
assertMavenReportException ("Can't find CPD custom format xhtml" , e );
136
129
}
137
130
}
@@ -259,13 +252,11 @@ public void testWithCpdErrors() throws Exception {
259
252
}
260
253
261
254
private static void assertMavenReportException (String expectedMessage , Exception exception ) {
255
+ MavenReportException cause = (MavenReportException ) exception .getCause ();
256
+ String message = cause .getMessage ();
262
257
assertTrue (
263
- "Expected MavenReportException, but was: " + exception ,
264
- exception .getCause () instanceof MavenReportException );
265
- exception = (Exception ) exception .getCause ();
266
- assertTrue (
267
- "Wrong message: expected: " + expectedMessage + ", but was: " + exception .toString (),
268
- exception .toString ().contains (expectedMessage ));
258
+ "Wrong message: expected: " + expectedMessage + ", but was: " + message ,
259
+ message .contains (expectedMessage ));
269
260
}
270
261
271
262
private static void assertReportContains (String expectedMessage ) throws IOException {
0 commit comments