@@ -37,13 +37,15 @@ public class DecisionNotificationTest {
37
37
38
38
private static final Boolean FEATURE_ENABLED = Boolean .FALSE ;
39
39
private static final String EXPERIMENT_KEY = "experimentKey" ;
40
+ private static final String EXPERIMENT_ID = "1234567" ;
40
41
private static final String FEATURE_KEY = "featureKey" ;
41
42
private static final String FEATURE_VARIABLE_KEY = "featureVariableKey" ;
42
43
private static final String FEATURE_TEST = "featureTest" ;
43
44
private static final String FEATURE_TEST_VARIATION = "featureTestVariation" ;
44
45
private static final String USER_ID = "userID" ;
45
46
private static final Map <String , String > USER_ATTRIBUTES = Collections .singletonMap ("user" , "attr" );
46
47
private static final Variation VARIATION = mock (Variation .class );
48
+ private static final String VARIATION_ID = "1234567" ;
47
49
48
50
private FeatureTestSourceInfo featureTestSourceInfo ;
49
51
private RolloutSourceInfo rolloutSourceInfo ;
@@ -58,6 +60,8 @@ public void setUp() {
58
60
.withAttributes (USER_ATTRIBUTES )
59
61
.withExperimentKey (EXPERIMENT_KEY )
60
62
.withVariation (VARIATION )
63
+ .withExperimentId (EXPERIMENT_ID )
64
+ .withVariationId (VARIATION_ID )
61
65
.withType (NotificationCenter .DecisionNotificationType .AB_TEST .toString ())
62
66
.build ();
63
67
featureTestSourceInfo = new FeatureTestSourceInfo (FEATURE_TEST , FEATURE_TEST_VARIATION );
@@ -107,6 +111,8 @@ public void testGetDecisionInfo() {
107
111
HashMap <String , String > expectedExperimentDecisionInfo = new HashMap <>();
108
112
expectedExperimentDecisionInfo .put (DecisionNotification .ExperimentDecisionNotificationBuilder .EXPERIMENT_KEY , EXPERIMENT_KEY );
109
113
expectedExperimentDecisionInfo .put (DecisionNotification .ExperimentDecisionNotificationBuilder .VARIATION_KEY , VARIATION .getKey ());
114
+ expectedExperimentDecisionInfo .put (DecisionNotification .ExperimentDecisionNotificationBuilder .EXPERIMENT_ID , EXPERIMENT_ID );
115
+ expectedExperimentDecisionInfo .put (DecisionNotification .ExperimentDecisionNotificationBuilder .VARIATION_ID , VARIATION_ID );
110
116
assertEquals (expectedExperimentDecisionInfo , experimentDecisionNotification .getDecisionInfo ());
111
117
112
118
// Assert for Feature's DecisionInfo
@@ -128,7 +134,7 @@ public void testGetDecisionInfo() {
128
134
129
135
@ Test
130
136
public void testToString () {
131
- assertEquals ("DecisionNotification{type='ab-test', userId='userID', attributes={user=attr}, decisionInfo={experimentKey=experimentKey, variationKey=null}}" , experimentDecisionNotification .toString ());
137
+ assertEquals ("DecisionNotification{type='ab-test', userId='userID', attributes={user=attr}, decisionInfo={experimentKey=experimentKey, variationKey=null, experimentId='1234567', variationId='1234567' }}" , experimentDecisionNotification .toString ());
132
138
assertEquals ("DecisionNotification{type='feature', userId='userID', attributes={user=attr}, decisionInfo={featureEnabled=false, sourceInfo={experimentKey=featureTest, variationKey=featureTestVariation}, source=feature-test, featureKey=featureKey}}" , featureDecisionNotification .toString ());
133
139
assertEquals ("DecisionNotification{type='feature-variable', userId='userID', attributes={user=attr}, decisionInfo={variableType=string, featureEnabled=true, sourceInfo={}, variableValue=null, variableKey=featureVariableKey, source=rollout, featureKey=featureKey}}" , featureVariableDecisionNotification .toString ());
134
140
}
0 commit comments