Improves utility code
	
		
			
	
		
	
	
		
	
		
			All checks were successful
		
		
	
	
		
			
				
	
				KnarCraft/FFmpegConvert/pipeline/head This commit looks good
				
			
		
		
	
	
				
					
				
			
		
			All checks were successful
		
		
	
	KnarCraft/FFmpegConvert/pipeline/head This commit looks good
				
			This commit is contained in:
		@@ -7,10 +7,13 @@ import java.util.ArrayList;
 | 
			
		||||
import java.util.List;
 | 
			
		||||
 | 
			
		||||
import static junit.framework.TestCase.assertEquals;
 | 
			
		||||
import static junit.framework.TestCase.assertTrue;
 | 
			
		||||
import static org.junit.Assert.assertArrayEquals;
 | 
			
		||||
import static org.junit.Assert.assertFalse;
 | 
			
		||||
 | 
			
		||||
public class ListUtilTest {
 | 
			
		||||
    private static List<Integer> matchesList;
 | 
			
		||||
    private static Integer[] containsList;
 | 
			
		||||
 | 
			
		||||
    @BeforeClass
 | 
			
		||||
    public static void setUp() {
 | 
			
		||||
@@ -25,6 +28,7 @@ public class ListUtilTest {
 | 
			
		||||
        matchesList.add(19);
 | 
			
		||||
        matchesList.add(21);
 | 
			
		||||
        matchesList.add(23);
 | 
			
		||||
        containsList = new Integer[]{1, 3, 5, 7, 234, 23, 45};
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    @Test
 | 
			
		||||
@@ -58,4 +62,28 @@ public class ListUtilTest {
 | 
			
		||||
        assertEquals(expected, result);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    @Test
 | 
			
		||||
    public void listContainsFalse() {
 | 
			
		||||
        assertFalse(ListUtil.listContains(containsList, (item) -> item == 0));
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    @Test
 | 
			
		||||
    public void listContainsTrue() {
 | 
			
		||||
        assertTrue(ListUtil.listContains(containsList, (item) -> item == 234));
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    @Test
 | 
			
		||||
    public void getList() {
 | 
			
		||||
        List<String> inputList = new ArrayList<>();
 | 
			
		||||
        inputList.add("some test string");
 | 
			
		||||
        inputList.add("some,test,string");
 | 
			
		||||
        inputList.add("some te,st string");
 | 
			
		||||
        String[] result1 = ListUtil.getList(inputList, 0);
 | 
			
		||||
        String[] result2 = ListUtil.getList(inputList, 1);
 | 
			
		||||
        String[] result3 = ListUtil.getList(inputList, 2);
 | 
			
		||||
        assertArrayEquals(new String[]{"some test string"}, result1);
 | 
			
		||||
        assertArrayEquals(new String[]{"some", "test", "string"}, result2);
 | 
			
		||||
        assertArrayEquals(new String[]{"some te", "st string"}, result3);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user