public void setUp() throws Exception {\r
person1 = Person.NewInstance();\r
\r
- person1.setGivenName("P1FN");\r
- person1.setFamilyName("P1LN");\r
+ person1.setGivenName("P1GN");\r
+ person1.setFamilyName("P1FN");\r
person1.setPrefix("Dr1.");\r
person1.setSuffix("Suff1");\r
\r
person2 = Person.NewInstance();\r
person2.setNomenclaturalTitle("P2NomT");\r
- person2.setFamilyName("P2LN");\r
- person2.setGivenName("P2FN");\r
+ person2.setFamilyName("P2FN");\r
+ person2.setGivenName("P2GN");\r
person2.setSuffix("P2Suff");\r
\r
person3 = Person.NewInstance(); //empty person\r
@Test\r
public final void testGetNomenclaturalTitleCache(){\r
Assert.assertNotNull("person1 nomenclatural title must not to be null", person1.getNomenclaturalTitle());\r
- Assert.assertEquals("Person1 nomenclatural title should be taken from titleCache", "P1LN, P.", person1.getNomenclaturalTitle());\r
+ Assert.assertEquals("Person1 nomenclatural title should be taken from titleCache", "P1FN, P.", person1.getNomenclaturalTitle());\r
person1.setSuffix(null);\r
- Assert.assertEquals("Person1 title should be taken from titleCache", "P1LN, P.", person1.getNomenclaturalTitle());\r
+ Assert.assertEquals("Person1 title should be taken from titleCache", "P1FN, P.", person1.getNomenclaturalTitle());\r
//peson2\r
Assert.assertEquals("Person2 title should be P2NomT", "P2NomT", person2.getNomenclaturalTitle());\r
//person3\r
@Test\r
public final void testGetTitleCacheAdaptedFromOldVersion(){\r
Assert.assertNotNull("person1 title cache must not to be null", person1.getTitleCache());\r
- Assert.assertEquals("Person1 title cache should be created by familyname and computed initials", "P1LN, P.", person1.getTitleCache());\r
+ Assert.assertEquals("Person1 title cache should be created by familyname and computed initials", "P1FN, P.", person1.getTitleCache());\r
person1.setSuffix(null);\r
- Assert.assertEquals("Person1 title cache should be Dr1. P1FN P1LN", "P1LN, P.", person1.getTitleCache());\r
+ Assert.assertEquals("Person1 title cache should be Dr1. P1GN P1FN", "P1FN, P.", person1.getTitleCache());\r
//peson2\r
- Assert.assertEquals("Person2 title cache should be P2NomT", "P2LN, P.", person2.getTitleCache());\r
+ Assert.assertEquals("Person2 title cache should be P2NomT", "P2FN, P.", person2.getTitleCache());\r
//person3\r
Assert.assertNotNull("person3 title cache must not to be null", person3.getTitleCache());\r
Assert.assertTrue("Person3 title cache must not be empty", StringUtils.isNotBlank(person3.getTitleCache()));\r
public final void testGetFullTitle(){\r
Assert.assertNotNull("person1 full titlemust not to be null", person1.getFullTitle());\r
Assert.assertEquals("Person1 full title should be created by elements",\r
- "Dr1. P1FN P1LN Suff1", person1.getFullTitle());\r
+ "Dr1. P1GN P1FN Suff1", person1.getFullTitle());\r
person1.setSuffix(null);\r
- Assert.assertEquals("Person1 full title should be Dr1. P1FN P1LN",\r
- "Dr1. P1FN P1LN", person1.getFullTitle());\r
+ Assert.assertEquals("Person1 full title should be Dr1. P1GN P1FN",\r
+ "Dr1. P1GN P1FN", person1.getFullTitle());\r
//peson2\r
Assert.assertEquals("Person2 full title should be P2NomT",\r
- "P2FN P2LN P2Suff", person2.getFullTitle());\r
+ "P2GN P2FN P2Suff", person2.getFullTitle());\r
//person3\r
Assert.assertNotNull("person3 full title must not to be null",\r
person3.getFullTitle());\r
person1 = Person.NewInstance();
- person1.setGivenName("P1FN");
- person1.setFamilyName("P1LN");
+ person1.setGivenName("P1GN");
+ person1.setFamilyName("P1FN");
person1.setPrefix("Dr1.");
person1.setSuffix("Suff1");
person2 = Person.NewInstance();
person2.setNomenclaturalTitle("P2NomT");
- person2.setFamilyName("P2LN");
- person2.setGivenName("P2FN");
+ person2.setFamilyName("P2FN");
+ person2.setGivenName("P2GN");
person2.setSuffix("P2Suff");
person3 = Person.NewInstance();
person4 = Person.NewInstance();
person4.setNomenclaturalTitle("P4NomT");
- person4.setFamilyName("P4LN");
+ person4.setFamilyName("P4FN");
team1.addTeamMember(person1);
Assert.assertNotNull("team1 nomenclatural title must not to be null",
team1.getNomenclaturalTitle());
Assert.assertEquals("team1 nomenclatural title should be created by elements",
- "P1LN, P.", team1.getNomenclaturalTitle());
+ "P1FN, P.", team1.getNomenclaturalTitle());
person1.setSuffix(null);
- Assert.assertEquals("team1 nomenclatural title should be P1LN, P.",
- "P1LN, P.", team1.getNomenclaturalTitle());
+ Assert.assertEquals("team1 nomenclatural title should be P1FN, P.",
+ "P1FN, P.", team1.getNomenclaturalTitle());
//team2
- Assert.assertEquals("team2 nomenclatural title should be 'P2NomT, P1LN, P., P3NomT & P4NomT'",
- "P2NomT, P1LN, P., P3NomT & P4NomT", team2.getNomenclaturalTitle());
+ Assert.assertEquals("team2 nomenclatural title should be 'P2NomT, P1FN, P., P3NomT & P4NomT'",
+ "P2NomT, P1FN, P., P3NomT & P4NomT", team2.getNomenclaturalTitle());
//more
team2.setHasMoreMembers(true);
- Assert.assertEquals("team2 nomenclatural title should be 'P2NomT, P1LN, P., P3NomT, P4NomT & al.'",
- "P2NomT, P1LN, P., P3NomT, P4NomT & al.", team2.getNomenclaturalTitle());
+ Assert.assertEquals("team2 nomenclatural title should be 'P2NomT, P1FN, P., P3NomT, P4NomT & al.'",
+ "P2NomT, P1FN, P., P3NomT, P4NomT & al.", team2.getNomenclaturalTitle());
team2.setHasMoreMembers(false);
//3 members
team2.setCacheStrategy(TeamDefaultCacheStrategy.NewInstanceNomEtAl(3));
team2.setTitleCache(null, false);
- Assert.assertEquals("team2 nomenclatural title should still be 'P2NomT, P1LN, P. & al.' now.",
- "P2NomT, P1LN, P. & al.", team2.getNomenclaturalTitle());
+ Assert.assertEquals("team2 nomenclatural title should still be 'P2NomT, P1FN, P. & al.' now.",
+ "P2NomT, P1FN, P. & al.", team2.getNomenclaturalTitle());
//4 members
team2.setCacheStrategy(TeamDefaultCacheStrategy.NewInstanceNomEtAl(4));
team2.setTitleCache(null, false);
- Assert.assertEquals("team2 nomenclatural title should still be 'P2NomT, P1LN, P., P3NomT & P4NomT' now.",
- "P2NomT, P1LN, P., P3NomT & P4NomT", team2.getNomenclaturalTitle());
+ Assert.assertEquals("team2 nomenclatural title should still be 'P2NomT, P1FN, P., P3NomT & P4NomT' now.",
+ "P2NomT, P1FN, P., P3NomT & P4NomT", team2.getNomenclaturalTitle());
//team3/empty team
Assert.assertNotNull("team1 title cache must not to be null",
team1.getTitleCache());
Assert.assertEquals("team1 title cache should be created by members titleCache",
- "P1LN, P.", team1.getTitleCache());
+ "P1FN, P.", team1.getTitleCache());
person1.setSuffix(null);
- Assert.assertEquals("team1 title cache should be P1LN, P.",
- "P1LN, P.", team1.getTitleCache());
+ Assert.assertEquals("team1 title cache should be P1FN, P.",
+ "P1FN, P.", team1.getTitleCache());
//peson2
- Assert.assertEquals("team2 title cache should be 'P2LN, P., P1LN, P., P3NomT & P4LN'",
- "P2LN, P., P1LN, P., P3NomT & P4LN", team2.getTitleCache());
+ Assert.assertEquals("team2 title cache should be 'P2FN, P., P1FN, P., P3NomT & P4FN'",
+ "P2FN, P., P1FN, P., P3NomT & P4FN", team2.getTitleCache());
team2.setHasMoreMembers(true);
- Assert.assertEquals("team2 title cache should be 'P2LN, P., P1LN, P., P3NomT, P4LN & al.'",
- "P2LN, P., P1LN, P., P3NomT, P4LN & al.", team2.getTitleCache());
+ Assert.assertEquals("team2 title cache should be 'P2FN, P., P1FN, P., P3NomT, P4FN & al.'",
+ "P2FN, P., P1FN, P., P3NomT, P4FN & al.", team2.getTitleCache());
team2.setHasMoreMembers(false);
team2.setCacheStrategy(TeamDefaultCacheStrategy.NewInstanceTitleEtAl(3));
team2.setTitleCache(null, false);
- Assert.assertEquals("team2 nomenclatural title should still be 'P2LN, P., P1LN, P. & al.' now.",
- "P2LN, P., P1LN, P. & al.", team2.getTitleCache());
+ Assert.assertEquals("team2 nomenclatural title should still be 'P2FN, P., P1FN, P. & al.' now.",
+ "P2FN, P., P1FN, P. & al.", team2.getTitleCache());
team2.setCacheStrategy(TeamDefaultCacheStrategy.NewInstanceTitleEtAl(4));
team2.setTitleCache(null, false);
- Assert.assertEquals("team2 nomenclatural title should still be 'P2LN, P., P1LN, P., P3NomT & P4LN' now.",
- "P2LN, P., P1LN, P., P3NomT & P4LN", team2.getTitleCache());
+ Assert.assertEquals("team2 nomenclatural title should still be 'P2FN, P., P1FN, P., P3NomT & P4FN' now.",
+ "P2FN, P., P1FN, P., P3NomT & P4FN", team2.getTitleCache());
team2.setHasMoreMembers(true);
team2.setTitleCache(null, false);
- Assert.assertEquals("team2 nomenclatural title should still be 'P2LN, P., P1LN, P., P3NomT & al.' now.",
- "P2LN, P., P1LN, P., P3NomT & al.", team2.getTitleCache());
+ Assert.assertEquals("team2 nomenclatural title should still be 'P2FN, P., P1FN, P., P3NomT & al.' now.",
+ "P2FN, P., P1FN, P., P3NomT & al.", team2.getTitleCache());
//person3
public final void testFullTitle(){
Assert.assertNotNull("team1 full title must not to be null", team1.getFullTitle());
Assert.assertEquals("team1 full title should be created by elements",
- "Dr1. P1FN P1LN Suff1", team1.getFullTitle());
+ "Dr1. P1GN P1FN Suff1", team1.getFullTitle());
person1.setSuffix(null);
- Assert.assertEquals("team1 full title should be Dr1. P1FN P1LN", "Dr1. P1FN P1LN",
+ Assert.assertEquals("team1 full title should be Dr1. P1GN P1FN", "Dr1. P1GN P1FN",
team1.getFullTitle());
//team2
- Assert.assertEquals("team2 full title should be 'P2FN P2LN P2Suff, Dr1. P1FN P1LN, P3NomT & P4LN'",
- "P2FN P2LN P2Suff, Dr1. P1FN P1LN, P3NomT & P4LN", team2.getFullTitle());
+ Assert.assertEquals("team2 full title should be 'P2GN P2FN P2Suff, Dr1. P1GN P1FN, P3NomT & P4FN'",
+ "P2GN P2FN P2Suff, Dr1. P1GN P1FN, P3NomT & P4FN", team2.getFullTitle());
team2.setHasMoreMembers(true);
- Assert.assertEquals("team2 full title should be 'P2FN P2LN P2Suff, Dr1. P1FN P1LN, P3NomT, P4LN & al.'",
- "P2FN P2LN P2Suff, Dr1. P1FN P1LN, P3NomT, P4LN & al.", team2.getFullTitle());
+ Assert.assertEquals("team2 full title should be 'P2GN P2FN P2Suff, Dr1. P1GN P1FN, P3NomT, P4FN & al.'",
+ "P2GN P2FN P2Suff, Dr1. P1GN P1FN, P3NomT, P4FN & al.", team2.getFullTitle());
//team3
Assert.assertNotNull("team3 full title must not to be null",
public final void testListenersOnMembers(){
Assert.assertNotNull("team1 title cache must not to be null", team1.getTitleCache());
Assert.assertEquals("team1 title cache should be created by elements",
- "P1LN, P.", team1.getTitleCache());
+ "P1FN, P.", team1.getTitleCache());
person1.setGivenName("O.");
- Assert.assertEquals("team1 title cache should be P1LN, O.", "P1LN, O.", team1.getTitleCache());
+ Assert.assertEquals("team1 title cache should be P1FN, O.", "P1FN, O.", team1.getTitleCache());
}
}