package com.basho.riak.client.core.query.timeseries;


import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.core.type.TypeReference;
import org.junit.Test;

import java.util.Arrays;
import java.util.HashSet;
import java.util.Set;

import static junit.framework.Assert.assertTrue;

public class SetCellTest
{
    @Test
    public void TestStringSet()
    {
        HashSet<String> set = new HashSet<String>(Arrays.asList("foo", "bar", "baz"));
        SetCell<String> setCell = SetCell.fromSet(set, new TypeReference<String>() {});

        assertTrue(setCell.hasSet());

        Set<String> set1 = SetCell.getSet(setCell, new TypeReference<String>() {});

        assertTrue(set.contains("foo"));
        assertTrue(set.contains("bar"));
        assertTrue(set.contains("baz"));
    }

    @Test
    public void TestPojoSet()
    {
        Pojo p1 = new Pojo();
        p1.value = "foo";
        Pojo p2 = new Pojo();
        p2.value = "bar";
        Pojo p3 = new Pojo();
        p3.value = "baz";
        HashSet<Pojo> set = new HashSet<Pojo>(Arrays.asList(p1, p2, p3));

        SetCell<Pojo> setCell = SetCell.fromSet(set, new TypeReference<Pojo>() {});

        assertTrue(setCell.hasSet());

        Set<Pojo> set1 = SetCell.getSet(setCell, new TypeReference<Pojo>() {});

        assertTrue(set.contains(p1));
        assertTrue(set.contains(p2));
        assertTrue(set.contains(p3));
    }
}

class Pojo
{
    public String value;
}

@@ -1370,32 +1370,33 @@
   assertTrue(set
+1
 .contains(p1));%0A
@@ -1409,32 +1409,33 @@
   assertTrue(set
+1
 .contains(p2));%0A
@@ -1448,32 +1448,33 @@
   assertTrue(set
+1
 .contains(p3));%0A
@@ -1519,11 +1519,462 @@
 g value;
+%0A%0A    @Override%0A    public boolean equals(Object o)%0A    %7B%0A        if (this == o)%0A        %7B%0A            return true;%0A        %7D%0A        if (o == null %7C%7C getClass() != o.getClass())%0A        %7B%0A            return false;%0A        %7D%0A%0A        Pojo pojo = (Pojo) o;%0A%0A        return !(value != null ? !value.equals(pojo.value) : pojo.value != null);%0A%0A    %7D%0A%0A    @Override%0A    public int hashCode()%0A    %7B%0A        return value != null ? value.hashCode() : 0;%0A    %7D
 %0A%7D%0A

Fix test equality