mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-08-26 03:13:40 +07:00
more java tests moved to community
This commit is contained in:
+13
@@ -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>
|
||||
}
|
||||
}
|
||||
}
|
||||
+16
@@ -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>
|
||||
}
|
||||
}
|
||||
}
|
||||
+16
@@ -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>
|
||||
}
|
||||
}
|
||||
}
|
||||
+21
@@ -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.
|
||||
}
|
||||
}
|
||||
}
|
||||
+11
@@ -0,0 +1,11 @@
|
||||
// "Add Catch Clause(s)" "true"
|
||||
class a {
|
||||
void g() throws Exception {
|
||||
}
|
||||
void f() {
|
||||
try {
|
||||
<caret>g();
|
||||
} catch (Error e) {
|
||||
}
|
||||
}
|
||||
}
|
||||
+20
@@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
+14
@@ -0,0 +1,14 @@
|
||||
// "Add Catch Clause(s)" "true"
|
||||
class a {
|
||||
void g() throws Exception {
|
||||
}
|
||||
|
||||
// initializer
|
||||
{
|
||||
try {
|
||||
// comment before
|
||||
<caret>g();
|
||||
// comment after
|
||||
}
|
||||
}
|
||||
}
|
||||
+14
@@ -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) {
|
||||
}
|
||||
}
|
||||
}
|
||||
+13
@@ -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>
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user