1010
1111public class AuthorsTest {
1212
13+ private ParamLayoutFormatter authorsLayoutFormatter = new Authors ();
14+
1315 @ Test
1416 public void testStandardUsage () {
15- ParamLayoutFormatter a = new Authors ();
1617 assertEquals ("B. C. Bruce, C. Manson and J. Jumper" ,
17- a .format ("Bob Croydon Bruce and Charles Manson and Jolly Jumper" ));
18+ authorsLayoutFormatter .format ("Bob Croydon Bruce and Charles Manson and Jolly Jumper" ));
1819 }
1920
2021 @ Test
2122 public void testStandardUsageOne () {
22- ParamLayoutFormatter a = new Authors ();
23- a .setArgument ("fullname, LastFirst, Comma, Comma" );
24- assertEquals ("Bruce, Bob Croydon, Jumper, Jolly" , a .format ("Bob Croydon Bruce and Jolly Jumper" ));
23+ authorsLayoutFormatter .setArgument ("fullname, LastFirst, Comma, Comma" );
24+ assertEquals ("Bruce, Bob Croydon, Jumper, Jolly" , authorsLayoutFormatter .format ("Bob Croydon Bruce and Jolly Jumper" ));
2525 }
2626
2727 @ Test
2828 public void testStandardUsageTwo () {
29- ParamLayoutFormatter a = new Authors ();
30- a .setArgument ("initials" );
31- assertEquals ("B. C. Bruce and J. Jumper" , a .format ("Bob Croydon Bruce and Jolly Jumper" ));
29+ authorsLayoutFormatter .setArgument ("initials" );
30+ assertEquals ("B. C. Bruce and J. Jumper" , authorsLayoutFormatter .format ("Bob Croydon Bruce and Jolly Jumper" ));
3231 }
3332
3433 @ Test
3534 public void testStandardUsageThree () {
36- ParamLayoutFormatter a = new Authors ();
37- a .setArgument ("fullname, LastFirst, Comma" );
35+ authorsLayoutFormatter .setArgument ("fullname, LastFirst, Comma" );
3836 assertEquals ("Bruce, Bob Croydon, Manson, Charles and Jumper, Jolly" ,
39- a .format ("Bob Croydon Bruce and Charles Manson and Jolly Jumper" ));
37+ authorsLayoutFormatter .format ("Bob Croydon Bruce and Charles Manson and Jolly Jumper" ));
4038 }
4139
4240 @ Test
4341 public void testStandardUsageFour () {
44- ParamLayoutFormatter a = new Authors ();
45- a .setArgument ("fullname, LastFirst, Comma, 2" );
42+ authorsLayoutFormatter .setArgument ("fullname, LastFirst, Comma, 2" );
4643 assertEquals ("Bruce, Bob Croydon et al." ,
47- a .format ("Bob Croydon Bruce and Charles Manson and Jolly Jumper" ));
44+ authorsLayoutFormatter .format ("Bob Croydon Bruce and Charles Manson and Jolly Jumper" ));
4845 }
4946
5047 @ Test
5148 public void testStandardUsageFive () {
52- ParamLayoutFormatter a = new Authors ();
53- a .setArgument ("fullname, LastFirst, Comma, 3" );
49+ authorsLayoutFormatter .setArgument ("fullname, LastFirst, Comma, 3" );
5450 assertEquals ("Bruce, Bob Croydon et al." ,
55- a .format ("Bob Croydon Bruce and Charles Manson and Jolly Jumper and Chuck Chuckles" ));
51+ authorsLayoutFormatter .format ("Bob Croydon Bruce and Charles Manson and Jolly Jumper and Chuck Chuckles" ));
5652 }
5753
5854 @ Test
5955 public void testStandardUsageSix () {
60- ParamLayoutFormatter a = new Authors ();
61- a .setArgument ("fullname, LastFirst, Comma, 3, 2" );
56+ authorsLayoutFormatter .setArgument ("fullname, LastFirst, Comma, 3, 2" );
6257 assertEquals ("Bruce, Bob Croydon, Manson, Charles et al." ,
63- a .format ("Bob Croydon Bruce and Charles Manson and Jolly Jumper and Chuck Chuckles" ));
58+ authorsLayoutFormatter .format ("Bob Croydon Bruce and Charles Manson and Jolly Jumper and Chuck Chuckles" ));
6459 }
6560
6661 @ Test
6762 public void testSpecialEtAl () {
68- ParamLayoutFormatter a = new Authors ();
69- a .setArgument ("fullname, LastFirst, Comma, 3, etal= and a few more" );
63+ authorsLayoutFormatter .setArgument ("fullname, LastFirst, Comma, 3, etal= and a few more" );
7064 assertEquals ("Bruce, Bob Croydon and a few more" ,
71- a .format ("Bob Croydon Bruce and Charles Manson and Jolly Jumper and Chuck Chuckles" ));
65+ authorsLayoutFormatter .format ("Bob Croydon Bruce and Charles Manson and Jolly Jumper and Chuck Chuckles" ));
7266 }
7367
7468 @ Test
7569 public void testStandardUsageNull () {
76- ParamLayoutFormatter a = new Authors ();
77- assertEquals ("" , a .format (null ));
70+ assertEquals ("" , authorsLayoutFormatter .format (null ));
7871 }
7972
8073 @ Test
8174 public void testStandardOxford () {
82- ParamLayoutFormatter a = new Authors ();
83- a .setArgument ("Oxford" );
75+ authorsLayoutFormatter .setArgument ("Oxford" );
8476 assertEquals ("B. C. Bruce, C. Manson, and J. Jumper" ,
85- a .format ("Bob Croydon Bruce and Charles Manson and Jolly Jumper" ));
77+ authorsLayoutFormatter .format ("Bob Croydon Bruce and Charles Manson and Jolly Jumper" ));
8678 }
8779
8880 @ Test
8981 public void testStandardOxfordFullName () {
90- ParamLayoutFormatter a = new Authors ();
91- a .setArgument ("FullName,Oxford" );
82+ authorsLayoutFormatter .setArgument ("FullName,Oxford" );
9283 assertEquals ("Bob Croydon Bruce, Charles Manson, and Jolly Jumper" ,
93- a .format ("Bruce, Bob Croydon and Charles Manson and Jolly Jumper" ));
84+ authorsLayoutFormatter .format ("Bruce, Bob Croydon and Charles Manson and Jolly Jumper" ));
9485 }
9586
9687 @ Test
9788 public void testStandardCommaFullName () {
98- ParamLayoutFormatter a = new Authors ();
99- a .setArgument ("FullName,Comma,Comma" );
89+ authorsLayoutFormatter .setArgument ("FullName,Comma,Comma" );
10090 assertEquals ("Bob Croydon Bruce, Charles Manson, Jolly Jumper" ,
101- a .format ("Bruce, Bob Croydon and Charles Manson and Jolly Jumper" ));
91+ authorsLayoutFormatter .format ("Bruce, Bob Croydon and Charles Manson and Jolly Jumper" ));
10292 }
10393
10494 @ Test
10595 public void testStandardAmpFullName () {
106- ParamLayoutFormatter a = new Authors ();
107- a .setArgument ("FullName,Amp" );
96+ authorsLayoutFormatter .setArgument ("FullName,Amp" );
10897 assertEquals ("Bob Croydon Bruce, Charles Manson & Jolly Jumper" ,
109- a .format ("Bruce, Bob Croydon and Charles Manson and Jolly Jumper" ));
98+ authorsLayoutFormatter .format ("Bruce, Bob Croydon and Charles Manson and Jolly Jumper" ));
11099 }
111100
112101 @ Test
113102 public void testLastName () {
114- ParamLayoutFormatter a = new Authors ();
115- a .setArgument ("LastName" );
103+ authorsLayoutFormatter .setArgument ("LastName" );
116104 assertEquals ("Bruce, von Manson and Jumper" ,
117- a .format ("Bruce, Bob Croydon and Charles von Manson and Jolly Jumper" ));
105+ authorsLayoutFormatter .format ("Bruce, Bob Croydon and Charles von Manson and Jolly Jumper" ));
118106 }
119107
120108 @ Test
121109 public void testMiddleInitial () {
122- ParamLayoutFormatter a = new Authors ();
123- a .setArgument ("MiddleInitial" );
110+ authorsLayoutFormatter .setArgument ("MiddleInitial" );
124111 assertEquals ("Bob C. Bruce, Charles K. von Manson and Jolly Jumper" ,
125- a .format ("Bruce, Bob Croydon and Charles Kermit von Manson and Jumper, Jolly" ));
112+ authorsLayoutFormatter .format ("Bruce, Bob Croydon and Charles Kermit von Manson and Jumper, Jolly" ));
126113 }
127114
128115 @ Test
129116 public void testNoPeriod () {
130- ParamLayoutFormatter a = new Authors ();
131- a .setArgument ("NoPeriod" );
117+ authorsLayoutFormatter .setArgument ("NoPeriod" );
132118 assertEquals ("B C Bruce, C K von Manson and J Jumper" ,
133- a .format ("Bruce, Bob Croydon and Charles Kermit von Manson and Jumper, Jolly" ));
119+ authorsLayoutFormatter .format ("Bruce, Bob Croydon and Charles Kermit von Manson and Jumper, Jolly" ));
134120 }
135121
136122 @ Test
137123 public void testEtAl () {
138- ParamLayoutFormatter a = new Authors ();
139- a .setArgument ("2,1" );
124+ authorsLayoutFormatter .setArgument ("2,1" );
140125 assertEquals ("B. C. Bruce et al." ,
141- a .format ("Bruce, Bob Croydon and Charles Kermit von Manson and Jumper, Jolly" ));
126+ authorsLayoutFormatter .format ("Bruce, Bob Croydon and Charles Kermit von Manson and Jumper, Jolly" ));
142127 }
143128
144129 @ Test
145130 public void testEtAlNotEnoughAuthors () {
146- ParamLayoutFormatter a = new Authors ();
147- a .setArgument ("2,1" );
131+ authorsLayoutFormatter .setArgument ("2,1" );
148132 assertEquals ("B. C. Bruce and C. K. von Manson" ,
149- a .format ("Bruce, Bob Croydon and Charles Kermit von Manson" ));
133+ authorsLayoutFormatter .format ("Bruce, Bob Croydon and Charles Kermit von Manson" ));
150134 }
151135
152136 @ Test
153137 public void testEmptyEtAl () {
154- ParamLayoutFormatter a = new Authors ();
155- a .setArgument ("fullname, LastFirst, Comma, 3, etal=" );
138+ authorsLayoutFormatter .setArgument ("fullname, LastFirst, Comma, 3, etal=" );
156139 assertEquals ("Bruce, Bob Croydon" ,
157- a .format ("Bob Croydon Bruce and Charles Manson and Jolly Jumper and Chuck Chuckles" ));
140+ authorsLayoutFormatter .format ("Bob Croydon Bruce and Charles Manson and Jolly Jumper and Chuck Chuckles" ));
158141 }
159142
160143 @ ParameterizedTest (name = "arg={0}, formattedStr={1}" )
@@ -164,9 +147,8 @@ public void testEmptyEtAl() {
164147 "LastFirstFirstFirst, 'Bruce, B. C., C. Manson, J. Jumper and C. Chuckles'" // LastFirstFirstFirst
165148 })
166149 public void testAuthorOrder (String arg , String expectedResult ) {
167- ParamLayoutFormatter a = new Authors ();
168- a .setArgument (arg );
169- String formattedStr = a .format ("Bob Croydon Bruce and Charles Manson and Jolly Jumper and Chuck Chuckles" );
150+ authorsLayoutFormatter .setArgument (arg );
151+ String formattedStr = authorsLayoutFormatter .format ("Bob Croydon Bruce and Charles Manson and Jolly Jumper and Chuck Chuckles" );
170152 assertEquals (expectedResult , formattedStr );
171153 }
172154
@@ -180,9 +162,8 @@ public void testAuthorOrder(String arg, String expectedResult) {
180162 "InitialsNoSpace, 'B.C. Bruce, C. Manson, J. Jumper and C. Chuckles'" // InitialsNoSpace
181163 })
182164 public void testAuthorABRV (String arg , String expectedResult ) {
183- ParamLayoutFormatter a = new Authors ();
184- a .setArgument (arg );
185- String formattedStr = a .format ("Bob Croydon Bruce and Charles Manson and Jolly Jumper and Chuck Chuckles" );
165+ authorsLayoutFormatter .setArgument (arg );
166+ String formattedStr = authorsLayoutFormatter .format ("Bob Croydon Bruce and Charles Manson and Jolly Jumper and Chuck Chuckles" );
186167 assertEquals (expectedResult , formattedStr );
187168 }
188169
@@ -194,9 +175,8 @@ public void testAuthorABRV(String arg, String expectedResult) {
194175 "NoPeriod, 'B C Bruce, C Manson, J Jumper and C Chuckles'" // NoPeriod
195176 })
196177 public void testAuthorPUNC (String arg , String expectedResult ) {
197- ParamLayoutFormatter a = new Authors ();
198- a .setArgument (arg );
199- String formattedStr = a .format ("Bob Croydon Bruce and Charles Manson and Jolly Jumper and Chuck Chuckles" );
178+ authorsLayoutFormatter .setArgument (arg );
179+ String formattedStr = authorsLayoutFormatter .format ("Bob Croydon Bruce and Charles Manson and Jolly Jumper and Chuck Chuckles" );
200180 assertEquals (expectedResult , formattedStr );
201181 }
202182
@@ -217,9 +197,8 @@ public void testAuthorPUNC(String arg, String expectedResult) {
217197 "'Comma, Semicolon', 'B. C. Bruce, C. Manson, J. Jumper; C. Chuckles'" , // Comma Semicolon
218198 })
219199 public void testAuthorSEPARATORS (String arg , String expectedResult ) {
220- ParamLayoutFormatter a = new Authors ();
221- a .setArgument (arg );
222- String formattedStr = a .format ("Bob Croydon Bruce and Charles Manson and Jolly Jumper and Chuck Chuckles" );
200+ authorsLayoutFormatter .setArgument (arg );
201+ String formattedStr = authorsLayoutFormatter .format ("Bob Croydon Bruce and Charles Manson and Jolly Jumper and Chuck Chuckles" );
223202 assertEquals (expectedResult , formattedStr );
224203 }
225204}
0 commit comments