mirror of
https://github.com/DSpace/DSpace.git
synced 2025-10-15 22:13:08 +00:00
Fix errorprone warning https://errorprone.info/bugpattern/StringSplitter
This commit is contained in:
@@ -14,6 +14,7 @@ import static org.mockito.Mockito.when;
|
|||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
import com.google.common.base.Splitter;
|
||||||
import org.dspace.content.Item;
|
import org.dspace.content.Item;
|
||||||
import org.dspace.content.MetadataValue;
|
import org.dspace.content.MetadataValue;
|
||||||
import org.dspace.content.service.ItemService;
|
import org.dspace.content.service.ItemService;
|
||||||
@@ -85,18 +86,15 @@ public class CollectedTest {
|
|||||||
metadataValueList.add(metadataValue);
|
metadataValueList.add(metadataValue);
|
||||||
String s = "dc.title";
|
String s = "dc.title";
|
||||||
list.add(s);
|
list.add(s);
|
||||||
String[] splittedString = s.split("\\.");
|
List<String> splittedString = Splitter.on('.').splitToList(s);
|
||||||
collected.setFields(list);
|
collected.setFields(list);
|
||||||
valueList.add("TestValue");
|
valueList.add("TestValue");
|
||||||
|
|
||||||
// Mock the state of objects utilized in getValues() to meet the success criteria of an invocation
|
// Mock the state of objects utilized in getValues() to meet the success criteria of an invocation
|
||||||
when(itemService.getMetadata(item, splittedString.length > 0 ? splittedString[0] :
|
when(itemService.getMetadata(item, splittedString.size() > 0 ? splittedString.get(0) : null,
|
||||||
null,
|
splittedString.size() > 1 ? splittedString.get(1) : null,
|
||||||
splittedString.length > 1 ? splittedString[1] :
|
splittedString.size() > 2 ? splittedString.get(2) : null,
|
||||||
null,
|
Item.ANY, false)).thenReturn(metadataValueList);
|
||||||
splittedString.length > 2 ? splittedString[2] :
|
|
||||||
null,
|
|
||||||
Item.ANY, false)).thenReturn(metadataValueList);
|
|
||||||
when(metadataValue.getValue()).thenReturn("TestValue");
|
when(metadataValue.getValue()).thenReturn("TestValue");
|
||||||
|
|
||||||
// The reported value(s) should match our valueList
|
// The reported value(s) should match our valueList
|
||||||
|
Reference in New Issue
Block a user