mirror of
https://github.com/DSpace/DSpace.git
synced 2025-10-12 12:33:18 +00:00
Found a few more deprecated PosixParser, GnuParser, OptionBuilder. #2956
This commit is contained in:
@@ -0,0 +1,105 @@
|
||||
package org.dspace.content;
|
||||
|
||||
import static org.junit.Assert.assertEquals;
|
||||
import static org.junit.Assert.assertNull;
|
||||
|
||||
import org.junit.Test;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author mwood
|
||||
*/
|
||||
public class MetadataFieldNameTest {
|
||||
private static final String STRING_NAME_3 = "one.two.three";
|
||||
private static final String STRING_NAME_2 = "one.two";
|
||||
|
||||
public MetadataFieldNameTest() {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testConstruct3() {
|
||||
MetadataFieldName instance = new MetadataFieldName("one", "two", "three");
|
||||
assertEquals("Incorrect schema", "one", instance.SCHEMA);
|
||||
assertEquals("Incorrect element", "two", instance.ELEMENT);
|
||||
assertEquals("Incorrect qualifier", "three", instance.QUALIFIER);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testConstruct2() {
|
||||
MetadataFieldName instance = new MetadataFieldName("one", "two");
|
||||
assertEquals("Incorrect schema", "one", instance.SCHEMA);
|
||||
assertEquals("Incorrect element", "two", instance.ELEMENT);
|
||||
assertNull("Incorrect qualifier", instance.QUALIFIER);
|
||||
}
|
||||
|
||||
@Test(expected = NullPointerException.class)
|
||||
public void testConstructNull() {
|
||||
MetadataFieldName instance = new MetadataFieldName("one", null);
|
||||
}
|
||||
|
||||
/**
|
||||
* Test of parse method using a 3-part name.
|
||||
*/
|
||||
@Test
|
||||
public void testParse3() {
|
||||
String[] results = MetadataFieldName.parse(STRING_NAME_3);
|
||||
assertEquals(STRING_NAME_3, "one", results[0]);
|
||||
assertEquals(STRING_NAME_3, "two", results[1]);
|
||||
assertEquals(STRING_NAME_3, "three", results[2]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Test of parse method using a 2-part name.
|
||||
*/
|
||||
@Test
|
||||
public void TestParse2() {
|
||||
String[] results = MetadataFieldName.parse(STRING_NAME_2);
|
||||
assertEquals(STRING_NAME_2, "one", results[0]);
|
||||
assertEquals(STRING_NAME_2, "two", results[1]);
|
||||
assertNull(STRING_NAME_2, results[2]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Test of parse method using an illegal 1-part name.
|
||||
*/
|
||||
@Test(expected = IllegalArgumentException.class)
|
||||
public void TestParse1() {
|
||||
String[] results = MetadataFieldName.parse("one");
|
||||
}
|
||||
|
||||
/**
|
||||
* Test of parse method using an illegal 0-part (empty) name.
|
||||
*/
|
||||
@Test(expected = IllegalArgumentException.class)
|
||||
public void TestParse0() {
|
||||
String[] results = MetadataFieldName.parse("");
|
||||
}
|
||||
|
||||
/**
|
||||
* Test of parse method using an illegal null name.
|
||||
*/
|
||||
@Test(expected = NullPointerException.class)
|
||||
public void TestParseNull() {
|
||||
String[] results = MetadataFieldName.parse(null);
|
||||
}
|
||||
|
||||
/**
|
||||
* Test of toString method using a 3-part name.
|
||||
*/
|
||||
@Test
|
||||
public void testToString3() {
|
||||
MetadataFieldName instance = new MetadataFieldName("one", "two", "three");
|
||||
String name = instance.toString();
|
||||
assertEquals("Stringified name not assembled correctly", "one.two.three", name);
|
||||
}
|
||||
|
||||
/**
|
||||
* Test of toString method using a 2-part name.
|
||||
*/
|
||||
@Test
|
||||
public void testToString2() {
|
||||
MetadataFieldName instance = new MetadataFieldName("one", "two");
|
||||
String name = instance.toString();
|
||||
assertEquals("Stringified name not assembled correctly", "one.two", name);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user