|
17 | 17 |
|
18 | 18 | package com.optimizely.ab.notification; |
19 | 19 |
|
| 20 | +import com.optimizely.ab.OptimizelyRuntimeException; |
20 | 21 | import com.optimizely.ab.bucketing.FeatureDecision; |
21 | 22 | import com.optimizely.ab.config.FeatureVariable; |
22 | 23 | import com.optimizely.ab.config.Variation; |
@@ -119,4 +120,78 @@ public void testGetDecisionInfo() { |
119 | 120 | assertEquals(FeatureDecision.DecisionSource.ROLLOUT.toString(), actualFeatureVariableDecisionInfo.get(DecisionNotification.FeatureVariableDecisionNotificationBuilder.SOURCE)); |
120 | 121 | assertEquals(rolloutSourceInfo.get(), actualFeatureVariableDecisionInfo.get(DecisionNotification.FeatureVariableDecisionNotificationBuilder.SOURCE_INFO)); |
121 | 122 | } |
| 123 | + |
| 124 | + @Test(expected = OptimizelyRuntimeException.class) |
| 125 | + public void nullTypeFailsExperimentNotificationBuild() { |
| 126 | + DecisionNotification.newExperimentDecisionNotificationBuilder() |
| 127 | + .withExperimentKey(EXPERIMENT_KEY) |
| 128 | + .build(); |
| 129 | + } |
| 130 | + |
| 131 | + @Test(expected = OptimizelyRuntimeException.class) |
| 132 | + public void nullExperimentKeyFailsExperimentNotificationBuild() { |
| 133 | + DecisionNotification.newExperimentDecisionNotificationBuilder() |
| 134 | + .withType(NotificationCenter.DecisionNotificationType.AB_TEST.toString()) |
| 135 | + .build(); |
| 136 | + } |
| 137 | + |
| 138 | + @Test(expected = OptimizelyRuntimeException.class) |
| 139 | + public void nullSourceFailsFeatureNotificationBuild() { |
| 140 | + DecisionNotification.newFeatureDecisionNotificationBuilder() |
| 141 | + .withFeatureKey(FEATURE_KEY) |
| 142 | + .withFeatureEnabled(FEATURE_ENABLED) |
| 143 | + .build(); |
| 144 | + } |
| 145 | + |
| 146 | + @Test(expected = OptimizelyRuntimeException.class) |
| 147 | + public void nullFeatureKeyFailsFeatureNotificationBuild() { |
| 148 | + DecisionNotification.newFeatureDecisionNotificationBuilder() |
| 149 | + .withFeatureEnabled(FEATURE_ENABLED) |
| 150 | + .withSource(FeatureDecision.DecisionSource.ROLLOUT) |
| 151 | + .build(); |
| 152 | + } |
| 153 | + |
| 154 | + @Test(expected = OptimizelyRuntimeException.class) |
| 155 | + public void nullFeatureEnabledFailsFeatureNotificationBuild() { |
| 156 | + DecisionNotification.newFeatureDecisionNotificationBuilder() |
| 157 | + .withFeatureKey(FEATURE_KEY) |
| 158 | + .withSource(FeatureDecision.DecisionSource.ROLLOUT) |
| 159 | + .build(); |
| 160 | + } |
| 161 | + |
| 162 | + @Test(expected = OptimizelyRuntimeException.class) |
| 163 | + public void nullFeatureKeyFailsFeatureVariableNotificationBuild() { |
| 164 | + DecisionNotification.newFeatureVariableDecisionNotificationBuilder() |
| 165 | + .withFeatureEnabled(Boolean.TRUE) |
| 166 | + .withVariableKey(FEATURE_VARIABLE_KEY) |
| 167 | + .withVariableType(FeatureVariable.VariableType.STRING) |
| 168 | + .build(); |
| 169 | + } |
| 170 | + |
| 171 | + @Test(expected = OptimizelyRuntimeException.class) |
| 172 | + public void nullFeatureEnabledFailsFeatureVariableNotificationBuild() { |
| 173 | + DecisionNotification.newFeatureVariableDecisionNotificationBuilder() |
| 174 | + .withFeatureKey(FEATURE_KEY) |
| 175 | + .withVariableKey(FEATURE_VARIABLE_KEY) |
| 176 | + .withVariableType(FeatureVariable.VariableType.STRING) |
| 177 | + .build(); |
| 178 | + } |
| 179 | + |
| 180 | + @Test(expected = OptimizelyRuntimeException.class) |
| 181 | + public void nullVariableKeyFailsFeatureVariableNotificationBuild() { |
| 182 | + DecisionNotification.newFeatureVariableDecisionNotificationBuilder() |
| 183 | + .withFeatureKey(FEATURE_KEY) |
| 184 | + .withFeatureEnabled(Boolean.TRUE) |
| 185 | + .withVariableType(FeatureVariable.VariableType.STRING) |
| 186 | + .build(); |
| 187 | + } |
| 188 | + |
| 189 | + @Test(expected = OptimizelyRuntimeException.class) |
| 190 | + public void nullVariableTypeFailsFeatureVariableNotificationBuild() { |
| 191 | + DecisionNotification.newFeatureVariableDecisionNotificationBuilder() |
| 192 | + .withFeatureKey(FEATURE_KEY) |
| 193 | + .withFeatureEnabled(Boolean.TRUE) |
| 194 | + .withVariableKey(FEATURE_VARIABLE_KEY) |
| 195 | + .build(); |
| 196 | + } |
122 | 197 | } |
0 commit comments