package com.github.dockerjava.api.model;

import com.google.common.collect.Maps;
import org.testng.annotations.Test;

import java.util.Map;

import static org.testng.Assert.assertEquals;
import static org.testng.Assert.assertNotSame;

/**
 * @author Vincent Latombe <vincent@latombe.net>
 */
public class FiltersTest {

    @Test
    public void newFiltersShouldBeEquals() {
        assertEquals(new Filters(), new Filters());
    }

    @Test
    public void filtersWithEqualContentShouldBeEquals() {
        assertEquals(new Filters().withContainers("foo"), new Filters().withContainers("foo"));
        assertEquals(new Filters().withLabels("alpha=val"), new Filters().withLabels("alpha=val"));
    }

    @Test
    public void withLabelsMapShouldBeEquivalentToVarargs() {
        Map<String, String> map = Maps.newHashMap();
        map.put("alpha", "val");
        assertEquals(new Filters().withLabels("alpha=val"), new Filters().withLabels(map));

        map = Maps.newHashMap();
        map.put("alpha", "val");
        map.put("beta", "val1");
        assertEquals(new Filters().withLabels("alpha=val", "beta=val1"), new Filters().withLabels(map));
    }

    @Test
    public void filtersWithDifferentContentShouldntBeEquals() {
        assertNotSame(new Filters().withContainers("foo"), new Filters().withContainers("bar"));
    }
}

@@ -170,67 +170,9 @@
 ert.
-assertEquals;%0Aimport static org.testng.Assert.assertNotSame
+*
 ;%0A%0A/
@@ -361,32 +361,177 @@
 ters());%0A    %7D%0A%0A
+    @Test%0A    public void newFiltersShouldHaveEqualHashcode() %7B%0A        assertEquals(new Filters().hashCode(), new Filters().hashCode());%0A    %7D%0A%0A
     @Test%0A    pu
@@ -777,32 +777,356 @@
 =val%22));%0A    %7D%0A%0A
+    @Test%0A    public void filtersWithEqualContentShouldHaveEqualHashcode() %7B%0A        assertEquals(new Filters().withContainers(%22foo%22).hashCode(), new Filters().withContainers(%22foo%22).hashCode());%0A        assertEquals(new Filters().withLabels(%22alpha=val%22).hashCode(), new Filters().withLabels(%22alpha=val%22).hashCode());%0A    %7D%0A%0A
     @Test%0A    pu
@@ -1163,15 +1163,11 @@
 eEqu
-ivalent
+als
 ToVa
@@ -1661,12 +1661,203 @@
 tNot
-Same
+Equals(new Filters().withContainers(%22foo%22), new Filters().withContainers(%22bar%22));%0A    %7D%0A%0A    @Test%0A    public void filtersWithDifferentContentShouldntHaveEqualHashcode() %7B%0A        assertNotEquals
 (new
@@ -1880,32 +1880,43 @@
 ontainers(%22foo%22)
+.hashCode()
 , new Filters().
@@ -1928,27 +1928,38 @@
 ontainers(%22bar%22)
+.hashCode()
 );%0A    %7D%0A%7D%0A

Add missing hashcode tests