Changeset 666 for trunk/quest-ui-core-test/src/test/java/de
- Timestamp:
- 08/28/12 13:46:52 (12 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/quest-ui-core-test/src/test/java/de/ugoe/cs/quest/ui/GlobalDataContainerTest.java
r655 r666 1 1 package de.ugoe.cs.quest.ui; 2 3 import static org.junit.Assert.assertEquals; 4 import static org.junit.Assert.assertFalse; 5 import static org.junit.Assert.assertNotNull; 6 import static org.junit.Assert.assertNull; 7 import static org.junit.Assert.assertSame; 8 import static org.junit.Assert.assertTrue; 9 import static org.junit.Assert.fail; 2 10 3 11 import java.io.ByteArrayInputStream; … … 10 18 import java.util.Collection; 11 19 import java.util.LinkedList; 12 import java.util.List; 13 14 import org.junit.*; 15 16 import de.ugoe.cs.quest.eventcore.Event; 17 import de.ugoe.cs.quest.usageprofiles.IStochasticProcess; 18 19 import static org.junit.Assert.*; 20 import static org.mockito.Mockito.*; 20 21 import org.junit.Before; 22 import org.junit.Test; 21 23 22 24 /** … … 240 242 241 243 @Test 242 public void testGetAllSequencesNames_1() {243 GlobalDataContainer instance = GlobalDataContainer.getInstance();244 String key1 = "key1";245 String data1 = "data1";246 String key2 = "key2";247 String data2 = "data2";248 String key3 = "key3";249 Integer data3 = 1;250 String key4 = "key4";251 Integer data4 = 2;252 String key5 = "key5";253 Integer data5 = 3;254 255 assertFalse(instance.addData(key1, data1));256 assertFalse(instance.addData(key2, data2));257 assertFalse(instance.addData(key3, data3));258 assertFalse(instance.addData(key4, data4));259 assertFalse(instance.addData(key5, data5));260 261 String keySeq1 = "seq1";262 Collection<List<Event>> seq1 = new LinkedList<List<Event>>();263 List<Event> subseq1 = new LinkedList<Event>();264 subseq1.add(Event.STARTEVENT);265 seq1.add(subseq1);266 267 String keySeq2 = "seq2";268 Collection<List<Event>> seq2 = new LinkedList<List<Event>>();269 List<Event> subseq2 = new LinkedList<Event>();270 subseq2.add(Event.STARTEVENT);271 seq2.add(subseq2);272 273 assertFalse(instance.addData(keySeq1, seq1));274 assertFalse(instance.addData(keySeq2, seq2));275 276 Collection<String> expected = new LinkedList<String>();277 expected.add(keySeq1);278 expected.add(keySeq2);279 280 assertCollectionContent(expected, instance.getAllSequencesNames());281 }282 283 @Test284 public void testGetAllSequencesNames_2() {285 GlobalDataContainer instance = GlobalDataContainer.getInstance();286 String key1 = "key1";287 String data1 = "data1";288 String key2 = "key2";289 String data2 = "data2";290 String key3 = "key3";291 Integer data3 = 1;292 String key4 = "key4";293 Integer data4 = 2;294 String key5 = "key5";295 Integer data5 = 3;296 297 assertFalse(instance.addData(key1, data1));298 assertFalse(instance.addData(key2, data2));299 assertFalse(instance.addData(key3, data3));300 assertFalse(instance.addData(key4, data4));301 assertFalse(instance.addData(key5, data5));302 303 String keySeq1 = "seq1";304 Collection<List<Event>> seq1 = new LinkedList<List<Event>>();305 List<Event> subseq1 = new LinkedList<Event>();306 subseq1.add(Event.STARTEVENT);307 seq1.add(subseq1);308 309 String keySeq2 = "seq2";310 Collection<List<Event>> seq2 = new LinkedList<List<Event>>();311 312 assertFalse(instance.addData(keySeq1, seq1));313 assertFalse(instance.addData(keySeq2, seq2));314 315 Collection<String> expected = new LinkedList<String>();316 expected.add(keySeq1);317 318 assertCollectionContent(expected, instance.getAllSequencesNames());319 }320 321 @Test322 public void testGetAllSequencesNames_3() {323 GlobalDataContainer instance = GlobalDataContainer.getInstance();324 String key1 = "key1";325 String data1 = "data1";326 String key2 = "key2";327 String data2 = "data2";328 String key3 = "key3";329 Integer data3 = 1;330 String key4 = "key4";331 Integer data4 = 2;332 String key5 = "key5";333 Integer data5 = 3;334 335 assertFalse(instance.addData(key1, data1));336 assertFalse(instance.addData(key2, data2));337 assertFalse(instance.addData(key3, data3));338 assertFalse(instance.addData(key4, data4));339 assertFalse(instance.addData(key5, data5));340 341 Collection<String> expected = new LinkedList<String>();342 343 assertCollectionContent(expected, instance.getAllSequencesNames());344 }345 346 @Test347 public void testGetAllModelNames_1() {348 GlobalDataContainer instance = GlobalDataContainer.getInstance();349 String key1 = "key1";350 String data1 = "data1";351 String key2 = "key2";352 String data2 = "data2";353 String key3 = "key3";354 Integer data3 = 1;355 String key4 = "key4";356 Integer data4 = 2;357 String key5 = "key5";358 Integer data5 = 3;359 360 assertFalse(instance.addData(key1, data1));361 assertFalse(instance.addData(key2, data2));362 assertFalse(instance.addData(key3, data3));363 assertFalse(instance.addData(key4, data4));364 assertFalse(instance.addData(key5, data5));365 366 String modelKey1 = "model1";367 IStochasticProcess model1 = mock(IStochasticProcess.class);368 String modelKey2 = "model2";369 IStochasticProcess model2 = mock(IStochasticProcess.class);370 371 assertFalse(instance.addData(modelKey1, model1));372 assertFalse(instance.addData(modelKey2, model2));373 374 Collection<String> expected = new LinkedList<String>();375 expected.add(modelKey1);376 expected.add(modelKey2);377 378 assertCollectionContent(expected, instance.getAllModelNames());379 }380 381 @Test382 public void testGetAllModelNames_2() {383 GlobalDataContainer instance = GlobalDataContainer.getInstance();384 String key1 = "key1";385 String data1 = "data1";386 String key2 = "key2";387 String data2 = "data2";388 String key3 = "key3";389 Integer data3 = 1;390 String key4 = "key4";391 Integer data4 = 2;392 String key5 = "key5";393 Integer data5 = 3;394 395 assertFalse(instance.addData(key1, data1));396 assertFalse(instance.addData(key2, data2));397 assertFalse(instance.addData(key3, data3));398 assertFalse(instance.addData(key4, data4));399 assertFalse(instance.addData(key5, data5));400 401 Collection<String> expected = new LinkedList<String>();402 403 assertCollectionContent(expected, instance.getAllModelNames());404 }405 406 @Test407 244 public void testSerialization_1() throws Exception { 408 245 GlobalDataContainer instance = GlobalDataContainer.getInstance();
Note: See TracChangeset
for help on using the changeset viewer.