@Test public void testEquals() { UUID uuid = UUID.randomUUID(); new EqualsTester() .addEqualityGroup(Atom.string("string"), new Atom<>("string")) .addEqualityGroup(Atom.integer(42), new Atom<>(42L)) .addEqualityGroup(Atom.real(4.2), new Atom<>(4.2)) .addEqualityGroup(Atom.bool(true), new Atom<>(true)) .addEqualityGroup(Atom.uuid(Uuid.of(uuid)), Atom.uuid(uuid), new Atom<>(new Uuid(uuid))) .addEqualityGroup( Atom.namedUuid("named-uuid"), Atom.namedUuid(new NamedUuid("named-uuid")), new Atom<>(new NamedUuid("named-uuid")) ) .testEquals(); }
@Override public boolean equals(Object other) { if (this == other) { return true; } if (!(other instanceof Atom)) { return false; } Atom<?> atom = (Atom<?>) other; return Objects.equals(value, atom.getValue()); }
Atom extends Value { @Override public boolean equals(Object other) { if (this == other) { return true; } if (!(other instanceof Atom)) { return false; } Atom<?> atom = (Atom<?>) other; return Objects.equals(value, atom.getValue()); } }
Atom extends Value { @Override public boolean equals(Object other) { if (this == other) { return true; } if (!(other instanceof Atom)) { return false; } Atom<?> atom = (Atom<?>) other; return Objects.equals(value, atom.getValue()); } Atom(T value); }
Atom extends Value { @Override public boolean equals(Object other) { if (this == other) { return true; } if (!(other instanceof Atom)) { return false; } Atom<?> atom = (Atom<?>) other; return Objects.equals(value, atom.getValue()); } Atom(T value); static Atom<String> string(String value); static Atom<Long> integer(long value); static Atom<Double> real(Double value); static Atom<Boolean> bool(boolean value); static Atom<Uuid> uuid(Uuid value); static Atom<Uuid> uuid(UUID value); static Atom<NamedUuid> namedUuid(NamedUuid value); static Atom<NamedUuid> namedUuid(String value); T getValue(); @Override boolean equals(Object other); @Override int hashCode(); @Override String toString(); }
Atom extends Value { @Override public boolean equals(Object other) { if (this == other) { return true; } if (!(other instanceof Atom)) { return false; } Atom<?> atom = (Atom<?>) other; return Objects.equals(value, atom.getValue()); } Atom(T value); static Atom<String> string(String value); static Atom<Long> integer(long value); static Atom<Double> real(Double value); static Atom<Boolean> bool(boolean value); static Atom<Uuid> uuid(Uuid value); static Atom<Uuid> uuid(UUID value); static Atom<NamedUuid> namedUuid(NamedUuid value); static Atom<NamedUuid> namedUuid(String value); T getValue(); @Override boolean equals(Object other); @Override int hashCode(); @Override String toString();  }