mirror of
https://github.com/unicode-org/icu.git
synced 2025-04-08 06:53:45 +00:00
ICU-5410 Test com.ibm.icu.impl.Assert
X-SVN-Rev: 20489
This commit is contained in:
parent
802e3c73a3
commit
d11b19d9fc
1 changed files with 48 additions and 1 deletions
|
@ -1,7 +1,7 @@
|
|||
//##header
|
||||
/*
|
||||
**********************************************************************
|
||||
* Copyright (c) 2003-2005, International Business Machines
|
||||
* Copyright (c) 2003-2006, International Business Machines
|
||||
* Corporation and others. All Rights Reserved.
|
||||
**********************************************************************
|
||||
* Author: Alan Liu
|
||||
|
@ -16,6 +16,7 @@ import java.util.List;
|
|||
import java.util.Set;
|
||||
|
||||
import com.ibm.icu.dev.test.TestFmwk;
|
||||
import com.ibm.icu.impl.Assert;
|
||||
import com.ibm.icu.impl.Utility;
|
||||
import com.ibm.icu.text.UnicodeSet;
|
||||
import com.ibm.icu.util.ByteArrayWrapper;
|
||||
|
@ -170,4 +171,50 @@ public class UtilityTest extends TestFmwk {
|
|||
//The size should also read 4, but 0 is seen instead
|
||||
|
||||
}
|
||||
|
||||
public void TestAssert(){
|
||||
try {
|
||||
Assert.assrt(false);
|
||||
errln("FAIL: Assert.assrt(false)");
|
||||
}
|
||||
catch (IllegalStateException e) {
|
||||
if (e.getMessage().equals("assert failed")) {
|
||||
logln("Assert.assrt(false) works");
|
||||
}
|
||||
else {
|
||||
errln("FAIL: Assert.assrt(false) returned " + e.getMessage());
|
||||
}
|
||||
}
|
||||
try {
|
||||
Assert.assrt("Assert message", false);
|
||||
errln("FAIL: Assert.assrt(false)");
|
||||
}
|
||||
catch (IllegalStateException e) {
|
||||
if (e.getMessage().equals("assert 'Assert message' failed")) {
|
||||
logln("Assert.assrt(false) works");
|
||||
}
|
||||
else {
|
||||
errln("FAIL: Assert.assrt(false) returned " + e.getMessage());
|
||||
}
|
||||
}
|
||||
try {
|
||||
Assert.fail("Assert message");
|
||||
errln("FAIL: Assert.fail");
|
||||
}
|
||||
catch (IllegalStateException e) {
|
||||
if (e.getMessage().equals("failure 'Assert message'")) {
|
||||
logln("Assert.fail works");
|
||||
}
|
||||
else {
|
||||
errln("FAIL: Assert.fail returned " + e.getMessage());
|
||||
}
|
||||
}
|
||||
try {
|
||||
Assert.fail(new IllegalArgumentException("Assert message"));
|
||||
errln("FAIL: Assert.fail with an exception");
|
||||
}
|
||||
catch (IllegalStateException e) {
|
||||
logln("Assert.fail works");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue