@Test public void toMap_minimumParameters() { AdRequest adRequest = spy(new TestAdRequest.Builder(AdsType.Banner) .setAuctionId("test_id") .setAuctionPrice(0.25) .build()); Map<String, String> map = BidMachineFetcher.toMap(adRequest); assertEquals(3, map.size()); assertEquals("test_id", map.get(BidMachineFetcher.KEY_ID)); assertEquals("0.25", map.get(BidMachineFetcher.KEY_PRICE)); assertEquals("test_network", map.get(BidMachineFetcher.KEY_NETWORK_KEY)); assertFalse(map.containsKey(BidMachineFetcher.KEY_AD_TYPE)); }
@NonNull static Map<String, String> toMap(@NonNull AdRequest adRequest) { Map<String, String> result = new HashMap<>(); AuctionResult auctionResult = adRequest.getAuctionResult(); if (auctionResult == null) { return result; } result.put(BidMachineFetcher.KEY_ID, auctionResult.getId()); result.put(BidMachineFetcher.KEY_PRICE, BidMachineFetcher.roundPrice(auctionResult.getPrice())); result.put(BidMachineFetcher.KEY_NETWORK_KEY, auctionResult.getNetworkKey()); String adType = identifyAdType(auctionResult.getCreativeFormat()); if (adType != null) { result.put(BidMachineFetcher.KEY_AD_TYPE, adType); } result.putAll(auctionResult.getCustomParams()); return result; }
BidMachineFetcher { @NonNull static Map<String, String> toMap(@NonNull AdRequest adRequest) { Map<String, String> result = new HashMap<>(); AuctionResult auctionResult = adRequest.getAuctionResult(); if (auctionResult == null) { return result; } result.put(BidMachineFetcher.KEY_ID, auctionResult.getId()); result.put(BidMachineFetcher.KEY_PRICE, BidMachineFetcher.roundPrice(auctionResult.getPrice())); result.put(BidMachineFetcher.KEY_NETWORK_KEY, auctionResult.getNetworkKey()); String adType = identifyAdType(auctionResult.getCreativeFormat()); if (adType != null) { result.put(BidMachineFetcher.KEY_AD_TYPE, adType); } result.putAll(auctionResult.getCustomParams()); return result; } }
BidMachineFetcher { @NonNull static Map<String, String> toMap(@NonNull AdRequest adRequest) { Map<String, String> result = new HashMap<>(); AuctionResult auctionResult = adRequest.getAuctionResult(); if (auctionResult == null) { return result; } result.put(BidMachineFetcher.KEY_ID, auctionResult.getId()); result.put(BidMachineFetcher.KEY_PRICE, BidMachineFetcher.roundPrice(auctionResult.getPrice())); result.put(BidMachineFetcher.KEY_NETWORK_KEY, auctionResult.getNetworkKey()); String adType = identifyAdType(auctionResult.getCreativeFormat()); if (adType != null) { result.put(BidMachineFetcher.KEY_AD_TYPE, adType); } result.putAll(auctionResult.getCustomParams()); return result; }  }
BidMachineFetcher { @NonNull static Map<String, String> toMap(@NonNull AdRequest adRequest) { Map<String, String> result = new HashMap<>(); AuctionResult auctionResult = adRequest.getAuctionResult(); if (auctionResult == null) { return result; } result.put(BidMachineFetcher.KEY_ID, auctionResult.getId()); result.put(BidMachineFetcher.KEY_PRICE, BidMachineFetcher.roundPrice(auctionResult.getPrice())); result.put(BidMachineFetcher.KEY_NETWORK_KEY, auctionResult.getNetworkKey()); String adType = identifyAdType(auctionResult.getCreativeFormat()); if (adType != null) { result.put(BidMachineFetcher.KEY_AD_TYPE, adType); } result.putAll(auctionResult.getCustomParams()); return result; }  static void setPriceRounding(double rounding); static void setPriceRounding(double rounding, RoundingMode roundingMode); @Nullable @SuppressWarnings({"unchecked"}) static Map<String, String> fetch(@NonNull AdRequest adRequest); @Nullable static T release(@NonNull T adRequest); @Nullable static T release(@NonNull AdsType adsType,
                                                  @NonNull Map<String, String> fetchedParams); @Nullable @SuppressWarnings("unchecked") static T release(@NonNull AdsType adsType,
                                                  @Nullable String requestId); static String roundPrice(double price); static void resetPriceRounding(); }
BidMachineFetcher { @NonNull static Map<String, String> toMap(@NonNull AdRequest adRequest) { Map<String, String> result = new HashMap<>(); AuctionResult auctionResult = adRequest.getAuctionResult(); if (auctionResult == null) { return result; } result.put(BidMachineFetcher.KEY_ID, auctionResult.getId()); result.put(BidMachineFetcher.KEY_PRICE, BidMachineFetcher.roundPrice(auctionResult.getPrice())); result.put(BidMachineFetcher.KEY_NETWORK_KEY, auctionResult.getNetworkKey()); String adType = identifyAdType(auctionResult.getCreativeFormat()); if (adType != null) { result.put(BidMachineFetcher.KEY_AD_TYPE, adType); } result.putAll(auctionResult.getCustomParams()); return result; }  static void setPriceRounding(double rounding); static void setPriceRounding(double rounding, RoundingMode roundingMode); @Nullable @SuppressWarnings({"unchecked"}) static Map<String, String> fetch(@NonNull AdRequest adRequest); @Nullable static T release(@NonNull T adRequest); @Nullable static T release(@NonNull AdsType adsType,
                                                  @NonNull Map<String, String> fetchedParams); @Nullable @SuppressWarnings("unchecked") static T release(@NonNull AdsType adsType,
                                                  @Nullable String requestId); static String roundPrice(double price); static void resetPriceRounding(); static final String KEY_ID; static final String KEY_PRICE; static final String KEY_AD_TYPE; static final String KEY_NETWORK_KEY; static final String AD_TYPE_DISPLAY; static final String AD_TYPE_VIDEO; static final String AD_TYPE_NATIVE; }