@Test public void createCustomParams() { AdExtension adExtension1 = AdExtension.newBuilder() .putCustomParams("custom_key_1", "custom_value_1") .putCustomParams("custom_key_2", "custom_value_2") .putCustomParams("custom_key_3", "custom_value_3") .build(); AdExtension adExtension2 = AdExtension.newBuilder() .putCustomParams("custom_key_4", "custom_value_4") .putCustomParams("custom_key_5", "custom_value_5") .putCustomParams("custom_key_6", "custom_value_6") .build(); AdExtension adExtension3 = AdExtension.newBuilder() .putCustomParams("custom_key_2", "new_custom_value_2") .putCustomParams("custom_key_4", "new_custom_value_4") .build(); AppExtension notAdExtension = AppExtension.newBuilder().build(); Ad ad = Ad.newBuilder() .addExt(Any.pack(adExtension1)) .addExt(Any.pack(notAdExtension)) .addExt(Any.pack(adExtension2)) .addExt(Any.pack(adExtension3)) .addExt(Any.pack(adExtension3)) .build(); AuctionResult auctionResult = new AuctionResultImpl( Response.Seatbid.newBuilder().build(), Response.Seatbid.Bid.newBuilder().build(), ad, mock(NetworkConfig.class)); Map<String, String> customParams = auctionResult.getCustomParams(); assertEquals(6, customParams.size()); assertEquals("custom_value_1", customParams.get("custom_key_1")); assertEquals("new_custom_value_2", customParams.get("custom_key_2")); assertEquals("custom_value_3", customParams.get("custom_key_3")); assertEquals("new_custom_value_4", customParams.get("custom_key_4")); assertEquals("custom_value_5", customParams.get("custom_key_5")); assertEquals("custom_value_6", customParams.get("custom_key_6")); }
@NonNull private Map<String, String> createCustomParams(@NonNull Ad ad) { Map<String,String> customParams = new HashMap<>(); for (Any any : ad.getExtList()) { if (any.is(AdExtension.class)) { try { AdExtension adExtension = any.unpack(AdExtension.class); customParams.putAll(adExtension.getCustomParamsMap()); } catch (Exception ignore) { } } } return customParams; }
AuctionResultImpl implements AuctionResult { @NonNull private Map<String, String> createCustomParams(@NonNull Ad ad) { Map<String,String> customParams = new HashMap<>(); for (Any any : ad.getExtList()) { if (any.is(AdExtension.class)) { try { AdExtension adExtension = any.unpack(AdExtension.class); customParams.putAll(adExtension.getCustomParamsMap()); } catch (Exception ignore) { } } } return customParams; } }
AuctionResultImpl implements AuctionResult { @NonNull private Map<String, String> createCustomParams(@NonNull Ad ad) { Map<String,String> customParams = new HashMap<>(); for (Any any : ad.getExtList()) { if (any.is(AdExtension.class)) { try { AdExtension adExtension = any.unpack(AdExtension.class); customParams.putAll(adExtension.getCustomParamsMap()); } catch (Exception ignore) { } } } return customParams; } AuctionResultImpl(@NonNull Response.Seatbid seatbid,
                      @NonNull Response.Seatbid.Bid bid,
                      @NonNull Ad ad,
                      @NonNull NetworkConfig networkConfig); }
AuctionResultImpl implements AuctionResult { @NonNull private Map<String, String> createCustomParams(@NonNull Ad ad) { Map<String,String> customParams = new HashMap<>(); for (Any any : ad.getExtList()) { if (any.is(AdExtension.class)) { try { AdExtension adExtension = any.unpack(AdExtension.class); customParams.putAll(adExtension.getCustomParamsMap()); } catch (Exception ignore) { } } } return customParams; } AuctionResultImpl(@NonNull Response.Seatbid seatbid,
                      @NonNull Response.Seatbid.Bid bid,
                      @NonNull Ad ad,
                      @NonNull NetworkConfig networkConfig); @NonNull @Override String getId(); @Nullable @Override String getDemandSource(); @Override double getPrice(); @Nullable @Override String getDeal(); @Override @Nullable String getSeat(); @Override @NonNull String getCreativeId(); @Nullable @Override String getCid(); @Override @Nullable String[] getAdDomains(); @Override @NonNull String getNetworkKey(); @Nullable @Override CreativeFormat getCreativeFormat(); @NonNull @Override Map<String, String> getCustomParams(); @NonNull @Override String toString(); }
AuctionResultImpl implements AuctionResult { @NonNull private Map<String, String> createCustomParams(@NonNull Ad ad) { Map<String,String> customParams = new HashMap<>(); for (Any any : ad.getExtList()) { if (any.is(AdExtension.class)) { try { AdExtension adExtension = any.unpack(AdExtension.class); customParams.putAll(adExtension.getCustomParamsMap()); } catch (Exception ignore) { } } } return customParams; } AuctionResultImpl(@NonNull Response.Seatbid seatbid,
                      @NonNull Response.Seatbid.Bid bid,
                      @NonNull Ad ad,
                      @NonNull NetworkConfig networkConfig); @NonNull @Override String getId(); @Nullable @Override String getDemandSource(); @Override double getPrice(); @Nullable @Override String getDeal(); @Override @Nullable String getSeat(); @Override @NonNull String getCreativeId(); @Nullable @Override String getCid(); @Override @Nullable String[] getAdDomains(); @Override @NonNull String getNetworkKey(); @Nullable @Override CreativeFormat getCreativeFormat(); @NonNull @Override Map<String, String> getCustomParams(); @NonNull @Override String toString();  }