@@ -441,6 +441,9 @@ class AppboyKitTests {
441441 val customAttributes = HashMap <String , String >()
442442 customAttributes[" key1" ] = " value1"
443443 customAttributes[" key #2" ] = " value #3"
444+ val productCustomAttributes = HashMap <String , String >()
445+ productCustomAttributes[" productKey1" ] = " value1"
446+ productCustomAttributes[" productKey2" ] = " value2"
444447 val transactionAttributes = TransactionAttributes (" the id" )
445448 .setTax(100.0 )
446449 .setShipping(12.0 )
@@ -449,6 +452,11 @@ class AppboyKitTests {
449452 .setAffiliation(" the affiliation" )
450453 val product = Product .Builder (" product name" , " sku1" , 4.5 )
451454 .quantity(5.0 )
455+ .brand(" testBrand" )
456+ .variant(" testVariant" )
457+ .position(1 )
458+ .category(" testCategory" )
459+ .customAttributes(productCustomAttributes)
452460 .build()
453461 val commerceEvent = CommerceEvent .Builder (Product .PURCHASE , product)
454462 .currency(" Moon Dollars" )
@@ -491,11 +499,35 @@ class AppboyKitTests {
491499 properties.remove(CommerceEventUtils .Constants .ATT_AFFILIATION ),
492500 " the affiliation"
493501 )
502+ Assert .assertEquals(
503+ properties.remove(CommerceEventUtils .Constants .ATT_PRODUCT_NAME ),
504+ " product name"
505+ )
506+ Assert .assertEquals(
507+ properties.remove(CommerceEventUtils .Constants .ATT_PRODUCT_CATEGORY ),
508+ " testCategory"
509+ )
510+ Assert .assertEquals(
511+ properties.remove(CommerceEventUtils .Constants .ATT_PRODUCT_BRAND ),
512+ " testBrand"
513+ )
514+ Assert .assertEquals(
515+ properties.remove(CommerceEventUtils .Constants .ATT_PRODUCT_POSITION ),
516+ 1
517+ )
518+ Assert .assertEquals(
519+ properties.remove(CommerceEventUtils .Constants .ATT_PRODUCT_VARIANT ),
520+ " testVariant"
521+ )
494522
495523 // Custom Attributes
496524 Assert .assertEquals(properties.remove(" key1" ), " value1" )
497525 Assert .assertEquals(properties.remove(" key #2" ), " value #3" )
498526
527+ // Product Custom Attributes
528+ Assert .assertEquals(properties.remove(" productKey1" ), " value1" )
529+ Assert .assertEquals(properties.remove(" productKey2" ), " value2" )
530+
499531 val emptyAttributes = HashMap <String , String >()
500532 Assert .assertEquals(emptyAttributes, properties)
501533 }
0 commit comments