Search in sources :

Example 1 with TransferQueue

use of java.util.concurrent.TransferQueue in project dubbo by alibaba.

the class StringToTransferQueueConverterTest method testConvert.

@Test
public void testConvert() {
    TransferQueue values = new LinkedTransferQueue(asList(1, 2, 3));
    TransferQueue result = (TransferQueue) converter.convert("1,2,3", List.class, Integer.class);
    assertTrue(CollectionUtils.equals(values, result));
    values.clear();
    values.addAll(asList("123"));
    result = (TransferQueue) converter.convert("123", NavigableSet.class, String.class);
    assertTrue(CollectionUtils.equals(values, result));
    assertNull(converter.convert(null, Collection.class, Integer.class));
    assertNull(converter.convert("", Collection.class, null));
}
Also used : LinkedTransferQueue(java.util.concurrent.LinkedTransferQueue) TransferQueue(java.util.concurrent.TransferQueue) Collection(java.util.Collection) AbstractList(java.util.AbstractList) ArrayList(java.util.ArrayList) Arrays.asList(java.util.Arrays.asList) LinkedList(java.util.LinkedList) List(java.util.List) LinkedTransferQueue(java.util.concurrent.LinkedTransferQueue) Test(org.junit.jupiter.api.Test)

Aggregations

AbstractList (java.util.AbstractList)1 ArrayList (java.util.ArrayList)1 Arrays.asList (java.util.Arrays.asList)1 Collection (java.util.Collection)1 LinkedList (java.util.LinkedList)1 List (java.util.List)1 LinkedTransferQueue (java.util.concurrent.LinkedTransferQueue)1 TransferQueue (java.util.concurrent.TransferQueue)1 Test (org.junit.jupiter.api.Test)1