1 package org.itracker.model;
2
3 import static org.junit.Assert.assertNotNull;
4 import static org.junit.Assert.assertTrue;
5 import static org.junit.Assert.fail;
6
7 import org.junit.After;
8 import org.junit.Before;
9 import org.junit.Test;
10 import static org.itracker.Assert.*;
11
12 public class ConfigurationTest {
13 private Configuration conf;
14
15 @Test
16 public void testSetValue() {
17 try {
18 conf.setValue(null);
19 fail("did not throw IllegalArgumentException");
20 } catch (IllegalArgumentException e) {
21 assertTrue(true);
22 }
23 }
24
25 @Test
26 public void testSetVersion() {
27 try {
28 conf.setVersion(null);
29 fail("did not throw IllegalArgumentException");
30 } catch (IllegalArgumentException e) {
31 assertTrue(true);
32 }
33 }
34
35 @Test
36 public void testToString() {
37 assertNotNull(conf.toString());
38 }
39
40 @Test
41 public void SortOrderComparator() throws Exception {
42 Configuration configurationB = new Configuration();
43 configurationB.setOrder(conf.getOrder() + 1);
44
45 assertEntityComparator("sort order",
46 Configuration.CONFIGURATION_ORDER_COMPARATOR, conf,
47 configurationB);
48 assertEntityComparator("sort order",
49 Configuration.CONFIGURATION_ORDER_COMPARATOR, conf, null);
50
51 configurationB.setOrder(conf.getOrder());
52 assertEntityComparatorEquals("sort order",
53 Configuration.CONFIGURATION_ORDER_COMPARATOR, conf,
54 configurationB);
55 }
56
57 @Before
58 public void setUp() throws Exception {
59 conf = new Configuration();
60 }
61
62 @After
63 public void tearDown() throws Exception {
64 conf = null;
65 }
66
67 }