View Javadoc
1   package net.trajano.commons.testing.test;
2   
3   import static net.trajano.commons.testing.UtilityClassTestUtil.assertUtilityClassWellDefined;
4   
5   import org.junit.Test;
6   
7   import net.trajano.commons.testing.DisableSslCertificateCheckUtil;
8   import net.trajano.commons.testing.EqualsTestUtil;
9   import net.trajano.commons.testing.ResourceUtil;
10  import net.trajano.commons.testing.UtilityClassTestUtil;
11  import net.trajano.commons.testing.test.util.MultipleConstructorUtil;
12  import net.trajano.commons.testing.test.util.NonFinalUtil;
13  import net.trajano.commons.testing.test.util.NonStaticMethodUtil;
14  import net.trajano.commons.testing.test.util.PublicConstructorUtil;
15  
16  /**
17   * Tests {@link UtilityClassTestUtil}.
18   *
19   * @author Archimedes Trajano
20   */
21  public class UtilityClassTestUtilTest {
22  
23      @Test(expected = AssertionError.class)
24      public void testBadUtil1() throws Exception {
25  
26          assertUtilityClassWellDefined(NonFinalUtil.class);
27      }
28  
29      @Test(expected = AssertionError.class)
30      public void testBadUtil2() throws Exception {
31  
32          assertUtilityClassWellDefined(PublicConstructorUtil.class);
33      }
34  
35      @Test(expected = AssertionError.class)
36      public void testBadUtil3() throws Exception {
37  
38          assertUtilityClassWellDefined(MultipleConstructorUtil.class);
39      }
40  
41      @Test(expected = AssertionError.class)
42      public void testBadUtil4() throws Exception {
43  
44          assertUtilityClassWellDefined(NonStaticMethodUtil.class);
45      }
46  
47      /**
48       * Tests {@link net.trajano.commons.testing.DisableSslCertificateCheckUtil} which should be valid.
49       *
50       * @throws Exception
51       */
52      @Test
53      public void testDisableSSLCerificateCheckUtil() throws Exception {
54  
55          assertUtilityClassWellDefined(DisableSslCertificateCheckUtil.class);
56      }
57  
58      /**
59       * Tests {@link net.trajano.commons.testing.EqualsTestUtil} which should be valid.
60       *
61       * @throws Exception
62       */
63      @Test
64      public void testEqualsTestUtil() throws Exception {
65  
66          assertUtilityClassWellDefined(EqualsTestUtil.class);
67      }
68  
69      /**
70       * Tests {@link ResourceUtil} which should be valid.
71       *
72       * @throws Exception
73       */
74      @Test
75      public void testResourceUtil() throws Exception {
76  
77          assertUtilityClassWellDefined(ResourceUtil.class);
78      }
79  
80      /**
81       * Tests the utility class itself which should be valid.
82       *
83       * @throws Exception
84       */
85      @Test
86      public void testSelf() throws Exception {
87  
88          assertUtilityClassWellDefined(UtilityClassTestUtil.class);
89      }
90  
91      @Test(expected = AssertionError.class)
92      public void testTestSelf() throws Exception {
93  
94          assertUtilityClassWellDefined(UtilityClassTestUtilTest.class);
95      }
96  }