@Test
public void testFindKeywordsByJournal() throws DuplicateInstanceException {
User user = userService.registerUser("userPassword", new UserDetails(
"name", "lastName", "user@udc.es", "user"));
Journal j1 = new Journal("journal test 1", "jo tes",
"http://url.test1", 50, 20);
journalService.createJournal(j1);
Keyword k1 = new Keyword("etiqueta test comun");
Keyword k2 = new Keyword("etiqueta test 2 journal");
KeywordWeight kw1 = new KeywordWeight(0, user, k1);
KeywordWeight kw2 = new KeywordWeight(100, user, k2);
KeywordWeight kw3 = new KeywordWeight(50, user, k1);
KeywordWeightJournal kwj1 = new KeywordWeightJournal(kw1, j1);
KeywordWeightJournal kwj2 = new KeywordWeightJournal(kw2, j1);
KeywordWeightJournal kwj3 = new KeywordWeightJournal(kw3, j1);
keywordService.createKeywordWeightJournal(kwj1);
keywordService.createKeywordWeightJournal(kwj2);
keywordService.createKeywordWeightJournal(kwj3);
List<String> keywords = keywordService.findKeywordsByJournal(j1
.getJournalId());
assertEquals(2, keywords.size());
assertTrue(keywords.contains(WordUtils.capitalize(k1.getName())));
assertTrue(keywords.contains(WordUtils.capitalize(k2.getName())));