@Test public void getAbsoluteTrackers_shouldReturnCorrectValues() { List<VastAbsoluteProgressTracker> trackers = mXmlManager.getAbsoluteProgressTrackers(); assertThat(trackers.size()).isEqualTo(2); VastAbsoluteProgressTracker tracker0 = trackers.get(0); assertThat(tracker0.getTrackingMilliseconds()).isEqualTo(2000); assertThat(tracker0.getTrackingUrl()).isEqualTo("http: VastAbsoluteProgressTracker tracker1 = trackers.get(1); assertThat(tracker1.getTrackingMilliseconds()).isEqualTo(3670300); assertThat(tracker1.getTrackingUrl()).isEqualTo("http: }
@NonNull List<VastAbsoluteProgressTracker> getAbsoluteProgressTrackers() { List<VastAbsoluteProgressTracker> trackers = new ArrayList<VastAbsoluteProgressTracker>(); final List<String> startTrackers = getVideoTrackerByAttribute(START); for (String url : startTrackers) { trackers.add(new VastAbsoluteProgressTracker(url, START_TRACKER_THRESHOLD)); } final List<Node> progressNodes = XmlUtils.getNodesWithElementAndAttribute(mVastDoc, VIDEO_TRACKER, EVENT, PROGRESS); for (Node progressNode : progressNodes) { final String offSetString = XmlUtils.getAttributeValue(progressNode, OFFSET).trim(); if (Strings.isAbsoluteTracker(offSetString)) { String trackingUrl = XmlUtils.getNodeValue(progressNode).trim(); try { Integer trackingMilliseconds = Strings.parseAbsoluteOffset(offSetString); if (trackingMilliseconds != null) { trackers.add(new VastAbsoluteProgressTracker(trackingUrl, trackingMilliseconds)); } } catch (NumberFormatException e) { MoPubLog.d(String.format("Failed to parse VAST progress tracker %s", offSetString)); } } } Collections.sort(trackers); return trackers; }
VastXmlManager { @NonNull List<VastAbsoluteProgressTracker> getAbsoluteProgressTrackers() { List<VastAbsoluteProgressTracker> trackers = new ArrayList<VastAbsoluteProgressTracker>(); final List<String> startTrackers = getVideoTrackerByAttribute(START); for (String url : startTrackers) { trackers.add(new VastAbsoluteProgressTracker(url, START_TRACKER_THRESHOLD)); } final List<Node> progressNodes = XmlUtils.getNodesWithElementAndAttribute(mVastDoc, VIDEO_TRACKER, EVENT, PROGRESS); for (Node progressNode : progressNodes) { final String offSetString = XmlUtils.getAttributeValue(progressNode, OFFSET).trim(); if (Strings.isAbsoluteTracker(offSetString)) { String trackingUrl = XmlUtils.getNodeValue(progressNode).trim(); try { Integer trackingMilliseconds = Strings.parseAbsoluteOffset(offSetString); if (trackingMilliseconds != null) { trackers.add(new VastAbsoluteProgressTracker(trackingUrl, trackingMilliseconds)); } } catch (NumberFormatException e) { MoPubLog.d(String.format("Failed to parse VAST progress tracker %s", offSetString)); } } } Collections.sort(trackers); return trackers; } }
VastXmlManager { @NonNull List<VastAbsoluteProgressTracker> getAbsoluteProgressTrackers() { List<VastAbsoluteProgressTracker> trackers = new ArrayList<VastAbsoluteProgressTracker>(); final List<String> startTrackers = getVideoTrackerByAttribute(START); for (String url : startTrackers) { trackers.add(new VastAbsoluteProgressTracker(url, START_TRACKER_THRESHOLD)); } final List<Node> progressNodes = XmlUtils.getNodesWithElementAndAttribute(mVastDoc, VIDEO_TRACKER, EVENT, PROGRESS); for (Node progressNode : progressNodes) { final String offSetString = XmlUtils.getAttributeValue(progressNode, OFFSET).trim(); if (Strings.isAbsoluteTracker(offSetString)) { String trackingUrl = XmlUtils.getNodeValue(progressNode).trim(); try { Integer trackingMilliseconds = Strings.parseAbsoluteOffset(offSetString); if (trackingMilliseconds != null) { trackers.add(new VastAbsoluteProgressTracker(trackingUrl, trackingMilliseconds)); } } catch (NumberFormatException e) { MoPubLog.d(String.format("Failed to parse VAST progress tracker %s", offSetString)); } } } Collections.sort(trackers); return trackers; }  }
VastXmlManager { @NonNull List<VastAbsoluteProgressTracker> getAbsoluteProgressTrackers() { List<VastAbsoluteProgressTracker> trackers = new ArrayList<VastAbsoluteProgressTracker>(); final List<String> startTrackers = getVideoTrackerByAttribute(START); for (String url : startTrackers) { trackers.add(new VastAbsoluteProgressTracker(url, START_TRACKER_THRESHOLD)); } final List<Node> progressNodes = XmlUtils.getNodesWithElementAndAttribute(mVastDoc, VIDEO_TRACKER, EVENT, PROGRESS); for (Node progressNode : progressNodes) { final String offSetString = XmlUtils.getAttributeValue(progressNode, OFFSET).trim(); if (Strings.isAbsoluteTracker(offSetString)) { String trackingUrl = XmlUtils.getNodeValue(progressNode).trim(); try { Integer trackingMilliseconds = Strings.parseAbsoluteOffset(offSetString); if (trackingMilliseconds != null) { trackers.add(new VastAbsoluteProgressTracker(trackingUrl, trackingMilliseconds)); } } catch (NumberFormatException e) { MoPubLog.d(String.format("Failed to parse VAST progress tracker %s", offSetString)); } } } Collections.sort(trackers); return trackers; }   }
VastXmlManager { @NonNull List<VastAbsoluteProgressTracker> getAbsoluteProgressTrackers() { List<VastAbsoluteProgressTracker> trackers = new ArrayList<VastAbsoluteProgressTracker>(); final List<String> startTrackers = getVideoTrackerByAttribute(START); for (String url : startTrackers) { trackers.add(new VastAbsoluteProgressTracker(url, START_TRACKER_THRESHOLD)); } final List<Node> progressNodes = XmlUtils.getNodesWithElementAndAttribute(mVastDoc, VIDEO_TRACKER, EVENT, PROGRESS); for (Node progressNode : progressNodes) { final String offSetString = XmlUtils.getAttributeValue(progressNode, OFFSET).trim(); if (Strings.isAbsoluteTracker(offSetString)) { String trackingUrl = XmlUtils.getNodeValue(progressNode).trim(); try { Integer trackingMilliseconds = Strings.parseAbsoluteOffset(offSetString); if (trackingMilliseconds != null) { trackers.add(new VastAbsoluteProgressTracker(trackingUrl, trackingMilliseconds)); } } catch (NumberFormatException e) { MoPubLog.d(String.format("Failed to parse VAST progress tracker %s", offSetString)); } } } Collections.sort(trackers); return trackers; }    }