11/**
22 *
3- * Copyright 2016, Optimizely and contributors
3+ * Copyright 2016-2017 , Optimizely and contributors
44 *
55 * Licensed under the Apache License, Version 2.0 (the "License");
66 * you may not use this file except in compliance with the License.
@@ -497,10 +497,11 @@ public void activateWithNullAttributes() throws Exception {
497497 */
498498 @ Test
499499 public void activateWithNullAttributeValues () throws Exception {
500- String datafile = noAudienceProjectConfigJsonV3 ();
501- ProjectConfig projectConfig = noAudienceProjectConfigV3 ();
500+ String datafile = validConfigJsonV3 ();
501+ ProjectConfig projectConfig = validProjectConfigV3 ();
502502 Experiment activatedExperiment = projectConfig .getExperiments ().get (0 );
503503 Variation bucketedVariation = activatedExperiment .getVariations ().get (0 );
504+ Attribute attribute = projectConfig .getAttributes ().get (0 );
504505
505506 // setup a mock event builder to return expected impression params
506507 EventBuilder mockEventBuilder = mock (EventBuilder .class );
@@ -525,7 +526,7 @@ public void activateWithNullAttributeValues() throws Exception {
525526
526527 // activate the experiment
527528 Map <String , String > attributes = new HashMap <String , String >();
528- attributes .put ("test" , null );
529+ attributes .put (attribute . getKey () , null );
529530 Variation actualVariation = optimizely .activate (activatedExperiment .getKey (), "userId" , attributes );
530531
531532 // verify that the bucketing algorithm was called correctly
@@ -538,6 +539,9 @@ public void activateWithNullAttributeValues() throws Exception {
538539 eq (bucketedVariation ), eq ("userId" ), attributeCaptor .capture (),
539540 isNull (String .class ));
540541
542+ Map <String , String > actualValue = attributeCaptor .getValue ();
543+ assertThat (actualValue , hasEntry (attribute .getKey (), null ));
544+
541545 // verify that dispatchEvent was called with the correct LogEvent object
542546 verify (mockEventHandler ).dispatchEvent (logEventToDispatch );
543547 }
@@ -985,9 +989,9 @@ public void trackEventWithNullAttributes() throws Exception {
985989 * Verify that {@link Optimizely#track(String, String)} gracefully handles null attribute values.
986990 */
987991 @ Test
988- public void trackEventWithNullAttributesValues () throws Exception {
989- String datafile = noAudienceProjectConfigJsonV3 ();
990- ProjectConfig projectConfig = noAudienceProjectConfigV3 ();
992+ public void trackEventWithNullAttributeValues () throws Exception {
993+ String datafile = validConfigJsonV3 ();
994+ ProjectConfig projectConfig = validProjectConfigV3 ();
991995 EventType eventType = projectConfig .getEventTypes ().get (0 );
992996
993997 // setup a mock event builder to return expected conversion params
0 commit comments