KanjidicEntry extends DictEntry { public List<String> getNamae() { final String[] namae = reading.split("\\["); if (namae.length <= 1) { return Collections.emptyList(); } final List<String> result = new ArrayList<String>(); for (final String e : namae[1].split("[,\\]]")) { final String ee = e.trim(); if (ee.length() == 0) { continue; } result.add(ee); } return result; } KanjidicEntry(final String kanji, final String reading, final String english, final int radical, final int strokes, final String skip, final Integer grade); Integer getJlpt(); char getKanji(); List<String> getOnyomi(); List<String> getKunyomi(); List<String> getNamae(); List<String> getEnglish(); static String removeSplits(final String str); final int radical; final int strokes; final String skip; final Integer grade; }
@Test public void testNamae() { assertArrayEquals(test1().getNamae(), Arrays.asList("あ", "あし", "え", "かな", "なる", "めぐ", "めぐみ", "よし", "ちか")); assertArrayEquals(test2().getNamae(), Arrays.asList("から", "な", "なた", "ふさ", "まさ", "みち", "も", "わ")); assertArrayEquals(test3().getNamae(), Arrays.asList()); }