1 package edu.umd.cs.findbugs.ba.npe; 2 3 import junit.framework.TestCase; 4 5 public class IsNullValueTest extends TestCase { 6 public void testMerge1() { 7 IsNullValue nullValue = IsNullValue.nullValue(); 8 IsNullValue nullExceptionValue = IsNullValue.nullValue().toExceptionValue(); 9 IsNullValue result = IsNullValue.merge(nullValue, nullExceptionValue); 10 assertTrue(result.isDefinitelyNull()); 11 assertFalse(result.isException()); 12 } 13 public void testMerge2() { 14 IsNullValue nullExceptionValue = IsNullValue.nullValue().toExceptionValue(); 15 IsNullValue nonNullValue = IsNullValue.nonNullValue(); 16 IsNullValue nsp_e = IsNullValue.merge(nonNullValue, nullExceptionValue); 17 assertTrue(nsp_e.isNullOnSomePath()); 18 assertTrue(nsp_e.isException()); 19 assertEquals(nsp_e, IsNullValue.nullOnSimplePathValue().toExceptionValue()); 20 } 21 public void testMerge3() { 22 IsNullValue nullValue = IsNullValue.nullValue(); 23 IsNullValue nsp_e = IsNullValue.nullOnSimplePathValue().toExceptionValue(); 24 IsNullValue nsp = IsNullValue.merge(nullValue, nsp_e); 25 assertTrue(nsp.isNullOnSomePath()); 26 assertFalse(nsp.isException()); 27 } 28 public void testMerge5() { 36 IsNullValue checkedNonNull = IsNullValue.checkedNonNullValue(); 37 IsNullValue nsp_e = IsNullValue.nullOnSimplePathValue().toExceptionValue(); 38 IsNullValue nsp_e2 = IsNullValue.merge(checkedNonNull, nsp_e); 39 assertTrue(nsp_e2.isNullOnSomePath()); 40 assertTrue(nsp_e2.isException()); 41 } 42 public void testMerge6() { 43 IsNullValue checkedNull_e = IsNullValue.checkedNullValue().toExceptionValue(); 44 IsNullValue unknown = IsNullValue.nonReportingNotNullValue(); 45 IsNullValue nsp_e = IsNullValue.merge(checkedNull_e, unknown); 46 assertTrue(nsp_e.isNullOnSomePath()); 47 assertTrue(nsp_e.isException()); 48 } 49 } 50 | Popular Tags |