@Test public void testFieldSchema() { final String fieldName = "field1"; final int fieldIndex = 3; final AbstractValueSchema fieldValueSchema = new StringValueSchema(false); final FieldSchema field = new FieldSchema(fieldName, fieldIndex, fieldValueSchema); assertThat(field.getFieldName()) .isEqualTo(fieldName); assertThat(field.getFieldIndex()) .isEqualTo(fieldIndex); assertThat(field.getValueSchema()) .isEqualTo(fieldValueSchema); assertThat(field) .isEqualTo(field) .isNotEqualTo(null) .isNotEqualTo(new FieldSchema("field2", fieldIndex, fieldValueSchema)) .isNotEqualTo(new FieldSchema(fieldName, 2, fieldValueSchema)) .isNotEqualTo(new FieldSchema(fieldName, fieldIndex, new NumericValueSchema(true))); assertThat(field.toString()) .contains(fieldName) .contains(String.valueOf(fieldIndex)) .contains(fieldValueSchema.toString()); assertThat(field.hashCode()) .isEqualTo(field.hashCode()) .isNotEqualTo(new FieldSchema("field2", fieldIndex, fieldValueSchema)); }
public FieldSchema(final String fieldName, final int fieldIndex, final AbstractValueSchema valueSchema) { Preconditions.checkArgument(fieldIndex >= 0, "field index should be non negative nor empty"); Preconditions.checkArgument(StringUtils.isNotBlank(fieldName), "field name should not be null nor empty"); Preconditions.checkNotNull(valueSchema, "valueSchema should not be null"); this.fieldIndex = fieldIndex; this.fieldName = fieldName; this.valueSchema = valueSchema; }
FieldSchema implements Serializable { public FieldSchema(final String fieldName, final int fieldIndex, final AbstractValueSchema valueSchema) { Preconditions.checkArgument(fieldIndex >= 0, "field index should be non negative nor empty"); Preconditions.checkArgument(StringUtils.isNotBlank(fieldName), "field name should not be null nor empty"); Preconditions.checkNotNull(valueSchema, "valueSchema should not be null"); this.fieldIndex = fieldIndex; this.fieldName = fieldName; this.valueSchema = valueSchema; } }
FieldSchema implements Serializable { public FieldSchema(final String fieldName, final int fieldIndex, final AbstractValueSchema valueSchema) { Preconditions.checkArgument(fieldIndex >= 0, "field index should be non negative nor empty"); Preconditions.checkArgument(StringUtils.isNotBlank(fieldName), "field name should not be null nor empty"); Preconditions.checkNotNull(valueSchema, "valueSchema should not be null"); this.fieldIndex = fieldIndex; this.fieldName = fieldName; this.valueSchema = valueSchema; } FieldSchema(final String fieldName,
                       final int fieldIndex,
                       final AbstractValueSchema valueSchema); }
FieldSchema implements Serializable { public FieldSchema(final String fieldName, final int fieldIndex, final AbstractValueSchema valueSchema) { Preconditions.checkArgument(fieldIndex >= 0, "field index should be non negative nor empty"); Preconditions.checkArgument(StringUtils.isNotBlank(fieldName), "field name should not be null nor empty"); Preconditions.checkNotNull(valueSchema, "valueSchema should not be null"); this.fieldIndex = fieldIndex; this.fieldName = fieldName; this.valueSchema = valueSchema; } FieldSchema(final String fieldName,
                       final int fieldIndex,
                       final AbstractValueSchema valueSchema); String getFieldName(); int getFieldIndex(); AbstractValueSchema getValueSchema(); @Override int hashCode(); @Override boolean equals(final Object obj); @Override final String toString(); }
FieldSchema implements Serializable { public FieldSchema(final String fieldName, final int fieldIndex, final AbstractValueSchema valueSchema) { Preconditions.checkArgument(fieldIndex >= 0, "field index should be non negative nor empty"); Preconditions.checkArgument(StringUtils.isNotBlank(fieldName), "field name should not be null nor empty"); Preconditions.checkNotNull(valueSchema, "valueSchema should not be null"); this.fieldIndex = fieldIndex; this.fieldName = fieldName; this.valueSchema = valueSchema; } FieldSchema(final String fieldName,
                       final int fieldIndex,
                       final AbstractValueSchema valueSchema); String getFieldName(); int getFieldIndex(); AbstractValueSchema getValueSchema(); @Override int hashCode(); @Override boolean equals(final Object obj); @Override final String toString();  }