зеркало из https://github.com/mozilla/pluotsorbet.git
Add some tests for exceptions
This commit is contained in:
Родитель
d8d973e3c5
Коммит
82cb6d1a21
|
@ -0,0 +1,61 @@
|
|||
// Test if try-catch block is working properly for a class java.lang.ArithmeticException
|
||||
|
||||
// Copyright (C) 2012, 2013 Pavel Tisnovsky <ptisnovs@redhat.com>
|
||||
|
||||
// This file is part of Mauve.
|
||||
|
||||
// Mauve is free software; you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation; either version 2, or (at your option)
|
||||
// any later version.
|
||||
|
||||
// Mauve is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with Mauve; see the file COPYING. If not, write to
|
||||
// the Free Software Foundation, Inc., 51 Franklin Street,
|
||||
// Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
|
||||
// Tags: JDK1.5
|
||||
|
||||
package gnu.testlet.java.lang.ArithmeticException;
|
||||
|
||||
import gnu.testlet.TestHarness;
|
||||
import gnu.testlet.Testlet;
|
||||
|
||||
import java.lang.ArithmeticException;
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Test if try-catch block is working properly for a class java.lang.ArithmeticException
|
||||
*/
|
||||
public class TryCatch implements Testlet
|
||||
{
|
||||
public int getExpectedPass() { return 1; }
|
||||
public int getExpectedFail() { return 0; }
|
||||
public int getExpectedKnownFail() { return 0; }
|
||||
|
||||
/**
|
||||
* Runs the test using the specified harness.
|
||||
*
|
||||
* @param harness the test harness (<code>null</code> not permitted).
|
||||
*/
|
||||
public void test(TestHarness harness)
|
||||
{
|
||||
// flag that is set when exception is caught
|
||||
boolean caught = false;
|
||||
try {
|
||||
throw new ArithmeticException("ArithmeticException");
|
||||
}
|
||||
catch (ArithmeticException e) {
|
||||
// correct exception was caught
|
||||
caught = true;
|
||||
}
|
||||
harness.check(caught);
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,64 @@
|
|||
// Test if instances of a class java.lang.ArithmeticException could be properly constructed
|
||||
|
||||
// Copyright (C) 2012, 2013 Pavel Tisnovsky <ptisnovs@redhat.com>
|
||||
|
||||
// This file is part of Mauve.
|
||||
|
||||
// Mauve is free software; you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation; either version 2, or (at your option)
|
||||
// any later version.
|
||||
|
||||
// Mauve is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with Mauve; see the file COPYING. If not, write to
|
||||
// the Free Software Foundation, Inc., 51 Franklin Street,
|
||||
// Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
|
||||
// Tags: JDK1.5
|
||||
|
||||
package gnu.testlet.java.lang.ArithmeticException;
|
||||
|
||||
import gnu.testlet.TestHarness;
|
||||
import gnu.testlet.Testlet;
|
||||
|
||||
import java.lang.ArithmeticException;
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Test if instances of a class java.lang.ArithmeticException
|
||||
* could be properly constructed
|
||||
*/
|
||||
public class constructor implements Testlet
|
||||
{
|
||||
public int getExpectedPass() { return 6; }
|
||||
public int getExpectedFail() { return 0; }
|
||||
public int getExpectedKnownFail() { return 0; }
|
||||
|
||||
/**
|
||||
* Runs the test using the specified harness.
|
||||
*
|
||||
* @param harness the test harness (<code>null</code> not permitted).
|
||||
*/
|
||||
public void test(TestHarness harness)
|
||||
{
|
||||
ArithmeticException object1 = new ArithmeticException();
|
||||
harness.check(object1 != null);
|
||||
harness.check(object1.toString(), "java.lang.ArithmeticException");
|
||||
|
||||
ArithmeticException object2 = new ArithmeticException("nothing happens");
|
||||
harness.check(object2 != null);
|
||||
harness.check(object2.toString(), "java.lang.ArithmeticException: nothing happens");
|
||||
|
||||
ArithmeticException object3 = new ArithmeticException(null);
|
||||
harness.check(object3 != null);
|
||||
harness.check(object3.toString(), "java.lang.ArithmeticException");
|
||||
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,61 @@
|
|||
// Test if try-catch block is working properly for a class java.lang.ArrayIndexOutOfBoundsException
|
||||
|
||||
// Copyright (C) 2012, 2013 Pavel Tisnovsky <ptisnovs@redhat.com>
|
||||
|
||||
// This file is part of Mauve.
|
||||
|
||||
// Mauve is free software; you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation; either version 2, or (at your option)
|
||||
// any later version.
|
||||
|
||||
// Mauve is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with Mauve; see the file COPYING. If not, write to
|
||||
// the Free Software Foundation, Inc., 51 Franklin Street,
|
||||
// Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
|
||||
// Tags: JDK1.5
|
||||
|
||||
package gnu.testlet.java.lang.ArrayIndexOutOfBoundsException;
|
||||
|
||||
import gnu.testlet.TestHarness;
|
||||
import gnu.testlet.Testlet;
|
||||
|
||||
import java.lang.ArrayIndexOutOfBoundsException;
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Test if try-catch block is working properly for a class java.lang.ArrayIndexOutOfBoundsException
|
||||
*/
|
||||
public class TryCatch implements Testlet
|
||||
{
|
||||
public int getExpectedPass() { return 1; }
|
||||
public int getExpectedFail() { return 0; }
|
||||
public int getExpectedKnownFail() { return 0; }
|
||||
|
||||
/**
|
||||
* Runs the test using the specified harness.
|
||||
*
|
||||
* @param harness the test harness (<code>null</code> not permitted).
|
||||
*/
|
||||
public void test(TestHarness harness)
|
||||
{
|
||||
// flag that is set when exception is caught
|
||||
boolean caught = false;
|
||||
try {
|
||||
throw new ArrayIndexOutOfBoundsException("ArrayIndexOutOfBoundsException");
|
||||
}
|
||||
catch (ArrayIndexOutOfBoundsException e) {
|
||||
// correct exception was caught
|
||||
caught = true;
|
||||
}
|
||||
harness.check(caught);
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,76 @@
|
|||
// Test if instances of a class java.lang.ArrayIndexOutOfBoundsException could be properly constructed
|
||||
|
||||
// Copyright (C) 2012, 2013 Pavel Tisnovsky <ptisnovs@redhat.com>
|
||||
|
||||
// This file is part of Mauve.
|
||||
|
||||
// Mauve is free software; you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation; either version 2, or (at your option)
|
||||
// any later version.
|
||||
|
||||
// Mauve is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with Mauve; see the file COPYING. If not, write to
|
||||
// the Free Software Foundation, Inc., 51 Franklin Street,
|
||||
// Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
|
||||
// Tags: JDK1.5
|
||||
|
||||
package gnu.testlet.java.lang.ArrayIndexOutOfBoundsException;
|
||||
|
||||
import gnu.testlet.TestHarness;
|
||||
import gnu.testlet.Testlet;
|
||||
|
||||
import java.lang.ArrayIndexOutOfBoundsException;
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Test if instances of a class java.lang.ArrayIndexOutOfBoundsException
|
||||
* could be properly constructed
|
||||
*/
|
||||
public class constructor implements Testlet
|
||||
{
|
||||
public int getExpectedPass() { return 12; }
|
||||
public int getExpectedFail() { return 0; }
|
||||
public int getExpectedKnownFail() { return 0; }
|
||||
|
||||
/**
|
||||
* Runs the test using the specified harness.
|
||||
*
|
||||
* @param harness the test harness (<code>null</code> not permitted).
|
||||
*/
|
||||
public void test(TestHarness harness)
|
||||
{
|
||||
ArrayIndexOutOfBoundsException object1 = new ArrayIndexOutOfBoundsException();
|
||||
harness.check(object1 != null);
|
||||
harness.check(object1.toString(), "java.lang.ArrayIndexOutOfBoundsException");
|
||||
|
||||
ArrayIndexOutOfBoundsException object2 = new ArrayIndexOutOfBoundsException("nothing happens");
|
||||
harness.check(object2 != null);
|
||||
harness.check(object2.toString(), "java.lang.ArrayIndexOutOfBoundsException: nothing happens");
|
||||
|
||||
ArrayIndexOutOfBoundsException object3 = new ArrayIndexOutOfBoundsException(null);
|
||||
harness.check(object3 != null);
|
||||
harness.check(object3.toString(), "java.lang.ArrayIndexOutOfBoundsException");
|
||||
|
||||
ArrayIndexOutOfBoundsException object4 = new ArrayIndexOutOfBoundsException(0);
|
||||
harness.check(object4 != null);
|
||||
harness.check(object4.toString(), "java.lang.ArrayIndexOutOfBoundsException: 0");
|
||||
|
||||
ArrayIndexOutOfBoundsException object5 = new ArrayIndexOutOfBoundsException(-1);
|
||||
harness.check(object5 != null);
|
||||
harness.check(object5.toString(), "java.lang.ArrayIndexOutOfBoundsException: -1");
|
||||
|
||||
ArrayIndexOutOfBoundsException object6 = new ArrayIndexOutOfBoundsException(Integer.MAX_VALUE);
|
||||
harness.check(object6 != null);
|
||||
harness.check(object6.toString(), "java.lang.ArrayIndexOutOfBoundsException: 2147483647");
|
||||
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,59 @@
|
|||
// Test if try-catch block is working properly for a class java.lang.ArrayStoreException
|
||||
|
||||
// Copyright (C) 2012 Pavel Tisnovsky <ptisnovs@redhat.com>
|
||||
|
||||
// This file is part of Mauve.
|
||||
|
||||
// Mauve is free software; you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation; either version 2, or (at your option)
|
||||
// any later version.
|
||||
|
||||
// Mauve is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with Mauve; see the file COPYING. If not, write to
|
||||
// the Free Software Foundation, Inc., 51 Franklin Street,
|
||||
// Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
|
||||
package gnu.testlet.java.lang.ArrayStoreException;
|
||||
|
||||
import gnu.testlet.TestHarness;
|
||||
import gnu.testlet.Testlet;
|
||||
|
||||
import java.lang.ArrayStoreException;
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Test if try-catch block is working properly for a class java.lang.ArrayStoreException
|
||||
*/
|
||||
public class TryCatch implements Testlet
|
||||
{
|
||||
public int getExpectedPass() { return 1; }
|
||||
public int getExpectedFail() { return 0; }
|
||||
public int getExpectedKnownFail() { return 0; }
|
||||
|
||||
/**
|
||||
* Runs the test using the specified harness.
|
||||
*
|
||||
* @param harness the test harness (<code>null</code> not permitted).
|
||||
*/
|
||||
public void test(TestHarness harness)
|
||||
{
|
||||
// flag that is set when exception is caught
|
||||
boolean caught = false;
|
||||
try {
|
||||
throw new ArrayStoreException("ArrayStoreException");
|
||||
}
|
||||
catch (ArrayStoreException e) {
|
||||
// correct exception was caught
|
||||
caught = true;
|
||||
}
|
||||
harness.check(caught);
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,62 @@
|
|||
// Test if instances of a class java.lang.ArrayStoreException could be properly constructed
|
||||
|
||||
// Copyright (C) 2012 Pavel Tisnovsky <ptisnovs@redhat.com>
|
||||
|
||||
// This file is part of Mauve.
|
||||
|
||||
// Mauve is free software; you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation; either version 2, or (at your option)
|
||||
// any later version.
|
||||
|
||||
// Mauve is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with Mauve; see the file COPYING. If not, write to
|
||||
// the Free Software Foundation, Inc., 51 Franklin Street,
|
||||
// Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
|
||||
package gnu.testlet.java.lang.ArrayStoreException;
|
||||
|
||||
import gnu.testlet.TestHarness;
|
||||
import gnu.testlet.Testlet;
|
||||
|
||||
import java.lang.ArrayStoreException;
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Test if instances of a class java.lang.ArrayStoreException
|
||||
* could be properly constructed
|
||||
*/
|
||||
public class constructor implements Testlet
|
||||
{
|
||||
public int getExpectedPass() { return 6; }
|
||||
public int getExpectedFail() { return 0; }
|
||||
public int getExpectedKnownFail() { return 0; }
|
||||
|
||||
/**
|
||||
* Runs the test using the specified harness.
|
||||
*
|
||||
* @param harness the test harness (<code>null</code> not permitted).
|
||||
*/
|
||||
public void test(TestHarness harness)
|
||||
{
|
||||
ArrayStoreException object1 = new ArrayStoreException();
|
||||
harness.check(object1 != null);
|
||||
harness.check(object1.toString(), "java.lang.ArrayStoreException");
|
||||
|
||||
ArrayStoreException object2 = new ArrayStoreException("nothing happens");
|
||||
harness.check(object2 != null);
|
||||
harness.check(object2.toString(), "java.lang.ArrayStoreException: nothing happens");
|
||||
|
||||
ArrayStoreException object3 = new ArrayStoreException(null);
|
||||
harness.check(object3 != null);
|
||||
harness.check(object3.toString(), "java.lang.ArrayStoreException");
|
||||
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,59 @@
|
|||
// Test if try-catch block is working properly for a class java.lang.ClassCastException
|
||||
|
||||
// Copyright (C) 2012 Pavel Tisnovsky <ptisnovs@redhat.com>
|
||||
|
||||
// This file is part of Mauve.
|
||||
|
||||
// Mauve is free software; you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation; either version 2, or (at your option)
|
||||
// any later version.
|
||||
|
||||
// Mauve is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with Mauve; see the file COPYING. If not, write to
|
||||
// the Free Software Foundation, Inc., 51 Franklin Street,
|
||||
// Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
|
||||
package gnu.testlet.java.lang.ClassCastException;
|
||||
|
||||
import gnu.testlet.TestHarness;
|
||||
import gnu.testlet.Testlet;
|
||||
|
||||
import java.lang.ClassCastException;
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Test if try-catch block is working properly for a class java.lang.ClassCastException
|
||||
*/
|
||||
public class TryCatch implements Testlet
|
||||
{
|
||||
public int getExpectedPass() { return 1; }
|
||||
public int getExpectedFail() { return 0; }
|
||||
public int getExpectedKnownFail() { return 0; }
|
||||
|
||||
/**
|
||||
* Runs the test using the specified harness.
|
||||
*
|
||||
* @param harness the test harness (<code>null</code> not permitted).
|
||||
*/
|
||||
public void test(TestHarness harness)
|
||||
{
|
||||
// flag that is set when exception is caught
|
||||
boolean caught = false;
|
||||
try {
|
||||
throw new ClassCastException("ClassCastException");
|
||||
}
|
||||
catch (ClassCastException e) {
|
||||
// correct exception was caught
|
||||
caught = true;
|
||||
}
|
||||
harness.check(caught);
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,62 @@
|
|||
// Test if instances of a class java.lang.ClassCastException could be properly constructed
|
||||
|
||||
// Copyright (C) 2012 Pavel Tisnovsky <ptisnovs@redhat.com>
|
||||
|
||||
// This file is part of Mauve.
|
||||
|
||||
// Mauve is free software; you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation; either version 2, or (at your option)
|
||||
// any later version.
|
||||
|
||||
// Mauve is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with Mauve; see the file COPYING. If not, write to
|
||||
// the Free Software Foundation, Inc., 51 Franklin Street,
|
||||
// Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
|
||||
package gnu.testlet.java.lang.ClassCastException;
|
||||
|
||||
import gnu.testlet.TestHarness;
|
||||
import gnu.testlet.Testlet;
|
||||
|
||||
import java.lang.ClassCastException;
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Test if instances of a class java.lang.ClassCastException
|
||||
* could be properly constructed
|
||||
*/
|
||||
public class constructor implements Testlet
|
||||
{
|
||||
public int getExpectedPass() { return 6; }
|
||||
public int getExpectedFail() { return 0; }
|
||||
public int getExpectedKnownFail() { return 0; }
|
||||
|
||||
/**
|
||||
* Runs the test using the specified harness.
|
||||
*
|
||||
* @param harness the test harness (<code>null</code> not permitted).
|
||||
*/
|
||||
public void test(TestHarness harness)
|
||||
{
|
||||
ClassCastException object1 = new ClassCastException();
|
||||
harness.check(object1 != null);
|
||||
harness.check(object1.toString(), "java.lang.ClassCastException");
|
||||
|
||||
ClassCastException object2 = new ClassCastException("nothing happens");
|
||||
harness.check(object2 != null);
|
||||
harness.check(object2.toString(), "java.lang.ClassCastException: nothing happens");
|
||||
|
||||
ClassCastException object3 = new ClassCastException(null);
|
||||
harness.check(object3 != null);
|
||||
harness.check(object3.toString(), "java.lang.ClassCastException");
|
||||
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,59 @@
|
|||
// Test if try-catch block is working properly for a class java.lang.IllegalMonitorStateException
|
||||
|
||||
// Copyright (C) 2012 Pavel Tisnovsky <ptisnovs@redhat.com>
|
||||
|
||||
// This file is part of Mauve.
|
||||
|
||||
// Mauve is free software; you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation; either version 2, or (at your option)
|
||||
// any later version.
|
||||
|
||||
// Mauve is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with Mauve; see the file COPYING. If not, write to
|
||||
// the Free Software Foundation, Inc., 51 Franklin Street,
|
||||
// Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
|
||||
package gnu.testlet.java.lang.IllegalMonitorStateException;
|
||||
|
||||
import gnu.testlet.TestHarness;
|
||||
import gnu.testlet.Testlet;
|
||||
|
||||
import java.lang.IllegalMonitorStateException;
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Test if try-catch block is working properly for a class java.lang.IllegalMonitorStateException
|
||||
*/
|
||||
public class TryCatch implements Testlet
|
||||
{
|
||||
public int getExpectedPass() { return 1; }
|
||||
public int getExpectedFail() { return 0; }
|
||||
public int getExpectedKnownFail() { return 0; }
|
||||
|
||||
/**
|
||||
* Runs the test using the specified harness.
|
||||
*
|
||||
* @param harness the test harness (<code>null</code> not permitted).
|
||||
*/
|
||||
public void test(TestHarness harness)
|
||||
{
|
||||
// flag that is set when exception is caught
|
||||
boolean caught = false;
|
||||
try {
|
||||
throw new IllegalMonitorStateException("IllegalMonitorStateException");
|
||||
}
|
||||
catch (IllegalMonitorStateException e) {
|
||||
// correct exception was caught
|
||||
caught = true;
|
||||
}
|
||||
harness.check(caught);
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,62 @@
|
|||
// Test if instances of a class java.lang.IllegalMonitorStateException could be properly constructed
|
||||
|
||||
// Copyright (C) 2012 Pavel Tisnovsky <ptisnovs@redhat.com>
|
||||
|
||||
// This file is part of Mauve.
|
||||
|
||||
// Mauve is free software; you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation; either version 2, or (at your option)
|
||||
// any later version.
|
||||
|
||||
// Mauve is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with Mauve; see the file COPYING. If not, write to
|
||||
// the Free Software Foundation, Inc., 51 Franklin Street,
|
||||
// Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
|
||||
package gnu.testlet.java.lang.IllegalMonitorStateException;
|
||||
|
||||
import gnu.testlet.TestHarness;
|
||||
import gnu.testlet.Testlet;
|
||||
|
||||
import java.lang.IllegalMonitorStateException;
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Test if instances of a class java.lang.IllegalMonitorStateException
|
||||
* could be properly constructed
|
||||
*/
|
||||
public class constructor implements Testlet
|
||||
{
|
||||
public int getExpectedPass() { return 6; }
|
||||
public int getExpectedFail() { return 0; }
|
||||
public int getExpectedKnownFail() { return 0; }
|
||||
|
||||
/**
|
||||
* Runs the test using the specified harness.
|
||||
*
|
||||
* @param harness the test harness (<code>null</code> not permitted).
|
||||
*/
|
||||
public void test(TestHarness harness)
|
||||
{
|
||||
IllegalMonitorStateException object1 = new IllegalMonitorStateException();
|
||||
harness.check(object1 != null);
|
||||
harness.check(object1.toString(), "java.lang.IllegalMonitorStateException");
|
||||
|
||||
IllegalMonitorStateException object2 = new IllegalMonitorStateException("nothing happens");
|
||||
harness.check(object2 != null);
|
||||
harness.check(object2.toString(), "java.lang.IllegalMonitorStateException: nothing happens");
|
||||
|
||||
IllegalMonitorStateException object3 = new IllegalMonitorStateException(null);
|
||||
harness.check(object3 != null);
|
||||
harness.check(object3.toString(), "java.lang.IllegalMonitorStateException");
|
||||
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,59 @@
|
|||
// Test if try-catch block is working properly for a class java.lang.IllegalThreadStateException
|
||||
|
||||
// Copyright (C) 2012 Pavel Tisnovsky <ptisnovs@redhat.com>
|
||||
|
||||
// This file is part of Mauve.
|
||||
|
||||
// Mauve is free software; you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation; either version 2, or (at your option)
|
||||
// any later version.
|
||||
|
||||
// Mauve is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with Mauve; see the file COPYING. If not, write to
|
||||
// the Free Software Foundation, Inc., 51 Franklin Street,
|
||||
// Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
|
||||
package gnu.testlet.java.lang.IllegalThreadStateException;
|
||||
|
||||
import gnu.testlet.TestHarness;
|
||||
import gnu.testlet.Testlet;
|
||||
|
||||
import java.lang.IllegalThreadStateException;
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Test if try-catch block is working properly for a class java.lang.IllegalThreadStateException
|
||||
*/
|
||||
public class TryCatch implements Testlet
|
||||
{
|
||||
public int getExpectedPass() { return 1; }
|
||||
public int getExpectedFail() { return 0; }
|
||||
public int getExpectedKnownFail() { return 0; }
|
||||
|
||||
/**
|
||||
* Runs the test using the specified harness.
|
||||
*
|
||||
* @param harness the test harness (<code>null</code> not permitted).
|
||||
*/
|
||||
public void test(TestHarness harness)
|
||||
{
|
||||
// flag that is set when exception is caught
|
||||
boolean caught = false;
|
||||
try {
|
||||
throw new IllegalThreadStateException("IllegalThreadStateException");
|
||||
}
|
||||
catch (IllegalThreadStateException e) {
|
||||
// correct exception was caught
|
||||
caught = true;
|
||||
}
|
||||
harness.check(caught);
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,62 @@
|
|||
// Test if instances of a class java.lang.IllegalThreadStateException could be properly constructed
|
||||
|
||||
// Copyright (C) 2012 Pavel Tisnovsky <ptisnovs@redhat.com>
|
||||
|
||||
// This file is part of Mauve.
|
||||
|
||||
// Mauve is free software; you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation; either version 2, or (at your option)
|
||||
// any later version.
|
||||
|
||||
// Mauve is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with Mauve; see the file COPYING. If not, write to
|
||||
// the Free Software Foundation, Inc., 51 Franklin Street,
|
||||
// Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
|
||||
package gnu.testlet.java.lang.IllegalThreadStateException;
|
||||
|
||||
import gnu.testlet.TestHarness;
|
||||
import gnu.testlet.Testlet;
|
||||
|
||||
import java.lang.IllegalThreadStateException;
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Test if instances of a class java.lang.IllegalThreadStateException
|
||||
* could be properly constructed
|
||||
*/
|
||||
public class constructor implements Testlet
|
||||
{
|
||||
public int getExpectedPass() { return 6; }
|
||||
public int getExpectedFail() { return 0; }
|
||||
public int getExpectedKnownFail() { return 0; }
|
||||
|
||||
/**
|
||||
* Runs the test using the specified harness.
|
||||
*
|
||||
* @param harness the test harness (<code>null</code> not permitted).
|
||||
*/
|
||||
public void test(TestHarness harness)
|
||||
{
|
||||
IllegalThreadStateException object1 = new IllegalThreadStateException();
|
||||
harness.check(object1 != null);
|
||||
harness.check(object1.toString(), "java.lang.IllegalThreadStateException");
|
||||
|
||||
IllegalThreadStateException object2 = new IllegalThreadStateException("nothing happens");
|
||||
harness.check(object2 != null);
|
||||
harness.check(object2.toString(), "java.lang.IllegalThreadStateException: nothing happens");
|
||||
|
||||
IllegalThreadStateException object3 = new IllegalThreadStateException(null);
|
||||
harness.check(object3 != null);
|
||||
harness.check(object3.toString(), "java.lang.IllegalThreadStateException");
|
||||
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,59 @@
|
|||
// Test if try-catch block is working properly for a class java.lang.IndexOutOfBoundsException
|
||||
|
||||
// Copyright (C) 2012 Pavel Tisnovsky <ptisnovs@redhat.com>
|
||||
|
||||
// This file is part of Mauve.
|
||||
|
||||
// Mauve is free software; you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation; either version 2, or (at your option)
|
||||
// any later version.
|
||||
|
||||
// Mauve is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with Mauve; see the file COPYING. If not, write to
|
||||
// the Free Software Foundation, Inc., 51 Franklin Street,
|
||||
// Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
|
||||
package gnu.testlet.java.lang.IndexOutOfBoundsException;
|
||||
|
||||
import gnu.testlet.TestHarness;
|
||||
import gnu.testlet.Testlet;
|
||||
|
||||
import java.lang.IndexOutOfBoundsException;
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Test if try-catch block is working properly for a class java.lang.IndexOutOfBoundsException
|
||||
*/
|
||||
public class TryCatch implements Testlet
|
||||
{
|
||||
public int getExpectedPass() { return 1; }
|
||||
public int getExpectedFail() { return 0; }
|
||||
public int getExpectedKnownFail() { return 0; }
|
||||
|
||||
/**
|
||||
* Runs the test using the specified harness.
|
||||
*
|
||||
* @param harness the test harness (<code>null</code> not permitted).
|
||||
*/
|
||||
public void test(TestHarness harness)
|
||||
{
|
||||
// flag that is set when exception is caught
|
||||
boolean caught = false;
|
||||
try {
|
||||
throw new IndexOutOfBoundsException("IndexOutOfBoundsException");
|
||||
}
|
||||
catch (IndexOutOfBoundsException e) {
|
||||
// correct exception was caught
|
||||
caught = true;
|
||||
}
|
||||
harness.check(caught);
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,62 @@
|
|||
// Test if instances of a class java.lang.IndexOutOfBoundsException could be properly constructed
|
||||
|
||||
// Copyright (C) 2012 Pavel Tisnovsky <ptisnovs@redhat.com>
|
||||
|
||||
// This file is part of Mauve.
|
||||
|
||||
// Mauve is free software; you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation; either version 2, or (at your option)
|
||||
// any later version.
|
||||
|
||||
// Mauve is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with Mauve; see the file COPYING. If not, write to
|
||||
// the Free Software Foundation, Inc., 51 Franklin Street,
|
||||
// Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
|
||||
package gnu.testlet.java.lang.IndexOutOfBoundsException;
|
||||
|
||||
import gnu.testlet.TestHarness;
|
||||
import gnu.testlet.Testlet;
|
||||
|
||||
import java.lang.IndexOutOfBoundsException;
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Test if instances of a class java.lang.IndexOutOfBoundsException
|
||||
* could be properly constructed
|
||||
*/
|
||||
public class constructor implements Testlet
|
||||
{
|
||||
public int getExpectedPass() { return 6; }
|
||||
public int getExpectedFail() { return 0; }
|
||||
public int getExpectedKnownFail() { return 0; }
|
||||
|
||||
/**
|
||||
* Runs the test using the specified harness.
|
||||
*
|
||||
* @param harness the test harness (<code>null</code> not permitted).
|
||||
*/
|
||||
public void test(TestHarness harness)
|
||||
{
|
||||
IndexOutOfBoundsException object1 = new IndexOutOfBoundsException();
|
||||
harness.check(object1 != null);
|
||||
harness.check(object1.toString(), "java.lang.IndexOutOfBoundsException");
|
||||
|
||||
IndexOutOfBoundsException object2 = new IndexOutOfBoundsException("nothing happens");
|
||||
harness.check(object2 != null);
|
||||
harness.check(object2.toString(), "java.lang.IndexOutOfBoundsException: nothing happens");
|
||||
|
||||
IndexOutOfBoundsException object3 = new IndexOutOfBoundsException(null);
|
||||
harness.check(object3 != null);
|
||||
harness.check(object3.toString(), "java.lang.IndexOutOfBoundsException");
|
||||
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,59 @@
|
|||
// Test if try-catch block is working properly for a class java.lang.NumberFormatException
|
||||
|
||||
// Copyright (C) 2012 Pavel Tisnovsky <ptisnovs@redhat.com>
|
||||
|
||||
// This file is part of Mauve.
|
||||
|
||||
// Mauve is free software; you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation; either version 2, or (at your option)
|
||||
// any later version.
|
||||
|
||||
// Mauve is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with Mauve; see the file COPYING. If not, write to
|
||||
// the Free Software Foundation, Inc., 51 Franklin Street,
|
||||
// Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
|
||||
package gnu.testlet.java.lang.NumberFormatException;
|
||||
|
||||
import gnu.testlet.TestHarness;
|
||||
import gnu.testlet.Testlet;
|
||||
|
||||
import java.lang.NumberFormatException;
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Test if try-catch block is working properly for a class java.lang.NumberFormatException
|
||||
*/
|
||||
public class TryCatch implements Testlet
|
||||
{
|
||||
public int getExpectedPass() { return 1; }
|
||||
public int getExpectedFail() { return 0; }
|
||||
public int getExpectedKnownFail() { return 0; }
|
||||
|
||||
/**
|
||||
* Runs the test using the specified harness.
|
||||
*
|
||||
* @param harness the test harness (<code>null</code> not permitted).
|
||||
*/
|
||||
public void test(TestHarness harness)
|
||||
{
|
||||
// flag that is set when exception is caught
|
||||
boolean caught = false;
|
||||
try {
|
||||
throw new NumberFormatException("NumberFormatException");
|
||||
}
|
||||
catch (NumberFormatException e) {
|
||||
// correct exception was caught
|
||||
caught = true;
|
||||
}
|
||||
harness.check(caught);
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,62 @@
|
|||
// Test if instances of a class java.lang.NumberFormatException could be properly constructed
|
||||
|
||||
// Copyright (C) 2012 Pavel Tisnovsky <ptisnovs@redhat.com>
|
||||
|
||||
// This file is part of Mauve.
|
||||
|
||||
// Mauve is free software; you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation; either version 2, or (at your option)
|
||||
// any later version.
|
||||
|
||||
// Mauve is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with Mauve; see the file COPYING. If not, write to
|
||||
// the Free Software Foundation, Inc., 51 Franklin Street,
|
||||
// Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
|
||||
package gnu.testlet.java.lang.NumberFormatException;
|
||||
|
||||
import gnu.testlet.TestHarness;
|
||||
import gnu.testlet.Testlet;
|
||||
|
||||
import java.lang.NumberFormatException;
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Test if instances of a class java.lang.NumberFormatException
|
||||
* could be properly constructed
|
||||
*/
|
||||
public class constructor implements Testlet
|
||||
{
|
||||
public int getExpectedPass() { return 6; }
|
||||
public int getExpectedFail() { return 0; }
|
||||
public int getExpectedKnownFail() { return 0; }
|
||||
|
||||
/**
|
||||
* Runs the test using the specified harness.
|
||||
*
|
||||
* @param harness the test harness (<code>null</code> not permitted).
|
||||
*/
|
||||
public void test(TestHarness harness)
|
||||
{
|
||||
NumberFormatException object1 = new NumberFormatException();
|
||||
harness.check(object1 != null);
|
||||
harness.check(object1.toString(), "java.lang.NumberFormatException");
|
||||
|
||||
NumberFormatException object2 = new NumberFormatException("nothing happens");
|
||||
harness.check(object2 != null);
|
||||
harness.check(object2.toString(), "java.lang.NumberFormatException: nothing happens");
|
||||
|
||||
NumberFormatException object3 = new NumberFormatException(null);
|
||||
harness.check(object3 != null);
|
||||
harness.check(object3.toString(), "java.lang.NumberFormatException");
|
||||
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,61 @@
|
|||
// Test if try-catch block is working properly for a class java.lang.RuntimeException
|
||||
|
||||
// Copyright (C) 2012 Pavel Tisnovsky <ptisnovs@redhat.com>
|
||||
|
||||
// This file is part of Mauve.
|
||||
|
||||
// Mauve is free software; you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation; either version 2, or (at your option)
|
||||
// any later version.
|
||||
|
||||
// Mauve is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with Mauve; see the file COPYING. If not, write to
|
||||
// the Free Software Foundation, Inc., 51 Franklin Street,
|
||||
// Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
|
||||
// Tags: JDK1.5
|
||||
|
||||
package gnu.testlet.java.lang.RuntimeException;
|
||||
|
||||
import gnu.testlet.TestHarness;
|
||||
import gnu.testlet.Testlet;
|
||||
|
||||
import java.lang.RuntimeException;
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Test if try-catch block is working properly for a class java.lang.RuntimeException
|
||||
*/
|
||||
public class TryCatch implements Testlet
|
||||
{
|
||||
public int getExpectedPass() { return 1; }
|
||||
public int getExpectedFail() { return 0; }
|
||||
public int getExpectedKnownFail() { return 0; }
|
||||
|
||||
/**
|
||||
* Runs the test using the specified harness.
|
||||
*
|
||||
* @param harness the test harness (<code>null</code> not permitted).
|
||||
*/
|
||||
public void test(TestHarness harness)
|
||||
{
|
||||
// flag that is set when exception is caught
|
||||
boolean caught = false;
|
||||
try {
|
||||
throw new RuntimeException("RuntimeException");
|
||||
}
|
||||
catch (RuntimeException e) {
|
||||
// correct exception was caught
|
||||
caught = true;
|
||||
}
|
||||
harness.check(caught);
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,63 @@
|
|||
// Test if instances of a class java.lang.RuntimeException could be properly constructed
|
||||
|
||||
// Copyright (C) 2012 Pavel Tisnovsky <ptisnovs@redhat.com>
|
||||
|
||||
// This file is part of Mauve.
|
||||
|
||||
// Mauve is free software; you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation; either version 2, or (at your option)
|
||||
// any later version.
|
||||
|
||||
// Mauve is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with Mauve; see the file COPYING. If not, write to
|
||||
// the Free Software Foundation, Inc., 51 Franklin Street,
|
||||
// Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
|
||||
// Tags: JDK1.5
|
||||
|
||||
package gnu.testlet.java.lang.RuntimeException;
|
||||
|
||||
import gnu.testlet.TestHarness;
|
||||
import gnu.testlet.Testlet;
|
||||
|
||||
import java.lang.RuntimeException;
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Test if instances of a class java.lang.RuntimeException
|
||||
* could be properly constructed
|
||||
*/
|
||||
public class constructor implements Testlet
|
||||
{
|
||||
public int getExpectedPass() { return 6; }
|
||||
public int getExpectedFail() { return 0; }
|
||||
public int getExpectedKnownFail() { return 0; }
|
||||
|
||||
/**
|
||||
* Runs the test using the specified harness.
|
||||
*
|
||||
* @param harness the test harness (<code>null</code> not permitted).
|
||||
*/
|
||||
public void test(TestHarness harness)
|
||||
{
|
||||
RuntimeException object1 = new RuntimeException();
|
||||
harness.check(object1 != null);
|
||||
harness.check(object1.toString(), "java.lang.RuntimeException");
|
||||
|
||||
RuntimeException object2 = new RuntimeException("nothing happens");
|
||||
harness.check(object2 != null);
|
||||
harness.check(object2.toString(), "java.lang.RuntimeException: nothing happens");
|
||||
|
||||
RuntimeException object3 = new RuntimeException((String)null);
|
||||
harness.check(object3 != null);
|
||||
harness.check(object3.toString(), "java.lang.RuntimeException");
|
||||
}
|
||||
}
|
||||
|
Загрузка…
Ссылка в новой задаче