@Test public void toStringTest() { final EntityService entityService = Replicant.context().getEntityService(); final Class<A> type = A.class; final int id = 123; final String name = "A/123"; final Entity entity = safeAction( () -> entityService.findOrCreateEntity( name, type, id ) ); assertEquals( entity.toString(), name ); ReplicantTestUtil.disableNames(); assertEquals( entity.toString(), entity.getClass().getName() + "@" + Integer.toHexString( entity.hashCode() ) ); }
@Override public String toString() { if ( Replicant.areNamesEnabled() ) { return getName(); } else { return super.toString(); } }
Entity extends ReplicantService { @Override public String toString() { if ( Replicant.areNamesEnabled() ) { return getName(); } else { return super.toString(); } } }
Entity extends ReplicantService { @Override public String toString() { if ( Replicant.areNamesEnabled() ) { return getName(); } else { return super.toString(); } } Entity( @Nullable final ReplicantContext context,
          @Nullable final String name,
          @Nonnull final Class<?> type,
          final int id ); }
Entity extends ReplicantService { @Override public String toString() { if ( Replicant.areNamesEnabled() ) { return getName(); } else { return super.toString(); } } Entity( @Nullable final ReplicantContext context,
          @Nullable final String name,
          @Nonnull final Class<?> type,
          final int id ); @Nonnull String getName(); @Nonnull Class<?> getType(); int getId(); @Nonnull Object getUserObject(); @Observable( name = "userObject" ) @Nullable Object maybeUserObject(); @Nonnull @Observable( expectSetter = false ) Collection<Subscription> getSubscriptions(); @Override String toString(); }
Entity extends ReplicantService { @Override public String toString() { if ( Replicant.areNamesEnabled() ) { return getName(); } else { return super.toString(); } } Entity( @Nullable final ReplicantContext context,
          @Nullable final String name,
          @Nonnull final Class<?> type,
          final int id ); @Nonnull String getName(); @Nonnull Class<?> getType(); int getId(); @Nonnull Object getUserObject(); @Observable( name = "userObject" ) @Nullable Object maybeUserObject(); @Nonnull @Observable( expectSetter = false ) Collection<Subscription> getSubscriptions(); @Override String toString();  }