@Test public void testSize() { final int numberFieldsSize = 10; final MockInstance instance = new MockInstance(numberFieldsSize, new Random()); IntStream.range(0, numberFieldsSize).forEach(idx -> assertThatCode(() -> instance.getValue(idx)) .as("The instance value for valid index") .doesNotThrowAnyException()); assertThatThrownBy(() -> instance.getValue(numberFieldsSize)) .as("The instance value for an index bigger than asked") .isInstanceOf(IndexOutOfBoundsException.class); }
@Override public double getValue(final int index) { return (double) this.values.get(index); }
MockInstance implements Instance, Serializable { @Override public double getValue(final int index) { return (double) this.values.get(index); } }
MockInstance implements Instance, Serializable { @Override public double getValue(final int index) { return (double) this.values.get(index); } MockInstance(final DatasetSchema schema, final Random random);  MockInstance(final int numberFieldsSize, final Random random);  MockInstance(final List<Serializable> values);  MockInstance(final double[] values); }
MockInstance implements Instance, Serializable { @Override public double getValue(final int index) { return (double) this.values.get(index); } MockInstance(final DatasetSchema schema, final Random random);  MockInstance(final int numberFieldsSize, final Random random);  MockInstance(final List<Serializable> values);  MockInstance(final double[] values); @Override int hashCode(); @Override boolean equals(final Object obj); @Override String toString(); @Override double getValue(final int index); @Override String getStringValue(final int index); }
MockInstance implements Instance, Serializable { @Override public double getValue(final int index) { return (double) this.values.get(index); } MockInstance(final DatasetSchema schema, final Random random);  MockInstance(final int numberFieldsSize, final Random random);  MockInstance(final List<Serializable> values);  MockInstance(final double[] values); @Override int hashCode(); @Override boolean equals(final Object obj); @Override String toString(); @Override double getValue(final int index); @Override String getStringValue(final int index);  }