@Override protected List<Boolean> getBooleanListInternal(int columnIndex) { return values.get(columnIndex).getBoolArray(); }
@Test public void boolArrayFromList() { Value v = Value.boolArray(Arrays.asList(true, null, false)); assertThat(v.isNull()).isFalse(); assertThat(v.getBoolArray()).containsExactly(true, null, false).inOrder(); assertThat(v.toString()).isEqualTo("[true,NULL,false]"); }
@Test public void boolArrayRange() { Value v = Value.boolArray(new boolean[] {true, false, false, true, false}, 1, 3); assertThat(v.isNull()).isFalse(); assertThat(v.getBoolArray()).containsExactly(false, false, true).inOrder(); assertThat(v.toString()).isEqualTo("[false,false,true]"); }
@Test public void boolArray() { Value v = Value.boolArray(new boolean[] {true, false}); assertThat(v.isNull()).isFalse(); assertThat(v.getBoolArray()).containsExactly(true, false).inOrder(); assertThat(v.toString()).isEqualTo("[true,false]"); }
@Test public void boolArrayFromListNull() { Value v = Value.boolArray((Iterable<Boolean>) null); assertThat(v.isNull()).isTrue(); assertThat(v.toString()).isEqualTo(NULL_STRING); expectedException.expect(IllegalStateException.class); expectedException.expectMessage("null value"); v.getBoolArray(); }
@Test public void boolArrayNull() { Value v = Value.boolArray((boolean[]) null); assertThat(v.isNull()).isTrue(); assertThat(v.toString()).isEqualTo(NULL_STRING); expectedException.expect(IllegalStateException.class); expectedException.expectMessage("null value"); v.getBoolArray(); }
@Test public void boolArrayFromPlainIterable() { // Test to ensure that PrimitiveArrayFactory understands how to create an appropriate backing // arrays from various sizes of plain Iterable input. This test also covers the code paths // used by int64Array() and float64Array(). for (int i = 0; i < 50; ++i) { Boolean[] data = new Boolean[i]; for (int j = 0; j < data.length; ++j) { data[j] = (j % 3 == 2) ? null : ((j % 3) == 1); } String name = "boolArray() of length " + i; Value v = Value.boolArray(plainIterable(data)); assertThat(v.isNull()).named(name).isFalse(); assertThat(v.getBoolArray()).named(name).containsExactly((Object[]) data).inOrder(); } }
@Override protected List<Boolean> getBooleanListInternal(int columnIndex) { return values.get(columnIndex).getBoolArray(); }
return v.getBoolArray().size(); case INT64: return 8L * v.getInt64Array().size();