source: trunk/autoquest-core-events-test/src/test/java/de/ugoe/cs/autoquest/SequenceInstanceOfTest.java @ 927

Last change on this file since 927 was 927, checked in by sherbold, 12 years ago
  • added copyright under the Apache License, Version 2.0
  • Property svn:mime-type set to text/plain
File size: 3.5 KB
Line 
1//   Copyright 2012 Georg-August-Universität Göttingen, Germany
2//
3//   Licensed under the Apache License, Version 2.0 (the "License");
4//   you may not use this file except in compliance with the License.
5//   You may obtain a copy of the License at
6//
7//       http://www.apache.org/licenses/LICENSE-2.0
8//
9//   Unless required by applicable law or agreed to in writing, software
10//   distributed under the License is distributed on an "AS IS" BASIS,
11//   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12//   See the License for the specific language governing permissions and
13//   limitations under the License.
14
15package de.ugoe.cs.autoquest;
16
17import java.util.ArrayList;
18import java.util.Collection;
19import java.util.LinkedList;
20import java.util.List;
21
22import org.junit.*;
23
24import static org.junit.Assert.*;
25import static org.mockito.Mockito.*;
26
27import de.ugoe.cs.autoquest.SequenceInstanceOf;
28import de.ugoe.cs.autoquest.eventcore.Event;
29import de.ugoe.cs.autoquest.eventcore.IEventType;
30
31
32/**
33 * The class <code>SequenceInstanceOfTest</code> contains tests for the
34 * class <code>{@link SequenceInstanceOf}</code>.
35 *
36 * @author Steffen Herbold
37 * @version 1.0
38 */
39public class SequenceInstanceOfTest {
40       
41        @Test
42        public void TestIsCollectionOfSequences_1() throws Exception {
43                Collection<List<Event>> sequences = new LinkedList<List<Event>>();
44                List<Event> sequence1 = new ArrayList<Event>();
45                sequence1.add(new Event(mock(IEventType.class)));
46                sequences.add(sequence1);
47               
48                boolean result = SequenceInstanceOf.isCollectionOfSequences(sequences);
49                assertTrue(result);
50        }
51       
52        @Test
53        public void TestIsCollectionOfSequences_2() throws Exception {
54                Collection<List<Event>> sequences = new LinkedList<List<Event>>();
55                List<Event> sequence1 = new ArrayList<Event>();
56                sequences.add(sequence1);
57               
58                boolean result = SequenceInstanceOf.isCollectionOfSequences(sequences);
59                assertFalse(result);
60        }
61       
62        @Test
63        public void TestIsCollectionOfSequences_3() throws Exception {
64                Collection<List<Event>> sequences = new LinkedList<List<Event>>();
65               
66                boolean result = SequenceInstanceOf.isCollectionOfSequences(sequences);
67                assertFalse(result);
68        }
69       
70        @Test
71        public void TestIsCollectionOfSequences_4() throws Exception {
72                boolean result = SequenceInstanceOf.isCollectionOfSequences(null);
73                assertFalse(result);
74        }
75       
76        @Test
77        public void TestIsCollectionOfSequences_5() throws Exception {
78                boolean result = SequenceInstanceOf.isCollectionOfSequences(new Object());
79                assertFalse(result);
80        }
81       
82        @Test
83        public void TestIsEventSequence_1() throws Exception {
84                List<Event> sequence = new ArrayList<Event>();
85                sequence.add(new Event(mock(IEventType.class)));
86               
87                boolean result = SequenceInstanceOf.isEventSequence(sequence);
88                assertTrue(result);
89        }
90       
91        @Test
92        public void TestIsEventSequence_2() throws Exception {
93                List<Event> sequence = new ArrayList<Event>();
94               
95                boolean result = SequenceInstanceOf.isEventSequence(sequence);
96                assertFalse(result);
97        }
98       
99        @Test
100        public void TestIsEventSequence_3() throws Exception {
101                boolean result = SequenceInstanceOf.isEventSequence(null);
102                assertFalse(result);
103        }
104       
105        @Test
106        public void TestIsEventSequence_4() throws Exception {
107                boolean result = SequenceInstanceOf.isEventSequence(new Object());
108                assertFalse(result);
109        }
110       
111       
112       
113        public static void main(String[] args) {
114                new org.junit.runner.JUnitCore().run(SequenceInstanceOfTest.class);
115        }
116}
Note: See TracBrowser for help on using the repository browser.