001: /* ====================================================================
002: The Jicarilla Software License
003:
004: Copyright (c) 2003 Leo Simons.
005: All rights reserved.
006:
007: Permission is hereby granted, free of charge, to any person obtaining
008: a copy of this software and associated documentation files (the
009: "Software"), to deal in the Software without restriction, including
010: without limitation the rights to use, copy, modify, merge, publish,
011: distribute, sublicense, and/or sell copies of the Software, and to
012: permit persons to whom the Software is furnished to do so, subject to
013: the following conditions:
014:
015: The above copyright notice and this permission notice shall be
016: included in all copies or substantial portions of the Software.
017:
018: THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
019: EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
020: MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
021: IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
022: CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
023: TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
024: SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
025: ==================================================================== */
026: package org.jicarilla.lang.test;
027:
028: import org.jicarilla.lang.Assert;
029: import junit.framework.TestCase;
030:
031: /**
032: * <a href="http://www.junit.org/">JUnit</a> {@link junit.framework.TestCase
033: * testcase} for Assert.
034: *
035: * @author <a href="lsimons at jicarilla dot org">Leo Simons</a>
036: * @version $Id: AssertTestCase.java,v 1.1 2004/03/23 13:37:57 lsimons Exp $
037: */
038: public class AssertTestCase extends TestCase {
039: public void testAssertNotNull() {
040: Assert.assertNotNull(new Object());
041:
042: AssertionError a = null;
043: try {
044: Assert.assertNotNull(null);
045: } catch (AssertionError ae) {
046: a = ae;
047: }
048: assertNotNull(a);
049: }
050:
051: public void testAssertNotNullWithMessage() {
052: String msg = "msg";
053:
054: Assert.assertNotNull(msg, new Object());
055:
056: AssertionError a = null;
057: try {
058: Assert.assertNotNull(msg, null);
059: } catch (AssertionError ae) {
060: a = ae;
061: }
062: assertNotNull(a);
063: assertEquals(msg, a.getMessage());
064: }
065:
066: public void testAssertTrue() {
067: AssertionError a = null;
068: try {
069: Assert.assertTrue(true);
070: } catch (AssertionError ae) {
071: a = ae;
072: }
073: assertNull(a);
074:
075: a = null;
076: try {
077: Assert.assertTrue(false);
078: } catch (AssertionError ae) {
079: a = ae;
080: }
081: assertNotNull(a);
082: }
083:
084: public void testAssertTrueWithMessage() {
085: String msg = "msg";
086:
087: Assert.assertTrue(msg, true);
088:
089: AssertionError a = null;
090: try {
091: Assert.assertTrue(msg, false);
092: } catch (AssertionError ae) {
093: a = ae;
094: }
095: assertNotNull(a);
096: assertEquals(msg, a.getMessage());
097: }
098:
099: public void testAssertFalse() {
100: Assert.assertFalse(false);
101:
102: AssertionError a = null;
103: try {
104: Assert.assertFalse(true);
105: } catch (AssertionError ae) {
106: a = ae;
107: }
108: assertNotNull(a);
109: }
110:
111: public void testAssertFalseWithMessage() {
112: String msg = "msg";
113:
114: Assert.assertFalse(msg, false);
115:
116: AssertionError a = null;
117: try {
118: Assert.assertFalse(msg, true);
119: } catch (AssertionError ae) {
120: a = ae;
121: }
122: assertNotNull(a);
123: assertEquals(msg, a.getMessage());
124: }
125: }
|