~tapaal-contributor/tapaal/undo-redo-update-scrollbar-1875174

« back to all changes in this revision

Viewing changes to tests/TimeIntervalTest.java

  • Committer: Jiri Srba
  • Date: 2020-04-28 19:15:28 UTC
  • mfrom: (998.2.376 testbranch)
  • Revision ID: srba@cs.aau.dk-20200428191528-3xxjqa1r4jcob5ur
merged in lp:~yrke/tapaal/testbranch doing majour refactoring of the GUI

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
import org.junit.Test;
2
 
 
3
 
import dk.aau.cs.model.tapn.Bound;
4
 
import dk.aau.cs.model.tapn.IntBound;
5
 
import dk.aau.cs.model.tapn.TimeInterval;
 
1
import dk.aau.cs.model.tapn.*;
6
2
import dk.aau.cs.util.RequireException;
 
3
import org.junit.jupiter.api.Test;
 
4
import org.junit.jupiter.api.Assertions;
 
5
import static org.junit.jupiter.api.Assertions.assertThrows;
7
6
 
8
7
public class TimeIntervalTest  {
9
8
        
10
 
        @Test(expected=RequireException.class)
 
9
        @Test
11
10
        public void TimeIntervalConstructor(){
12
 
                new TimeInterval(false, new IntBound(0), new IntBound(0), true);
 
11
                assertThrows(RequireException.class, ()-> new TimeInterval(false, new IntBound(0), new IntBound(0), true));
13
12
        }
14
13
        
15
 
        @Test(expected=RequireException.class)
 
14
        @Test
16
15
        public void TimeIntervalConstructor_intervaltype2(){
17
 
                new TimeInterval(true, new IntBound(5), new IntBound(5), false);
 
16
                assertThrows(RequireException.class, ()-> new TimeInterval(true, new IntBound(5), new IntBound(5), false));
18
17
        }
19
18
        
20
 
        @Test(expected=RequireException.class)
 
19
        @Test
21
20
        public void TimeIntervalConstructor_intervaltype3(){
22
 
                new TimeInterval(false, new IntBound(5), new IntBound(5), false);
 
21
                assertThrows(RequireException.class, ()-> new TimeInterval(false, new IntBound(5), new IntBound(5), false));
23
22
        }
24
23
        
25
 
        @Test(expected=RequireException.class)
 
24
        @Test
26
25
        public void TimeIntervalConstructor_intervaltype4(){
27
 
                new TimeInterval(true, new IntBound(6), new IntBound(5), false);
 
26
                assertThrows(RequireException.class, ()-> new TimeInterval(true, new IntBound(6), new IntBound(5), false));
28
27
        }
29
28
        
30
 
        @Test(expected=RequireException.class)
 
29
        @Test
31
30
        public void TimeIntervalConstructor_intervaltype5(){
32
 
                new TimeInterval(false, new IntBound(6), new IntBound(5), false);
 
31
                assertThrows(RequireException.class, ()-> new TimeInterval(false, new IntBound(6), new IntBound(5), false));
33
32
        }
34
33
        
35
34
        @Test
37
36
                new TimeInterval(true, new IntBound(6), Bound.Infinity, false);
38
37
        }
39
38
        
40
 
        @Test(expected=RequireException.class)
 
39
        @Test
41
40
        public void TimeInterval_InfinityUpper_included(){
42
 
                new TimeInterval(true, new IntBound(6), Bound.Infinity, true);
 
41
                assertThrows(RequireException.class, ()-> new TimeInterval(true, new IntBound(6), Bound.Infinity, true));
43
42
        }
44
43
        
45
 
        @Test(expected=RequireException.class)
 
44
        @Test
46
45
        public void TimeInterval_Infinity_lower(){
47
 
                new TimeInterval(true, Bound.Infinity, Bound.Infinity, false);
48
 
        }
49
 
        
50
 
        
 
46
                assertThrows(RequireException.class, ()-> new TimeInterval(true, Bound.Infinity, Bound.Infinity, false));
 
47
        }
 
48
 
 
49
        //XXX tests used when refactoring toString to call toString(true)
 
50
        @Test
 
51
        public void IntervalToStringTrueIsSameAsIntervalToString() {
 
52
                TimeInterval t = new TimeInterval(true, new IntBound(0), Bound.Infinity, false);
 
53
                TimeInterval t2 = new TimeInterval(true, new ConstantBound(new Constant("k", 5)),new IntBound(8), false);
 
54
 
 
55
                Assertions.assertEquals(t.toString(), t.toString(true));
 
56
        Assertions.assertEquals(t.toString(), t.toString(false));
 
57
 
 
58
        Assertions.assertEquals(t2.toString(), t2.toString(true));
 
59
        Assertions.assertNotEquals(t2.toString(), t2.toString(false));
 
60
 
 
61
        }
51
62
        
52
63
        @Test()
53
64
        public void timeInterval(){