@Test public void getBaseObjectWithEnclosure() { final SyndContent description = context.mock(SyndContent.class); final SyndEntryImpl entry = context.mock(SyndEntryImpl.class); final SyndLinkImpl link1 = context.mock(SyndLinkImpl.class, "link1"); final SyndLinkImpl link2 = context.mock(SyndLinkImpl.class, "link2"); final List<SyndLinkImpl> myLinks = new LinkedList<SyndLinkImpl>(); myLinks.add(link1); myLinks.add(link2); context.checking(new Expectations() { { oneOf(entry).getTitle(); will(returnValue(title)); oneOf(entry).getLinks(); will(returnValue(myLinks)); allowing(link1).getRel(); will(returnValue("enclosure")); oneOf(link1).getHref(); will(returnValue("")); allowing(link2).getRel(); will(returnValue("alternate")); oneOf(link2).getHref(); will(returnValue("")); allowing(entry).getDescription(); will(returnValue(description)); allowing(description).getValue(); will(returnValue("struffhere<img alt=\"\" src=\"source\"><span>desc</span>stuff")); allowing(entry).getLink(); will(returnValue(link2Href)); } }); Activity activity = new Activity(); sut.build(feed, entry, activity); assertEquals(BaseObjectType.VIDEO, activity.getBaseObjectType()); HashMap<String, String> result = activity.getBaseObject(); assertEquals(title, result.get("title")); assertEquals(link1Href, result.get("videoStream")); assertEquals(link2Href, result.get("videoPageUrl")); assertEquals("desc", result.get("description")); assertEquals("source", result.get("thumbnail")); }
@Override protected HashMap<String, String> getBaseObject(final SyndEntry entry) { HashMap<String, String> object = super.getBaseObject(entry); object.put("description", InputCleaner.stripHtml(entry.getDescription().getValue().split("<span>")[1] .split("</span>")[0], MAXLENGTH)); object.put("thumbnail", InputCleaner.stripHtml( entry.getDescription().getValue().split("<img alt=\"\" src=\"")[1].split("\"")[0], MAXLENGTH)); object.put("videoStream", "http: object.put("videoPageUrl", InputCleaner.stripHtml(entry.getLink(), MAXLENGTH)); return object; }
YoutubeMapper extends StandardFeedVideoMapper implements FeedObjectActivityBuilder { @Override protected HashMap<String, String> getBaseObject(final SyndEntry entry) { HashMap<String, String> object = super.getBaseObject(entry); object.put("description", InputCleaner.stripHtml(entry.getDescription().getValue().split("<span>")[1] .split("</span>")[0], MAXLENGTH)); object.put("thumbnail", InputCleaner.stripHtml( entry.getDescription().getValue().split("<img alt=\"\" src=\"")[1].split("\"")[0], MAXLENGTH)); object.put("videoStream", "http: object.put("videoPageUrl", InputCleaner.stripHtml(entry.getLink(), MAXLENGTH)); return object; } }
YoutubeMapper extends StandardFeedVideoMapper implements FeedObjectActivityBuilder { @Override protected HashMap<String, String> getBaseObject(final SyndEntry entry) { HashMap<String, String> object = super.getBaseObject(entry); object.put("description", InputCleaner.stripHtml(entry.getDescription().getValue().split("<span>")[1] .split("</span>")[0], MAXLENGTH)); object.put("thumbnail", InputCleaner.stripHtml( entry.getDescription().getValue().split("<img alt=\"\" src=\"")[1].split("\"")[0], MAXLENGTH)); object.put("videoStream", "http: object.put("videoPageUrl", InputCleaner.stripHtml(entry.getLink(), MAXLENGTH)); return object; }  }
YoutubeMapper extends StandardFeedVideoMapper implements FeedObjectActivityBuilder { @Override protected HashMap<String, String> getBaseObject(final SyndEntry entry) { HashMap<String, String> object = super.getBaseObject(entry); object.put("description", InputCleaner.stripHtml(entry.getDescription().getValue().split("<span>")[1] .split("</span>")[0], MAXLENGTH)); object.put("thumbnail", InputCleaner.stripHtml( entry.getDescription().getValue().split("<img alt=\"\" src=\"")[1].split("\"")[0], MAXLENGTH)); object.put("videoStream", "http: object.put("videoPageUrl", InputCleaner.stripHtml(entry.getLink(), MAXLENGTH)); return object; }   }
YoutubeMapper extends StandardFeedVideoMapper implements FeedObjectActivityBuilder { @Override protected HashMap<String, String> getBaseObject(final SyndEntry entry) { HashMap<String, String> object = super.getBaseObject(entry); object.put("description", InputCleaner.stripHtml(entry.getDescription().getValue().split("<span>")[1] .split("</span>")[0], MAXLENGTH)); object.put("thumbnail", InputCleaner.stripHtml( entry.getDescription().getValue().split("<img alt=\"\" src=\"")[1].split("\"")[0], MAXLENGTH)); object.put("videoStream", "http: object.put("videoPageUrl", InputCleaner.stripHtml(entry.getLink(), MAXLENGTH)); return object; }    }