@Test public void getChannel_BadIndex() { final SystemSchema systemSchema = new SystemSchema( ValueUtil.randomInt(), ValueUtil.randomString(), new ChannelSchema[]{}, new EntitySchema[]{} ); final IllegalStateException exception = expectThrows( IllegalStateException.class, () -> systemSchema.getChannel( 2 ) ); assertEquals( exception.getMessage(), "Replicant-0058: SystemSchema.getChannel(id) passed an id that is out of range." ); }
@Nonnull public ChannelSchema getChannel( final int channelId ) { if ( Replicant.shouldCheckApiInvariants() ) { apiInvariant( () -> channelId >= 0 && channelId < _channels.length, () -> "Replicant-0058: SystemSchema.getChannel(id) passed an id that is out of range." ); } return _channels[ channelId ]; }
SystemSchema { @Nonnull public ChannelSchema getChannel( final int channelId ) { if ( Replicant.shouldCheckApiInvariants() ) { apiInvariant( () -> channelId >= 0 && channelId < _channels.length, () -> "Replicant-0058: SystemSchema.getChannel(id) passed an id that is out of range." ); } return _channels[ channelId ]; } }
SystemSchema { @Nonnull public ChannelSchema getChannel( final int channelId ) { if ( Replicant.shouldCheckApiInvariants() ) { apiInvariant( () -> channelId >= 0 && channelId < _channels.length, () -> "Replicant-0058: SystemSchema.getChannel(id) passed an id that is out of range." ); } return _channels[ channelId ]; } SystemSchema( final int id,
                       @Nullable final String name,
                       @Nonnull final ChannelSchema[] channels,
                       @Nonnull final EntitySchema[] entities ); }
SystemSchema { @Nonnull public ChannelSchema getChannel( final int channelId ) { if ( Replicant.shouldCheckApiInvariants() ) { apiInvariant( () -> channelId >= 0 && channelId < _channels.length, () -> "Replicant-0058: SystemSchema.getChannel(id) passed an id that is out of range." ); } return _channels[ channelId ]; } 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 ChannelSchema getChannel( final int channelId ) { if ( Replicant.shouldCheckApiInvariants() ) { apiInvariant( () -> channelId >= 0 && channelId < _channels.length, () -> "Replicant-0058: SystemSchema.getChannel(id) passed an id that is out of range." ); } return _channels[ channelId ]; } 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();  }