package org.bitbucket.jtransaction.common;

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

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

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

    /** */
    @Test
    public void testNullArgument() {
        try {
            checkArgument(null);
            fail("null argument passed non-null test");
        } catch (IllegalArgumentException ex) {
            assertTrue(true);
        }
    }

    /** */
    @Test
    public void testArgument() {
        Object o = new Object();
        try {
            checkArgument(o);
            if (o == null) { fail("null argument passed non-null test"); }
            else { assertTrue(true); }
        } catch (IllegalArgumentException ex) {
            if (o == null) { assertTrue(true); }
            else { fail("non-null argument failed non-null test"); }
        }
    }
}

@@ -109,18 +109,16 @@
 ument;%0D%0A
-%0D%0A
 import s
@@ -144,10 +144,24 @@
 ert.
-*;
+assertNotNull;%0D%0A
 %0D%0Aim
@@ -301,24 +301,26 @@
 mentTest %7B%0D%0A
+%0D%0A
     /** */%0D%0A
@@ -327,62 +327,56 @@
     
-public CheckArgumentTest() %7B%7D%0D%0A%0D%0A    /** */%0D%0A    @Test
+@Test(expected = IllegalArgumentException.class)
 %0D%0A  
@@ -411,35 +411,16 @@
 nt() %7B%0D%0A
-        try %7B%0D%0A    
         
@@ -449,592 +449,158 @@
     
-        fail(%22null argument passed non-null test%22);%0D%0A        %7D catch (IllegalArgumentException ex) %7B%0D%0A            assertTrue(true);%0D%0A        %7D%0D%0A    %7D%0D%0A%0D%0A    /** */%0D%0A    @Test%0D%0A    public void testArgument() %7B%0D%0A        Object o = new Object();%0D%0A        try %7B%0D%0A            checkArgument(o);%0D%0A            if (o == null) %7B fail(%22null argument passed non-null test%22); %7D%0D%0A            else %7B assertTrue(true); %7D%0D%0A        %7D catch (IllegalArgumentException ex) %7B%0D%0A            if (o == null) %7B assertTrue(true); %7D%0D%0A            else %7B fail(%22non-null argument failed non-null test%22); %7D%0D%0A        %7D
+%7D%0D%0A%0D%0A    /** */%0D%0A    @Test%0D%0A    public void testArgument() %7B%0D%0A        Object o = new Object();%0D%0A        checkArgument(o);%0D%0A%0D%0A        assertNotNull(o);
 %0D%0A  

Refactor test