741 |
741 |
// Assert.assertEquals("Unexpected title cache.", "auct.", webPage1.getTitleCache());
|
742 |
742 |
// }
|
743 |
743 |
|
|
744 |
@Test
|
|
745 |
public void testCreateShortCitation(){
|
|
746 |
book1.setTitle("My book");
|
|
747 |
book1.setAuthorship(bookTeam1);
|
|
748 |
book1.setDatePublished(VerbatimTimePeriod.NewVerbatimInstance(1975));
|
|
749 |
Assert.assertEquals("Unexpected title cache.", "Book Author, My book. 1975", book1.getTitleCache());
|
|
750 |
|
|
751 |
book1.setTitleCache(null, false);
|
|
752 |
book1.setEdition("ed. 3");
|
|
753 |
|
|
754 |
Assert.assertEquals("Unexpected title cache.", "Book Author 1975", book1.getCacheStrategy().createShortCitation((Reference)book1, null, false));
|
|
755 |
Assert.assertEquals("Unexpected title cache.", "Book Author 1975", book1.getCacheStrategy().createShortCitation((Reference)book1, "", false));
|
|
756 |
Assert.assertEquals("Unexpected title cache.", "Book Author 1975: 55", book1.getCacheStrategy().createShortCitation((Reference)book1, "55", false));
|
|
757 |
Assert.assertEquals("Unexpected title cache.", "Book Author (1975: 55)", book1.getCacheStrategy().createShortCitation((Reference)book1, "55", true));
|
|
758 |
|
|
759 |
//1 person
|
|
760 |
Person person1 = Person.NewInstance("Pers.", "Person", "P.", "Percy");
|
|
761 |
Team team = Team.NewInstance(person1);
|
|
762 |
book1.setAuthorship(team);
|
|
763 |
Assert.assertEquals("Unexpected title cache.", "Person 1975: 55", book1.getCacheStrategy().createShortCitation((Reference)book1, "55", false));
|
|
764 |
team.setHasMoreMembers(true);
|
|
765 |
Assert.assertEquals("Unexpected title cache.", "Person & al. 1975: 55", book1.getCacheStrategy().createShortCitation((Reference)book1, "55", false));
|
|
766 |
team.setHasMoreMembers(false);
|
|
767 |
|
|
768 |
//2 persons
|
|
769 |
Person person2 = Person.NewInstance("Lers.", "Lerson", "L.", "Lercy");
|
|
770 |
team.addTeamMember(person2);
|
|
771 |
Assert.assertEquals("Unexpected title cache.", "Person & Lerson 1975: 55", book1.getCacheStrategy().createShortCitation((Reference)book1, "55", false));
|
|
772 |
team.setHasMoreMembers(true);
|
|
773 |
Assert.assertEquals("Unexpected title cache.", "Person & al. 1975: 55", book1.getCacheStrategy().createShortCitation((Reference)book1, "55", false));
|
|
774 |
team.setHasMoreMembers(false);
|
|
775 |
|
|
776 |
//3 persons
|
|
777 |
Person person3 = Person.NewInstance("Gers.", "Gerson", "G.", "Gercy");
|
|
778 |
team.addTeamMember(person3);
|
|
779 |
Assert.assertEquals("Unexpected title cache.", "Person & al. 1975: 55", book1.getCacheStrategy().createShortCitation((Reference)book1, "55", false));
|
|
780 |
team.setHasMoreMembers(true);
|
|
781 |
Assert.assertEquals("Unexpected title cache.", "Person & al. 1975: 55", book1.getCacheStrategy().createShortCitation((Reference)book1, "55", false));
|
|
782 |
team.setHasMoreMembers(false); //in case we want to continue test
|
|
783 |
|
|
784 |
|
|
785 |
}
|
744 |
786 |
|
745 |
787 |
}
|
fix #9384, ref #9279 fixed incorrect implementation of createShortCitation and added tests