@Test public void testGetListCredits() { String[] creditsArray = new String[] { "title1|author1|url1|license1", "title2|author2|url2|" }; Credits credits = new Credits(creditsArray); List<Map<String, String>> creditsList = credits.getListCredits(); Assert.assertEquals(2, creditsList.size()); Map<String, String> credit1 = creditsList.get(0); Assert.assertEquals("title1", credit1.get(Credits.CREDIT_TITLE)); Assert.assertEquals("author1", credit1.get(Credits.CREDIT_AUTHOR)); Assert.assertEquals("url1", credit1.get(Credits.CREDIT_URL)); Assert.assertEquals("license1", credit1.get(Credits.CREDIT_LICENSE)); Map<String, String> credit2 = creditsList.get(1); Assert.assertEquals("title2", credit2.get(Credits.CREDIT_TITLE)); Assert.assertEquals("author2", credit2.get(Credits.CREDIT_AUTHOR)); Assert.assertEquals("url2", credit2.get(Credits.CREDIT_URL)); Assert.assertNull(credit2.get(Credits.CREDIT_LICENSE)); }
public List<Map<String, String>> getListCredits() { List<Map<String, String>> creditList = new ArrayList<Map<String, String>>(); for (int i = 0; i < credits.length; i++) { creditMap = new HashMap<String, String>(); String[] creditArray = StringHelper.split(credits[i], FIELD_SEPARATOR); loadCredit(CREDIT_TITLE, 0, creditArray); loadCredit(CREDIT_AUTHOR, 1, creditArray); loadCredit(CREDIT_URL, 2, creditArray); loadCredit(CREDIT_LICENSE, 3, creditArray); creditList.add(creditMap); } return creditList; }
Credits { public List<Map<String, String>> getListCredits() { List<Map<String, String>> creditList = new ArrayList<Map<String, String>>(); for (int i = 0; i < credits.length; i++) { creditMap = new HashMap<String, String>(); String[] creditArray = StringHelper.split(credits[i], FIELD_SEPARATOR); loadCredit(CREDIT_TITLE, 0, creditArray); loadCredit(CREDIT_AUTHOR, 1, creditArray); loadCredit(CREDIT_URL, 2, creditArray); loadCredit(CREDIT_LICENSE, 3, creditArray); creditList.add(creditMap); } return creditList; } }
Credits { public List<Map<String, String>> getListCredits() { List<Map<String, String>> creditList = new ArrayList<Map<String, String>>(); for (int i = 0; i < credits.length; i++) { creditMap = new HashMap<String, String>(); String[] creditArray = StringHelper.split(credits[i], FIELD_SEPARATOR); loadCredit(CREDIT_TITLE, 0, creditArray); loadCredit(CREDIT_AUTHOR, 1, creditArray); loadCredit(CREDIT_URL, 2, creditArray); loadCredit(CREDIT_LICENSE, 3, creditArray); creditList.add(creditMap); } return creditList; } Credits(String[] pCredits); }
Credits { public List<Map<String, String>> getListCredits() { List<Map<String, String>> creditList = new ArrayList<Map<String, String>>(); for (int i = 0; i < credits.length; i++) { creditMap = new HashMap<String, String>(); String[] creditArray = StringHelper.split(credits[i], FIELD_SEPARATOR); loadCredit(CREDIT_TITLE, 0, creditArray); loadCredit(CREDIT_AUTHOR, 1, creditArray); loadCredit(CREDIT_URL, 2, creditArray); loadCredit(CREDIT_LICENSE, 3, creditArray); creditList.add(creditMap); } return creditList; } Credits(String[] pCredits); List<Map<String, String>> getListCredits(); }
Credits { public List<Map<String, String>> getListCredits() { List<Map<String, String>> creditList = new ArrayList<Map<String, String>>(); for (int i = 0; i < credits.length; i++) { creditMap = new HashMap<String, String>(); String[] creditArray = StringHelper.split(credits[i], FIELD_SEPARATOR); loadCredit(CREDIT_TITLE, 0, creditArray); loadCredit(CREDIT_AUTHOR, 1, creditArray); loadCredit(CREDIT_URL, 2, creditArray); loadCredit(CREDIT_LICENSE, 3, creditArray); creditList.add(creditMap); } return creditList; } Credits(String[] pCredits); List<Map<String, String>> getListCredits(); static final String CREDIT_LICENSE; static final String CREDIT_URL; static final String CREDIT_AUTHOR; static final String CREDIT_TITLE; }