package org.ovirt.engine.ui.uicommonweb;

import java.util.ArrayList;
import java.util.Arrays;

import junit.framework.Assert;

import org.junit.Test;

public class LinqTest {
    @Test
    public void intersection() {
        Assert.assertNotNull(Linq.Intersection(new ArrayList<ArrayList<String>>()));
        Assert.assertTrue(Linq.Intersection(new ArrayList<ArrayList<String>>()).isEmpty());

        Assert.assertNotNull(Linq.Intersection(null));
        Assert.assertTrue(Linq.Intersection(null).isEmpty());

        ArrayList<ArrayList<String>> lists = new ArrayList<ArrayList<String>>();
        lists.add(new ArrayList<String>(Arrays.asList("A", "B", "C")));
        lists.add(new ArrayList<String>(Arrays.asList("C", "D", "E")));
        Assert.assertNotNull(Linq.Intersection(lists));
        Assert.assertFalse(Linq.Intersection(lists).isEmpty());
        Assert.assertTrue(Linq.Intersection(lists).contains("C"));
        Assert.assertFalse(Linq.Intersection(lists).contains("A"));

        lists = new ArrayList<ArrayList<String>>();
        lists.add(new ArrayList<String>(Arrays.asList("1", "2", "3")));
        lists.add(new ArrayList<String>(Arrays.asList("A", "B", "C")));
        Assert.assertNotNull(Linq.Intersection(lists));
        Assert.assertTrue(Linq.Intersection(null).isEmpty());

    }
}

@@ -652,32 +652,74 @@
 A%22, %22B%22, %22C%22)));
+ //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
 %0A        lists.a
@@ -770,24 +770,66 @@
 %22D%22, %22E%22)));
+ //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
 %0A        Ass
@@ -1003,16 +1003,30 @@
 s(%22C%22));
+ //$NON-NLS-1$
 %0A       
@@ -1085,16 +1085,30 @@
 s(%22A%22));
+ //$NON-NLS-1$
 %0A%0A      
@@ -1220,24 +1220,66 @@
 %222%22, %223%22)));
+ //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
 %0A        lis
@@ -1334,24 +1334,66 @@
 %22B%22, %22C%22)));
+ //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
 %0A        Ass

fix checkstyle in tests