< prev index next >
test/langtools/lib/combo/tools/javac/combo/JavacTemplateTestBase.java
Print this page
rev 51104 : imported patch switch
*** 176,185 ****
--- 176,193 ----
protected void assertCompileSucceeded() {
if (diags.errorsFound())
fail("Expected successful compilation");
}
+ /** Assert that all previous calls to compile() succeeded */
+ protected void assertCompileSucceededWithWarning(String warning) {
+ if (diags.errorsFound())
+ fail("Expected successful compilation");
+ if (!diags.containsWarningKey(warning))
+ fail("Expected compilation warning " + warning);
+ }
+
/**
* If the provided boolean is true, assert all previous compiles succeeded,
* otherwise assert that a compile failed.
* */
protected void assertCompileSucceededIff(boolean b) {
*** 194,206 ****
if (!diags.errorsFound())
fail("Expected failed compilation");
}
/** Assert that a previous call to compile() failed with a specific error key */
! protected void assertCompileFailed(String message) {
if (!diags.errorsFound())
! fail("Expected failed compilation: " + message);
}
/** Assert that a previous call to compile() failed with all of the specified error keys */
protected void assertCompileErrors(String... keys) {
if (!diags.errorsFound())
--- 202,227 ----
if (!diags.errorsFound())
fail("Expected failed compilation");
}
/** Assert that a previous call to compile() failed with a specific error key */
! protected void assertCompileFailed(String key) {
! if (!diags.errorsFound())
! fail("Expected failed compilation: " + key);
! if (!diags.containsErrorKey(key))
! fail("Expected compilation error " + key);
! }
!
! /** Assert that a previous call to compile() failed with a specific error key */
! protected void assertCompileFailedOneOf(String... keys) {
if (!diags.errorsFound())
! fail("Expected failed compilation with one of: " + Arrays.asList(keys));
! boolean found = false;
! for (String k : keys)
! if (diags.containsErrorKey(k))
! found = true;
! fail(String.format("Expected compilation error with one of %s, found %s", Arrays.asList(keys), diags.keys()));
}
/** Assert that a previous call to compile() failed with all of the specified error keys */
protected void assertCompileErrors(String... keys) {
if (!diags.errorsFound())
< prev index next >