package au.com.dius.pactconsumer.data.model;

import android.support.annotation.NonNull;
import android.support.annotation.Nullable;

import com.squareup.moshi.Json;

import org.joda.time.DateTime;

import java.util.List;

public class ServiceResponse {

  @Json(name = "date")
  private final DateTime validDate;

  @Json(name = "data")
  private final List<Animal> animals;

  public ServiceResponse(@Nullable DateTime validDate,
                         @NonNull List<Animal> animals) {
    this.validDate = validDate;
    this.animals = animals;
  }

  @Nullable
  public DateTime getValidDate() {
    return validDate;
  }

  @NonNull
  public List<Animal> getAnimals() {
    return animals;
  }

  @Override
  public boolean equals(Object o) {
    if (this == o) return true;
    if (o == null || getClass() != o.getClass()) return false;

    ServiceResponse that = (ServiceResponse) o;

    if (validDate != null ? !(validDate.getMillis() == validDate.getMillis()) : that.validDate != null)
      return false;
    return animals != null ? animals.equals(that.animals) : that.animals == null;

  }

  @Override
  public int hashCode() {
    int result = validDate != null ? validDate.hashCode() : 0;
    result = 31 * result + (animals != null ? animals.hashCode() : 0);
    return result;
  }

  @Override
  public String toString() {
    return "ServiceResponse{" +
        "validDate=" + validDate +
        ", animals=" + animals +
        '}';
  }

  public static ServiceResponse create(@NonNull DateTime validDate, @NonNull List<Animal> animals) {
    return new ServiceResponse(validDate, animals);
  }
}

@@ -892,20 +892,30 @@
 o;%0A%0A    
-if (
+long millis = 
 validDat
@@ -930,10 +930,8 @@
 l ? 
-!(
 vali
@@ -948,19 +948,74 @@
 illis() 
-== 
+: -1;%0A    long thatMillis = that.validDate != null ? that.
 validDat
@@ -1031,34 +1031,43 @@
 is()
-)
  : 
-that.validDate != null
+-1;%0A    if (millis != thatMillis
 )%0A  
@@ -1084,16 +1084,21 @@
  false;%0A
+    %0A
     retu

fix date comparison