1 package org.itracker.model;
2 import static org.junit.Assert.assertNotNull;
3 import static org.itracker.Assert.*;
4 import org.junit.After;
5 import org.junit.Before;
6 import org.junit.Test;
7
8 public class ProjectScriptTest {
9 private ProjectScript pro;
10
11
12 @Test
13 public void testToString(){
14 assertNotNull("toString", pro.toString());
15 }
16
17 @Test
18 public void testFieldPriorityComparator() {
19 ProjectScript entityA = new ProjectScript();
20 ProjectScript entityB = new ProjectScript();
21 entityA.setFieldId(0);
22 entityB.setFieldId(1);
23 entityA.setPriority(0);
24 entityB.setPriority(0);
25
26 assertEntityComparator("field priority comparator", ProjectScript.FIELD_PRIORITY_COMPARATOR, entityA, entityB);
27 assertEntityComparator("field priority comparator", ProjectScript.FIELD_PRIORITY_COMPARATOR, entityA, null);
28
29 entityA.setFieldId(entityB.getFieldId());
30 entityB.setPriority(entityA.getPriority() + 1);
31
32 assertEntityComparator("field priority comparator", ProjectScript.FIELD_PRIORITY_COMPARATOR, entityA, entityB);
33 assertEntityComparator("field priority comparator", ProjectScript.FIELD_PRIORITY_COMPARATOR, entityA, null);
34
35 entityA.setPriority(entityB.getPriority());
36
37 assertEntityComparatorEquals("field priority comparator", ProjectScript.FIELD_PRIORITY_COMPARATOR, entityA, entityB);
38 assertEntityComparatorEquals("field priority comparator", ProjectScript.FIELD_PRIORITY_COMPARATOR, entityA, entityA);
39
40 }
41
42 @Before
43 public void setUp() throws Exception {
44 pro = new ProjectScript();
45 }
46
47 @After
48 public void tearDown() throws Exception {
49 pro = null;
50 }
51
52 }