• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 package test.factory;
2 
3 import org.testng.Assert;
4 import org.testng.TestNG;
5 import org.testng.annotations.Test;
6 import org.testng.collections.Lists;
7 
8 import test.SimpleBaseTest;
9 
10 import java.util.List;
11 
12 public class FactoryInterleavingTest extends SimpleBaseTest {
13 
14   public static List<Integer> LOG = Lists.newArrayList();
15 
16   @Test
methodsShouldBeInterleaved()17   public void methodsShouldBeInterleaved() {
18     TestNG tng = create(FactoryInterleavingSampleFactory.class);
19     tng.run();
20     Integer[] valid1 = {
21         10, 11, 12, 13,
22         20, 21, 22, 23,
23     };
24 
25     Integer[] valid2 = {
26         20, 21, 22, 23,
27         10, 11, 12, 13,
28     };
29     Integer[] logArray = LOG.toArray(new Integer[LOG.size()]);
30     if (! logArray.equals(valid1)) {
31       Assert.assertEquals(logArray, valid1);
32     } else if (! logArray.equals(valid2)) {
33       System.err.println(logArray + " " + valid2);
34       Assert.assertEquals(logArray, valid2);
35     }
36   }
37 }
38