}
public void testFormat() {
NameFormat a = new NameFormat();
// Empty case
assertEquals("", a.format(""));
String formatString = "1@1@{vv }{ll}{ ff}@@2@1@{vv }{ll}{ ff}@2@ and {vv }{ll}{, ff}@@*@1@{vv }{ll}{ ff}@2..-2@, {vv }{ll}{, ff}@-1@ and {vv }{ll}{, ff}";
// Single Names
assertEquals("Vandekamp Mary~Ann", a.format("Mary Ann Vandekamp", formatString, null));
// Two names
assertEquals("von Neumann John and Black~Brown, Peter", a
.format("John von Neumann and Black Brown, Peter",formatString, null));
// Three names
assertEquals("von Neumann John, Smith, John and Black~Brown, Peter", a
.format("von Neumann, John and Smith, John and Black Brown, Peter", formatString, null));
assertEquals("von Neumann John, Smith, John and Black~Brown, Peter", a
.format("John von Neumann and John Smith and Black Brown, Peter", formatString, null));
// Four names
assertEquals("von Neumann John, Smith, John, Vandekamp, Mary~Ann and Black~Brown, Peter", a
.format("von Neumann, John and Smith, John and Vandekamp, Mary Ann and Black Brown, Peter", formatString, null));
}