package org.bitbucket.jtransaction.common;

import static org.bitbucket.jtransaction.common.Check.checkNotNull;

import static org.junit.Assert.*;
import org.junit.Test;

/**
 * The test class CheckNotNullTest.
 *
 * @author  afs
 * @version 2013
 */
public class CheckNotNullTest {
    /** */
    public CheckNotNullTest() {}

    /** */
    @Test
    public void testNullIsNull() {
        try {
            checkNotNull(null);
            fail("null passed non-null check");
        } catch (NullPointerException ex) {
            assertTrue(true);
        }
    }

    /** */
    @Test
    public void testNotNull() {
        Object o = new Object();
        try {
            checkNotNull(o);
            if (o == null) { fail("null passed non-null check"); }
            else { assertTrue(true); }
        } catch (NullPointerException ex) {
            if (o == null) { assertTrue(true); }
            else { fail("non-null object failed non-null check"); }
        }
    }
}

@@ -108,18 +108,16 @@
 tNull;%0D%0A
-%0D%0A
 import s
@@ -143,10 +143,24 @@
 ert.
-*;
+assertNotNull;%0D%0A
 %0D%0Aim
@@ -306,724 +306,337 @@
  %7B%0D%0A
-    /** */%0D%0A    public CheckNotNullTest() %7B%7D%0D%0A%0D%0A    /** */%0D%0A    @Test%0D%0A    public void testNullIsNull() %7B%0D%0A        try %7B%0D%0A            checkNotNull(null);%0D%0A            fail(%22null passed non-null check%22);%0D%0A        %7D catch (NullPointerException ex) %7B%0D%0A            assertTrue(true);%0D%0A        %7D%0D%0A    %7D%0D%0A%0D%0A    /** */%0D%0A    @Test%0D%0A    public void testNotNull() %7B%0D%0A        Object o = new Object();%0D%0A        try %7B%0D%0A            checkNotNull(o);%0D%0A            if (o == null) %7B fail(%22null passed non-null check%22); %7D%0D%0A            else %7B assertTrue(true); %7D%0D%0A        %7D catch (NullPointerException ex) %7B%0D%0A            if (o == null) %7B assertTrue(true); %7D%0D%0A            else %7B fail(%22non-null object failed non-null check%22); %7D%0D%0A        %7D
+%0D%0A    @Test%0D%0A    public void testCheckNotNullWithNotNullObject() throws Exception %7B%0D%0A        Object o = new Object();%0D%0A        checkNotNull(o);%0D%0A%0D%0A        assertNotNull(o);%0D%0A    %7D%0D%0A%0D%0A    @Test(expected = NullPointerException.class)%0D%0A    public void testCheckNotNullWithNullObject() throws Exception %7B%0D%0A        checkNotNull(null);
 %0D%0A  

Refactor tests