예제 #1
0
  @Override
  public boolean equals(Object other) {
    if (other instanceof ArelNodeSqlLiteral) {
      return Objects.deepEquals(this.mValue, ((ArelNodeSqlLiteral) other).getValue());
    } else if (other instanceof String) {
      return Objects.deepEquals(this.mValue, String.valueOf(other));
    }

    return super.equals(other);
  }
예제 #2
0
 @Test
 public void UT_Solution_getter_must_return_set_values() throws Exception {
   float expectedValue[] = new float[] {2f, 134f, 2f};
   AbmConfigurationEntity solution = new AbmConfigurationEntity(expectedValue);
   assertTrue(
       "Should've get the set value", Objects.deepEquals(expectedValue, solution.getChromosome()));
 }
예제 #3
0
  private static int testDeepEquals() {
    int errors = 0;
    Object[] values = {
      null,
      null, // Change to values later
      new byte[] {(byte) 1},
      new short[] {(short) 1},
      new int[] {1},
      new long[] {1L},
      new char[] {(char) 1},
      new float[] {1.0f},
      new double[] {1.0d},
      new String[] {"one"}
    };
    values[1] = values;

    for (int i = 0; i < values.length; i++)
      for (int j = 0; j < values.length; j++) {
        boolean expected = (i == j);
        Object a = values[i];
        Object b = values[j];
        boolean result = Objects.deepEquals(a, b);
        if (result != expected) {
          errors++;
          System.err.printf(
              "When equating %s to %s, got %b instead of %b%n.", a, b, result, expected);
        }
      }

    return errors;
  }
 @Override
 public ComparisonResult apply(Object actual, Object expected) {
   return new ComparisonResult(actual, expected, this, Objects.deepEquals(actual, expected));
 }