|
| 1 | +/******************************************************************************* |
| 2 | + * Copyright (c) 2017 java2script.org and others. |
| 3 | + * All rights reserved. This program and the accompanying materials |
| 4 | + * are made available under the terms of the Eclipse Public License v1.0 |
| 5 | + * which accompanies this distribution, and is available at |
| 6 | + * http://www.eclipse.org/legal/epl-v10.html |
| 7 | + * |
| 8 | + * Contributors: |
| 9 | + * Udo Borkowski - initial implementation |
| 10 | + *******************************************************************************/ |
| 11 | + |
| 12 | +package net.sf.j2s.test.junit.java.lang; |
| 13 | + |
| 14 | +import junit.framework.TestCase; |
| 15 | +import net.sf.j2s.test.junit.sample.C; |
| 16 | +import net.sf.j2s.test.junit.sample.C2; |
| 17 | +import net.sf.j2s.test.junit.sample.CF; |
| 18 | +import net.sf.j2s.test.junit.sample.CF1; |
| 19 | +import net.sf.j2s.test.junit.util.Output; |
| 20 | + |
| 21 | +public class BooleanTest extends TestCase { |
| 22 | + |
| 23 | + /** |
| 24 | + * Boolean.FALSE must evaluate to <code>false</code> when used in a boolean expression. |
| 25 | + */ |
| 26 | + public void testFALSEInInBooleanExpression() { |
| 27 | + assertFalse(Boolean.FALSE); |
| 28 | + } |
| 29 | + |
| 30 | + /** |
| 31 | + * Boolean.FALSE must evaluate to <code>false</code> when used in a boolean expression, |
| 32 | + * e.g. as a literal in an if-statement's condition. |
| 33 | + */ |
| 34 | + public void testFALSEInIfCondition() { |
| 35 | + if (Boolean.FALSE) { |
| 36 | + fail("Boolean.FALSE does not evaluate to false"); |
| 37 | + } |
| 38 | + } |
| 39 | + |
| 40 | + /** |
| 41 | + * Boolean.TRUE must evaluate to <code>true</code> when used in a boolean expression, |
| 42 | + * e.g. as a literal in an if-statement's condition. |
| 43 | + */ |
| 44 | + public void testTRUEInIfCondition() { |
| 45 | + if (Boolean.TRUE) { |
| 46 | + // do nothing |
| 47 | + } else { |
| 48 | + fail("Boolean.TRUE does not evaluate to true"); |
| 49 | + } |
| 50 | + } |
| 51 | + |
| 52 | +} |
0 commit comments