more java tests moved to community

This commit is contained in:
Alexey Kudravtsev
2010-06-25 12:46:40 +04:00
parent 735a9d17a8
commit 2718da9fc7
1139 changed files with 14287 additions and 0 deletions
@@ -0,0 +1,13 @@
// "Add Catch Clause(s)" "true"
class a {
void g() throws Exception {
}
void f() {
try {
g();
} catch (Error e) {
} catch (Exception e) {
<caret><selection>e.printStackTrace(); //To change body of catch statement use File | Settings | File Templates.</selection>
}
}
}
@@ -0,0 +1,16 @@
// "Add Catch Clause(s)" "true"
class a {
void g() throws Exception {
}
// initializer
{
try {
// comment before
g();
// comment after
} catch (Exception e) {
<caret><selection>e.printStackTrace(); //To change body of catch statement use File | Settings | File Templates.</selection>
}
}
}
@@ -0,0 +1,16 @@
// "Add Catch Clause(s)" "true"
class MyException1 extends Exception {}
class MyException2 extends Exception {}
class Test {
void foo () throws MyException1, MyException2 {}
void bar () {
try {
foo();
} catch (MyException1 e) {
} catch (MyException2 myException2) {
<caret><selection>myException2.printStackTrace(); //To change body of catch statement use File | Settings | File Templates.</selection>
}
}
}
@@ -0,0 +1,21 @@
// "Add Catch Clause(s)" "true"
import java.io.FileNotFoundException;
import java.io.IOException;
class CatchExceptions {
void foo() throws java.io.IOException, java.io.FileNotFoundException {
}
void bar() {
try {
foo();
} catch (FileNotFoundException e) {
<selection>e.printStackTrace(); //To change body of catch statement use File | Settings | File Templates.</selection>
} catch (IOException e) {
e.printStackTrace(); //To change body of catch statement use File | Settings | File Templates.
}
}
}
@@ -0,0 +1,11 @@
// "Add Catch Clause(s)" "true"
class a {
void g() throws Exception {
}
void f() {
try {
<caret>g();
} catch (Error e) {
}
}
}
@@ -0,0 +1,20 @@
// "Add Catch Clause(s)" "false"
// should not try to add catch clauses across method boundaries
class s {
int f() throws Exception {
Runnable runnable = new Runnable() {
public void run() {
try {
Runnable runnable = new Runnable() {
public void run() {
<caret>int i = f();//
}
};
} catch (Exception e) {
}
}
};
return 0;
}
}
@@ -0,0 +1,14 @@
// "Add Catch Clause(s)" "true"
class a {
void g() throws Exception {
}
// initializer
{
try {
// comment before
<caret>g();
// comment after
}
}
}
@@ -0,0 +1,14 @@
// "Add Catch Clause(s)" "true"
class MyException1 extends Exception {}
class MyException2 extends Exception {}
class Test {
void foo () throws MyException1, MyException2 {}
void bar () {
try {
<caret>foo();
} catch (MyException1 e) {
}
}
}
@@ -0,0 +1,13 @@
// "Add Catch Clause(s)" "true"
class CatchExceptions {
void foo() throws java.io.IOException, java.io.FileNotFoundException {
}
void bar() {
try {
foo();<caret>
}
}
}