source: trunk/autoquest-core-usageprofiles-test/src/test/java/de/ugoe/cs/autoquest/usageprofiles/TrieTest.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: 20.9 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.usageprofiles;
16
17import java.util.ArrayList;
18import java.util.Collection;
19import java.util.HashSet;
20import java.util.List;
21
22import junitx.framework.ListAssert;
23
24import org.junit.*;
25
26import de.ugoe.cs.autoquest.usageprofiles.Trie;
27import de.ugoe.cs.autoquest.usageprofiles.TrieNode;
28import de.ugoe.cs.autoquest.usageprofiles.Trie.Edge;
29import de.ugoe.cs.autoquest.usageprofiles.Trie.TrieVertex;
30import static org.junit.Assert.*;
31
32/**
33 * The class <code>TrieTest</code> contains tests for the class
34 * <code>{@link Trie}</code>.
35 *
36 * @author Steffen Herbold
37 * @version 1.0
38 */
39public class TrieTest {
40
41        List<String> sequence;
42        Collection<String> symbols;
43
44        private static void assertCollectionContent(Collection<?> c1,
45                        Collection<?> c2) {
46                assertEquals(c1.size(), c2.size());
47                for (Object obj : c1) {
48                        assertTrue(c2.contains(obj));
49                }
50        }
51
52        @Test
53        public void testTrie_1() throws Exception {
54
55                Trie<String> result = new Trie<String>();
56
57                assertNotNull(result);
58                assertEquals(0, result.getNumLeafs());
59                assertEquals(0, result.getNumSymbols());
60                assertEquals(0, result.getNumLeafAncestors());
61                assertTrue(result.getKnownSymbols().isEmpty());
62        }
63
64        @Test
65        public void testTrie_2() throws Exception {
66                Trie<String> trie1 = new Trie<String>();
67                trie1.train(sequence, 3);
68
69                Trie<String> result = new Trie<String>(trie1);
70
71                assertEquals(trie1, result);
72                assertNotSame(trie1, result);
73        }
74
75        @Test(expected = java.lang.IllegalArgumentException.class)
76        public void testTrie_3() throws Exception {
77                new Trie<String>(null);
78        }
79
80        @Test
81        public void testAdd_1() throws Exception {
82                Trie<String> fixture = new Trie<String>();
83                List<String> seq = new ArrayList<String>();
84                seq.add("a");
85                seq.add("b");
86
87                fixture.add(seq);
88
89                assertEquals(1, fixture.getChild("a").getCount());
90                assertEquals(1, fixture.getChild("a").getChild("b").getCount());
91                assertNull(fixture.getChild("b"));
92        }
93
94        @Test
95        public void testAdd_2() throws Exception {
96                Trie<String> fixture = new Trie<String>();
97
98                fixture.add(new ArrayList<String>());
99
100                assertEquals(0, fixture.getNumSymbols());
101        }
102
103        @Test
104        public void testAdd_3() throws Exception {
105                Trie<String> fixture = new Trie<String>();
106
107                fixture.add(null);
108
109                assertEquals(0, fixture.getNumSymbols());
110        }
111
112        @Test
113        public void testFind_1() throws Exception {
114                Trie<String> fixture = new Trie<String>();
115                fixture.train(sequence, 3);
116                List<String> findSequence = new ArrayList<String>();
117                findSequence.add("a");
118                findSequence.add("b");
119                findSequence.add("r");
120                TrieNode<String> expected = fixture.getChild("a").getChild("b")
121                                .getChild("r");
122
123                TrieNode<String> result = fixture.find(findSequence);
124
125                assertEquals(expected, result);
126        }
127
128        @Test
129        public void testFind_2() throws Exception {
130                Trie<String> fixture = new Trie<String>();
131                fixture.train(sequence, 3);
132                List<String> findSequence = new ArrayList<String>();
133                findSequence.add("c");
134                findSequence.add("a");
135                TrieNode<String> expected = fixture.getChild("c").getChild("a");
136
137                TrieNode<String> result = fixture.find(findSequence);
138
139                assertEquals(expected, result);
140        }
141
142        @Test
143        public void testFind_3() throws Exception {
144                Trie<String> fixture = new Trie<String>();
145                fixture.train(sequence, 3);
146                List<String> findSequence = new ArrayList<String>();
147
148                TrieNode<String> result = fixture.find(findSequence);
149
150                assertTrue(result.isRoot());
151        }
152
153        @Test
154        public void testFind_4() throws Exception {
155                Trie<String> fixture = new Trie<String>();
156                fixture.train(sequence, 3);
157
158                TrieNode<String> result = fixture.find(null);
159
160                assertTrue(result.isRoot());
161        }
162
163        @Test
164        public void testGetChildCreate_1() throws Exception {
165                Trie<String> fixture = new Trie<String>();
166                String symbol = "a";
167
168                TrieNode<String> result = fixture.getChildCreate(symbol);
169
170                assertEquals(symbol, result.getSymbol());
171                assertEquals(0, result.getCount());
172                assertTrue(result.isLeaf());
173        }
174
175        @Test(expected = java.lang.IllegalArgumentException.class)
176        public void testGetChildCreate_2() throws Exception {
177                Trie<String> fixture = new Trie<String>();
178                fixture.getChildCreate(null);
179        }
180
181        @Test
182        public void testGetContextSuffix_1() throws Exception {
183                Trie<String> fixture = new Trie<String>();
184                fixture.train(sequence, 3);
185                List<String> context = new ArrayList<String>();
186                context.add("a");
187                context.add("a");
188                context.add("b");
189                List<String> expected = new ArrayList<String>();
190                expected.add("a");
191                expected.add("b");
192
193                List<String> result = fixture.getContextSuffix(context);
194
195                ListAssert.assertEquals(expected, result);
196        }
197
198        @Test
199        public void testGetContextSuffix_2() throws Exception {
200                Trie<String> fixture = new Trie<String>();
201                fixture.train(sequence, 3);
202                List<String> context = new ArrayList<String>();
203                context.add("a");
204                context.add("a");
205                context.add("b");
206                context.add("r");
207                List<String> expected = new ArrayList<String>();
208                expected.add("b");
209                expected.add("r");
210
211                List<String> result = fixture.getContextSuffix(context);
212
213                ListAssert.assertEquals(expected, result);
214        }
215
216        @Test
217        public void testGetContextSuffix_3() throws Exception {
218                Trie<String> fixture = new Trie<String>();
219                fixture.train(sequence, 3);
220                List<String> context = new ArrayList<String>();
221                context.add("a");
222                context.add("a");
223                context.add("b");
224                context.add("x");
225                List<String> expected = new ArrayList<String>();
226
227                List<String> result = fixture.getContextSuffix(context);
228
229                ListAssert.assertEquals(expected, result);
230        }
231
232        @Test
233        public void testGetContextSuffix_4() throws Exception {
234                Trie<String> fixture = new Trie<String>();
235
236                List<String> result = fixture.getContextSuffix(null);
237
238                // add additional test code here
239                assertNotNull(result);
240                assertEquals(0, result.size());
241        }
242
243        @Test
244        public void testGetContextSuffix_5() throws Exception {
245                Trie<String> fixture = new Trie<String>();
246                fixture.train(sequence, 3);
247                List<String> context = new ArrayList<String>();
248                context.add("a");
249                context.add("a");
250                context.add("b");
251                List<String> expected = new ArrayList<String>();
252                expected.add("a");
253                expected.add("b");
254
255                List<String> result = fixture.getContextSuffix(context);
256
257                ListAssert.assertEquals(expected, result);
258        }
259
260        @Test
261        public void testGetCount_1() throws Exception {
262                Trie<String> fixture = new Trie<String>();
263                fixture.train(sequence, 3);
264                List<String> subSequence = new ArrayList<String>();
265                subSequence.add("a");
266
267                int result = fixture.getCount(subSequence);
268
269                assertEquals(5, result);
270        }
271
272        @Test
273        public void testGetCount_2() throws Exception {
274                Trie<String> fixture = new Trie<String>();
275                fixture.train(sequence, 3);
276                List<String> subSequence = new ArrayList<String>();
277                subSequence.add("a");
278                subSequence.add("b");
279
280                int result = fixture.getCount(subSequence);
281
282                assertEquals(2, result);
283        }
284
285        @Test
286        public void testGetCount_3() throws Exception {
287                Trie<String> fixture = new Trie<String>();
288                fixture.train(sequence, 3);
289                List<String> subSequence = new ArrayList<String>();
290                subSequence.add("x");
291
292                int result = fixture.getCount(subSequence);
293
294                assertEquals(0, result);
295        }
296
297        @Test
298        public void testGetCount_4() throws Exception {
299                Trie<String> fixture = new Trie<String>();
300                fixture.train(sequence, 3);
301                List<String> subSequence = new ArrayList<String>();
302
303                int result = fixture.getCount(subSequence, "a");
304
305                assertEquals(5, result);
306        }
307
308        @Test
309        public void testGetCount_5() throws Exception {
310                Trie<String> fixture = new Trie<String>();
311                fixture.train(sequence, 3);
312                List<String> subSequence = new ArrayList<String>();
313                subSequence.add("a");
314                subSequence.add("b");
315
316                int result = fixture.getCount(subSequence, "r");
317
318                assertEquals(2, result);
319        }
320
321        @Test
322        public void testGetCount_6() throws Exception {
323                Trie<String> fixture = new Trie<String>();
324                fixture.train(sequence, 3);
325                List<String> subSequence = new ArrayList<String>();
326
327                int result = fixture.getCount(subSequence, "x");
328
329                assertEquals(0, result);
330        }
331
332        @Test
333        public void testGetFollowingSymbols_1() throws Exception {
334                Trie<String> fixture = new Trie<String>();
335                fixture.train(sequence, 3);
336                List<String> subSequence = new ArrayList<String>();
337                subSequence.add("a");
338                Collection<String> expected = new ArrayList<String>();
339                expected.add("b");
340                expected.add("c");
341                expected.add("d");
342
343                Collection<String> result = fixture.getFollowingSymbols(subSequence);
344
345                assertCollectionContent(expected, result);
346        }
347
348        @Test
349        public void testGetFollowingSymbols_2() throws Exception {
350                Trie<String> fixture = new Trie<String>();
351                fixture.train(sequence, 3);
352                List<String> subSequence = new ArrayList<String>();
353                subSequence.add("a");
354                subSequence.add("b");
355                subSequence.add("r");
356
357                Collection<String> result = fixture.getFollowingSymbols(subSequence);
358
359                assertEquals(0, result.size());
360        }
361
362        @Test
363        public void testGetFollowingSymbols_3() throws Exception {
364                Trie<String> fixture = new Trie<String>();
365                fixture.train(sequence, 3);
366                List<String> subSequence = new ArrayList<String>();
367                subSequence.add("x");
368
369                Collection<String> result = fixture.getFollowingSymbols(subSequence);
370
371                assertEquals(0, result.size());
372        }
373
374        @Test
375        public void testGetNumLeafAncestors_1() throws Exception {
376                Trie<String> fixture = new Trie<String>();
377                fixture.train(sequence, 3);
378
379                int result = fixture.getNumLeafAncestors();
380
381                assertEquals(7, result);
382        }
383
384        @Test
385        public void testGetNumLeafs_1() throws Exception {
386                Trie<String> fixture = new Trie<String>();
387                fixture.train(sequence, 3);
388
389                int result = fixture.getNumLeafs();
390
391                assertEquals(7, result);
392        }
393
394        @Test
395        public void testGetNumSymbols_1() throws Exception {
396                Trie<String> fixture = new Trie<String>();
397                fixture.train(sequence, 3);
398
399                int result = fixture.getNumSymbols();
400
401                assertEquals(5, result);
402        }
403
404        @Test
405        public void testTrain_1() throws Exception {
406                Trie<String> fixture = new Trie<String>();
407                int maxOrder = 3;
408
409                fixture.train(sequence, maxOrder);
410
411                // check if symbols are correct
412                assertCollectionContent(symbols, fixture.getKnownSymbols());
413
414                // check if counters are correct and only the correct nodes exist
415                TrieNode<String> root = fixture.find(new ArrayList<String>());
416                TrieNode<String> root_a = root.getChild("a");
417                TrieNode<String> root_a_a = root_a.getChild("a");
418                TrieNode<String> root_a_b = root_a.getChild("b");
419                TrieNode<String> root_a_b_a = root_a_b.getChild("a");
420                TrieNode<String> root_a_b_b = root_a_b.getChild("b");
421                TrieNode<String> root_a_b_c = root_a_b.getChild("c");
422                TrieNode<String> root_a_b_d = root_a_b.getChild("d");
423                TrieNode<String> root_a_b_r = root_a_b.getChild("r");
424                TrieNode<String> root_a_c = root_a.getChild("c");
425                TrieNode<String> root_a_c_a = root_a_c.getChild("a");
426                TrieNode<String> root_a_c_b = root_a_c.getChild("b");
427                TrieNode<String> root_a_c_c = root_a_c.getChild("c");
428                TrieNode<String> root_a_c_d = root_a_c.getChild("d");
429                TrieNode<String> root_a_c_r = root_a_c.getChild("r");
430                TrieNode<String> root_a_d = root_a.getChild("d");
431                TrieNode<String> root_a_d_a = root_a_d.getChild("a");
432                TrieNode<String> root_a_d_b = root_a_d.getChild("b");
433                TrieNode<String> root_a_d_c = root_a_d.getChild("c");
434                TrieNode<String> root_a_d_d = root_a_d.getChild("d");
435                TrieNode<String> root_a_d_r = root_a_d.getChild("r");
436                TrieNode<String> root_a_r = root_a.getChild("r");
437                TrieNode<String> root_b = root.getChild("b");
438                TrieNode<String> root_b_a = root_b.getChild("a");
439                TrieNode<String> root_b_b = root_b.getChild("b");
440                TrieNode<String> root_b_c = root_b.getChild("c");
441                TrieNode<String> root_b_d = root_b.getChild("d");
442                TrieNode<String> root_b_r = root_b.getChild("r");
443                TrieNode<String> root_b_r_a = root_b_r.getChild("a");
444                TrieNode<String> root_b_r_b = root_b_r.getChild("b");
445                TrieNode<String> root_b_r_c = root_b_r.getChild("c");
446                TrieNode<String> root_b_r_d = root_b_r.getChild("d");
447                TrieNode<String> root_b_r_r = root_b_r.getChild("r");
448                TrieNode<String> root_c = root.getChild("c");
449                TrieNode<String> root_c_a = root_c.getChild("a");
450                TrieNode<String> root_c_a_a = root_c_a.getChild("a");
451                TrieNode<String> root_c_a_b = root_c_a.getChild("b");
452                TrieNode<String> root_c_a_c = root_c_a.getChild("c");
453                TrieNode<String> root_c_a_d = root_c_a.getChild("d");
454                TrieNode<String> root_c_a_r = root_c_a.getChild("r");
455                TrieNode<String> root_c_b = root_c.getChild("b");
456                TrieNode<String> root_c_c = root_c.getChild("c");
457                TrieNode<String> root_c_d = root_c.getChild("d");
458                TrieNode<String> root_c_r = root_c.getChild("r");
459                TrieNode<String> root_d = root.getChild("d");
460                TrieNode<String> root_d_a = root_d.getChild("a");
461                TrieNode<String> root_d_a_a = root_d_a.getChild("a");
462                TrieNode<String> root_d_a_b = root_d_a.getChild("b");
463                TrieNode<String> root_d_a_c = root_d_a.getChild("c");
464                TrieNode<String> root_d_a_d = root_d_a.getChild("d");
465                TrieNode<String> root_d_a_r = root_d_a.getChild("r");
466                TrieNode<String> root_d_b = root_d.getChild("b");
467                TrieNode<String> root_d_c = root_d.getChild("c");
468                TrieNode<String> root_d_d = root_d.getChild("d");
469                TrieNode<String> root_d_r = root_d.getChild("r");
470                TrieNode<String> root_r = root.getChild("r");
471                TrieNode<String> root_r_a = root_r.getChild("a");
472                TrieNode<String> root_r_a_a = root_r_a.getChild("a");
473                TrieNode<String> root_r_a_b = root_r_a.getChild("b");
474                TrieNode<String> root_r_a_c = root_r_a.getChild("c");
475                TrieNode<String> root_r_a_d = root_r_a.getChild("d");
476                TrieNode<String> root_r_a_r = root_r_a.getChild("r");
477                TrieNode<String> root_r_b = root_r.getChild("b");
478                TrieNode<String> root_r_c = root_r.getChild("c");
479                TrieNode<String> root_r_d = root_r.getChild("d");
480                TrieNode<String> root_r_r = root_r.getChild("r");
481
482                assertEquals(5, root_a.getCount());
483                assertNull(root_a_a);
484                assertEquals(2, root_a_b.getCount());
485                assertNull(root_a_b_a);
486                assertNull(root_a_b_b);
487                assertNull(root_a_b_c);
488                assertNull(root_a_b_d);
489                assertEquals(2, root_a_b_r.getCount());
490                assertEquals(1, root_a_c.getCount());
491                assertEquals(1, root_a_c_a.getCount());
492                assertNull(root_a_c_b);
493                assertNull(root_a_c_c);
494                assertNull(root_a_c_d);
495                assertNull(root_a_c_r);
496                assertEquals(1, root_a_d.getCount());
497                assertEquals(1, root_a_d_a.getCount());
498                assertNull(root_a_d_b);
499                assertNull(root_a_d_c);
500                assertNull(root_a_d_d);
501                assertNull(root_a_d_r);
502                assertNull(root_a_r);
503
504                assertEquals(2, root_b.getCount());
505                assertNull(root_b_a);
506                assertNull(root_b_b);
507                assertNull(root_b_c);
508                assertNull(root_b_d);
509                assertEquals(2, root_b_r.getCount());
510                assertEquals(2, root_b_r_a.getCount());
511                assertNull(root_b_r_b);
512                assertNull(root_b_r_c);
513                assertNull(root_b_r_d);
514                assertNull(root_b_r_r);
515
516                assertEquals(1, root_c.getCount());
517                assertEquals(1, root_c_a.getCount());
518                assertNull(root_c_a_a);
519                assertNull(root_c_a_b);
520                assertNull(root_c_a_c);
521                assertEquals(1, root_c_a_d.getCount());
522                assertNull(root_c_a_r);
523                assertNull(root_c_b);
524                assertNull(root_c_c);
525                assertNull(root_c_d);
526                assertNull(root_c_r);
527
528                assertEquals(1, root_d.getCount());
529                assertEquals(1, root_d_a.getCount());
530                assertNull(root_d_a_a);
531                assertEquals(1, root_d_a_b.getCount());
532                assertNull(root_d_a_c);
533                assertNull(root_d_a_d);
534                assertNull(root_d_a_r);
535                assertNull(root_d_b);
536                assertNull(root_d_c);
537                assertNull(root_d_d);
538                assertNull(root_d_r);
539
540                assertEquals(2, root_r.getCount());
541                assertEquals(2, root_r_a.getCount());
542                assertNull(root_r_a_a);
543                assertNull(root_r_a_b);
544                assertEquals(1, root_r_a_c.getCount());
545                assertNull(root_r_a_d);
546                assertNull(root_r_a_r);
547                assertNull(root_r_b);
548                assertNull(root_r_c);
549                assertNull(root_r_d);
550                assertNull(root_r_r);
551
552                // check if leafs are really leafs
553                assertTrue(root_a_b_r.isLeaf());
554                assertTrue(root_a_c_a.isLeaf());
555                assertTrue(root_a_d_a.isLeaf());
556                assertTrue(root_b_r_a.isLeaf());
557                assertTrue(root_c_a_d.isLeaf());
558                assertTrue(root_d_a_b.isLeaf());
559                assertTrue(root_r_a_c.isLeaf());
560        }
561
562        @Test
563        public void testTrain_2() throws Exception {
564                Trie<String> fixture = new Trie<String>();
565                int maxOrder = 0;
566
567                fixture.train(sequence, maxOrder);
568
569                assertTrue(fixture.getKnownSymbols().isEmpty());
570        }
571
572        @Test
573        public void testTrain_3() throws Exception {
574                Trie<Object> fixture = new Trie<Object>();
575                List<Object> sequence = new ArrayList<Object>();
576                int maxOrder = 1;
577
578                fixture.train(sequence, maxOrder);
579
580                assertTrue(fixture.getKnownSymbols().isEmpty());
581        }
582
583        @Test
584        public void testTrain_4() throws Exception {
585                Trie<String> fixture = new Trie<String>();
586                List<String> sequence = new ArrayList<String>();
587                sequence.add("a");
588                sequence.add("b");
589                int maxOrder = 3;
590
591                fixture.train(sequence, maxOrder);
592
593                assertCollectionContent(sequence, fixture.getKnownSymbols());
594                TrieNode<String> root = fixture.find(new ArrayList<String>());
595                TrieNode<String> root_a = root.getChild("a");
596                TrieNode<String> root_a_a = root_a.getChild("a");
597                TrieNode<String> root_a_b = root_a.getChild("b");
598                TrieNode<String> root_b = root.getChild("b");
599                TrieNode<String> root_b_a = root_b.getChild("a");
600                TrieNode<String> root_b_b = root_b.getChild("b");
601
602                assertEquals(1, root_a.getCount());
603                assertNull(root_a_a);
604                assertEquals(1, root_a_b.getCount());
605                assertEquals(1, root_b.getCount());
606                assertNull(root_b_a);
607                assertNull(root_b_b);
608
609                assertTrue(root_a_b.isLeaf());
610                assertTrue(root_b.isLeaf());
611        }
612
613        @Test
614        public void testEdgeEdge_1() throws Exception {
615                Edge result = new Edge();
616
617                assertNotNull(result);
618        }
619
620        @Test
621        public void testTrieVertexTrieVertex_1() throws Exception {
622                String id = "idString";
623
624                TrieVertex result = new TrieVertex(id);
625
626                assertNotNull(result);
627        }
628
629        @Test
630        public void testTrieVertexToString_1() throws Exception {
631                String id = "idString";
632                TrieVertex fixture = new TrieVertex(id);
633
634                String result = fixture.toString();
635
636                assertEquals(id, result);
637        }
638
639        @Test
640        public void testEquals_1() throws Exception {
641                Trie<String> trieOther = new Trie<String>();
642                Trie<String> fixture = new Trie<String>();
643
644                boolean result = fixture.equals(trieOther);
645
646                assertEquals(true, result);
647        }
648
649        @Test
650        public void testEquals_2() throws Exception {
651                Trie<String> trieOther = new Trie<String>();
652                trieOther.train(sequence, 2);
653                Trie<String> fixture = new Trie<String>();
654                fixture.train(sequence, 2);
655
656                boolean result = fixture.equals(trieOther);
657
658                assertEquals(true, result);
659        }
660
661        @Test
662        public void testEquals_3() throws Exception {
663                Trie<String> trieOther = new Trie<String>();
664                trieOther.train(sequence, 2);
665                Trie<String> fixture = new Trie<String>();
666                fixture.train(sequence, 3);
667
668                boolean result = fixture.equals(trieOther);
669
670                assertEquals(false, result);
671        }
672
673        @Test
674        public void testEquals_4() throws Exception {
675                Trie<String> trieOther = new Trie<String>();
676                Trie<String> fixture = new Trie<String>();
677                fixture.train(sequence, 2);
678
679                boolean result = fixture.equals(trieOther);
680
681                assertEquals(false, result);
682        }
683
684        @Test
685        public void testEquals_5() throws Exception {
686                Trie<String> trieOther = new Trie<String>();
687                trieOther.train(sequence, 2);
688                Trie<String> fixture = new Trie<String>();
689
690                boolean result = fixture.equals(trieOther);
691
692                assertEquals(false, result);
693        }
694
695        @Test
696        public void testEquals_6() throws Exception {
697                Trie<String> fixture = new Trie<String>();
698                fixture.train(sequence, 2);
699
700                boolean result = fixture.equals(fixture);
701
702                assertEquals(true, result);
703        }
704
705        @Test
706        public void testEquals_7() throws Exception {
707                Trie<String> fixture = new Trie<String>();
708                fixture.train(sequence, 2);
709
710                boolean result = fixture.equals(null);
711
712                assertEquals(false, result);
713        }
714
715        @Before
716        public void setUp() throws Exception {
717                sequence = new ArrayList<String>();
718                sequence.add("a");
719                sequence.add("b");
720                sequence.add("r");
721                sequence.add("a");
722                sequence.add("c");
723                sequence.add("a");
724                sequence.add("d");
725                sequence.add("a");
726                sequence.add("b");
727                sequence.add("r");
728                sequence.add("a");
729
730                symbols = new HashSet<String>();
731                symbols.add("a");
732                symbols.add("b");
733                symbols.add("c");
734                symbols.add("d");
735                symbols.add("r");
736        }
737
738        public static void main(String[] args) {
739                new org.junit.runner.JUnitCore().run(TrieTest.class);
740        }
741}
Note: See TracBrowser for help on using the repository browser.