1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17 package org.kuali.student.enrollment.class2.courseoffering.service.util;
18
19 import edu.emory.mathcs.backport.java.util.Arrays;
20 import org.kuali.student.enrollment.class2.courseoffering.service.exception.PseudoUnitTestException;
21 import org.kuali.student.r2.common.util.constants.LuiServiceConstants;
22
23 import java.util.ArrayList;
24 import java.util.List;
25
26
27
28
29
30
31 public class RegGroupStateResult {
32 private List<String> expected;
33 private List<String> actual;
34 private int numAos;
35 private int numPermutations;
36 private static List<String> RG_STATES = Arrays.asList(LuiServiceConstants.REGISTRATION_GROUP_LIFECYCLE_KEY_STATES);
37
38 public RegGroupStateResult(int numAos) {
39
40 this.numAos = numAos;
41 numPermutations = (int) Math.pow(2, numAos);
42 expected = new ArrayList<String>();
43 actual = new ArrayList<String>();
44 while (expected.size() < numPermutations) {
45 expected.add(LuiServiceConstants.REGISTRATION_GROUP_PENDING_STATE_KEY);
46 actual.add("empty");
47 }
48 expected.set(expected.size() - 1, LuiServiceConstants.REGISTRATION_GROUP_OFFERED_STATE_KEY);
49 }
50
51 public String getExpected(int index) {
52 return expected.get(index);
53 }
54
55 public String getActual(int index) {
56 return actual.get(index);
57 }
58
59 public void setActual(int index, String rgState) throws PseudoUnitTestException {
60 if (!RG_STATES.contains(rgState)) {
61 throw new PseudoUnitTestException("Invalid rgState: " + rgState);
62 }
63 actual.set(index, rgState);
64 }
65
66 public int size() {
67 return expected.size();
68 }
69
70 public int numAos() {
71 return numAos;
72 }
73 }