File tree Expand file tree Collapse file tree
main/java/org/prebid/server/analytics/reporter/liveintent
test/java/org/prebid/server/analytics/reporter/liveintent Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -127,7 +127,7 @@ private List<Activity> getActivities(AuctionContext auctionContext) {
127127 .toList ();
128128 }
129129
130- private Float getTreatmentRate (List <Activity > activities ) {
130+ private Optional < Float > getTreatmentRate (List <Activity > activities ) {
131131 return activities
132132 .stream ()
133133 .filter (activity -> "liveintent-treatment-rate" .equals (activity .name ()))
@@ -139,8 +139,7 @@ private Float getTreatmentRate(List<Activity> activities) {
139139 logger .warn ("Invalid treatment rate value: {}" , activity .status ());
140140 throw e ;
141141 }
142- })
143- .orElse (-1.0f );
142+ });
144143 }
145144
146145 private boolean isEnriched (List <Activity > activities ) {
Original file line number Diff line number Diff line change 55import lombok .Value ;
66
77import java .math .BigDecimal ;
8+ import java .util .Optional ;
89
910@ Data
1011@ Builder (toBuilder = true )
@@ -16,7 +17,7 @@ public class PbsjBid {
1617 BigDecimal price ;
1718 String adUnitId ;
1819 String currency ;
19- Float treatmentRate ;
20+ Optional < Float > treatmentRate ;
2021 Long timestamp ;
2122 String partnerId ;
2223}
Original file line number Diff line number Diff line change 3939import java .util .Arrays ;
4040import java .util .EnumMap ;
4141import java .util .List ;
42+ import java .util .Optional ;
4243
4344import static org .assertj .core .api .Assertions .assertThat ;
4445import static org .mockito .ArgumentMatchers .anyLong ;
@@ -120,7 +121,7 @@ public void shouldSendAllBidsToLiveIntent() {
120121 .adUnitId ("ad-unit-id" )
121122 .enriched (true )
122123 .currency ("USD" )
123- .treatmentRate (0.5f )
124+ .treatmentRate (Optional . of ( 0.5f ) )
124125 .timestamp (0L )
125126 .partnerId ("pbsj" )
126127 .build ()
@@ -152,7 +153,7 @@ public void shouldSendAllBidsToLiveIntentNotEnriched() {
152153 .adUnitId ("ad-unit-id" )
153154 .enriched (false )
154155 .currency ("USD" )
155- .treatmentRate (0.5f )
156+ .treatmentRate (Optional . of ( 0.5f ) )
156157 .timestamp (0L )
157158 .partnerId ("pbsj" )
158159 .build ()
@@ -184,7 +185,7 @@ public void shouldSendAllBidsToLiveIntentNoTreatmentRate() {
184185 .adUnitId ("ad-unit-id" )
185186 .enriched (false )
186187 .currency ("USD" )
187- .treatmentRate (- 1.0f )
188+ .treatmentRate (Optional . empty () )
188189 .timestamp (0L )
189190 .partnerId ("pbsj" )
190191 .build ()
You can’t perform that action at this time.
0 commit comments