@Test public void testEquals() { List<Condition> conditions = Stream.of( new Condition("string_column", Function.INCLUDES, Atom.string("A string")), new Condition("integer_column", Function.LESS_THAN, Atom.integer(42)), new Condition("bool_column", Function.EQUALS, Atom.bool(true)), new Condition("uuid_column", Function.NOT_EQUALS, Atom.uuid(uuid)), new Condition("named-uuid_column", Function.EXCLUDES, Atom.namedUuid("uuid-name")), new Condition("map_column", Function.GREATER_THAN_OR_EQUALS, new Map<>(ImmutableList.of(new Pair<>(Atom.string("key"), Atom.string("value")))) ), new Condition("set_column", Function.LESS_THAN_OR_EQUALS, new Set(ImmutableSet.of(Atom.string("value1"), Atom.string("value2"))) ) ).collect(Collectors.toList()); new EqualsTester() .addEqualityGroup( new Select(tableName, conditions, null), new Select(tableName, conditions) ) .addEqualityGroup( select, new Select(tableName, conditions, ImmutableList.of("column1", "column2")) ) .testEquals(); }
@Override public boolean equals(Object other) { if (this == other) { return true; } if (!(other instanceof Select)) { return false; } Select that = (Select) other; return Objects.equals(table, that.getTable()) && Objects.equals(conditions, that.getWhere()) && Objects.equals(columns, that.getColumns()); }
Select extends Operation { @Override public boolean equals(Object other) { if (this == other) { return true; } if (!(other instanceof Select)) { return false; } Select that = (Select) other; return Objects.equals(table, that.getTable()) && Objects.equals(conditions, that.getWhere()) && Objects.equals(columns, that.getColumns()); } }
Select extends Operation { @Override public boolean equals(Object other) { if (this == other) { return true; } if (!(other instanceof Select)) { return false; } Select that = (Select) other; return Objects.equals(table, that.getTable()) && Objects.equals(conditions, that.getWhere()) && Objects.equals(columns, that.getColumns()); } Select(String table);  Select(String table, List<Condition> conditions); @JsonCreator  Select(
      @JsonProperty(value = "table", required = true) String table,
      @JsonProperty(value = "conditions", required = true) List<Condition> conditions,
      @JsonProperty(value = "columns") List<String> columns
  ); }
Select extends Operation { @Override public boolean equals(Object other) { if (this == other) { return true; } if (!(other instanceof Select)) { return false; } Select that = (Select) other; return Objects.equals(table, that.getTable()) && Objects.equals(conditions, that.getWhere()) && Objects.equals(columns, that.getColumns()); } Select(String table);  Select(String table, List<Condition> conditions); @JsonCreator  Select(
      @JsonProperty(value = "table", required = true) String table,
      @JsonProperty(value = "conditions", required = true) List<Condition> conditions,
      @JsonProperty(value = "columns") List<String> columns
  ); Select where(String column, Function function, Value value); Select where(String column, Function function, String string); Select where(String column, Function function, long integer); Select where(String column, Function function, boolean bool); Select where(String column, Function function, Uuid uuid); Select where(String column, Function function, NamedUuid namedUuid); Select where(
      String column, Function function, java.util.Map<K, V> map
  ); Select where(
      String column, Function function, java.util.Set<T> set
  ); Select columns(String... column); String getTable(); List<Condition> getWhere(); List<String> getColumns(); @Override boolean equals(Object other); @Override int hashCode(); @Override String toString(); }
Select extends Operation { @Override public boolean equals(Object other) { if (this == other) { return true; } if (!(other instanceof Select)) { return false; } Select that = (Select) other; return Objects.equals(table, that.getTable()) && Objects.equals(conditions, that.getWhere()) && Objects.equals(columns, that.getColumns()); } Select(String table);  Select(String table, List<Condition> conditions); @JsonCreator  Select(
      @JsonProperty(value = "table", required = true) String table,
      @JsonProperty(value = "conditions", required = true) List<Condition> conditions,
      @JsonProperty(value = "columns") List<String> columns
  ); Select where(String column, Function function, Value value); Select where(String column, Function function, String string); Select where(String column, Function function, long integer); Select where(String column, Function function, boolean bool); Select where(String column, Function function, Uuid uuid); Select where(String column, Function function, NamedUuid namedUuid); Select where(
      String column, Function function, java.util.Map<K, V> map
  ); Select where(
      String column, Function function, java.util.Set<T> set
  ); Select columns(String... column); String getTable(); List<Condition> getWhere(); List<String> getColumns(); @Override boolean equals(Object other); @Override int hashCode(); @Override String toString();  }