@Test public void getEntity_BadIndex() { final SystemSchema systemSchema = new SystemSchema( ValueUtil.randomInt(), ValueUtil.randomString(), new ChannelSchema[]{}, new EntitySchema[]{} ); final IllegalStateException exception = expectThrows( IllegalStateException.class, () -> systemSchema.getEntity( 2 ) ); assertEquals( exception.getMessage(), "Replicant-0057: SystemSchema.getEntity(id) passed an id that is out of range." ); }
@Nonnull public EntitySchema getEntity( final int typeId ) { if ( Replicant.shouldCheckApiInvariants() ) { apiInvariant( () -> typeId >= 0 && typeId < _entities.length, () -> "Replicant-0057: SystemSchema.getEntity(id) passed an id that is out of range." ); } return _entities[ typeId ]; }
SystemSchema { @Nonnull public EntitySchema getEntity( final int typeId ) { if ( Replicant.shouldCheckApiInvariants() ) { apiInvariant( () -> typeId >= 0 && typeId < _entities.length, () -> "Replicant-0057: SystemSchema.getEntity(id) passed an id that is out of range." ); } return _entities[ typeId ]; } }
SystemSchema { @Nonnull public EntitySchema getEntity( final int typeId ) { if ( Replicant.shouldCheckApiInvariants() ) { apiInvariant( () -> typeId >= 0 && typeId < _entities.length, () -> "Replicant-0057: SystemSchema.getEntity(id) passed an id that is out of range." ); } return _entities[ typeId ]; } SystemSchema( final int id,
                       @Nullable final String name,
                       @Nonnull final ChannelSchema[] channels,
                       @Nonnull final EntitySchema[] entities ); }
SystemSchema { @Nonnull public EntitySchema getEntity( final int typeId ) { if ( Replicant.shouldCheckApiInvariants() ) { apiInvariant( () -> typeId >= 0 && typeId < _entities.length, () -> "Replicant-0057: SystemSchema.getEntity(id) passed an id that is out of range." ); } return _entities[ typeId ]; } SystemSchema( final int id,
                       @Nullable final String name,
                       @Nonnull final ChannelSchema[] channels,
                       @Nonnull final EntitySchema[] entities ); int getId(); @Nonnull String getName(); int getEntityCount(); @Nonnull EntitySchema getEntity( final int typeId ); int getChannelCount(); @Nonnull ChannelSchema getChannel( final int channelId ); @Override String toString(); }
SystemSchema { @Nonnull public EntitySchema getEntity( final int typeId ) { if ( Replicant.shouldCheckApiInvariants() ) { apiInvariant( () -> typeId >= 0 && typeId < _entities.length, () -> "Replicant-0057: SystemSchema.getEntity(id) passed an id that is out of range." ); } return _entities[ typeId ]; } SystemSchema( final int id,
                       @Nullable final String name,
                       @Nonnull final ChannelSchema[] channels,
                       @Nonnull final EntitySchema[] entities ); int getId(); @Nonnull String getName(); int getEntityCount(); @Nonnull EntitySchema getEntity( final int typeId ); int getChannelCount(); @Nonnull ChannelSchema getChannel( final int channelId ); @Override String toString();  }