/**
* Tests the set method.
*/
@Test
public void testSet() {
Citation citation = new CitationImpl();
final PropertyAccessor accessor = createPropertyAccessor(citation);
// Tries with ISBN, which expect a String.
Object value = "Random number";
int index = accessor.indexOf("ISBN");
assertTrue(index >= 0);
assertNull(accessor.set(index, citation, value));
assertSame(value, accessor.get(index, citation));
assertSame(value, citation.getISBN());
// Tries with the title. Automatic conversion from String to InternationalString expected.
index = accessor.indexOf("title");
assertTrue(index >= 0);
assertNull(accessor.set(index, citation, "A random title"));
value = accessor.get(index, citation);
assertTrue(value instanceof InternationalString);
assertEquals("A random title", value.toString());
assertSame(value, citation.getTitle());
// Tries with an element to be added in a collection.
index = accessor.indexOf("alternateTitle");
assertTrue(index >= 0);