### Question:
Structure extends Variable { public static Builder<?> builder() { return new Builder2(); } protected  Structure(Builder<?> builder, Group parentGroup); @Nullable Variable findVariable(String shortName); int getNumberOfMemberVariables(); @Override int getElementSize(); ImmutableList<Variable> getVariables(); ImmutableList<String> getVariableNames(); boolean isSubset(); StructureMembers makeStructureMembers(); Structure select(List<String> memberNames); Structure select(String varName); @Deprecated StructureData readStructure(int index); @Deprecated ArrayStructure readStructure(int start, int count); @Deprecated StructureDataIterator getStructureIterator(); @Deprecated StructureDataIterator getStructureIterator(int bufferSize); String getNameAndAttributes(); @Override Builder<?> toBuilder(); static Builder<?> builder();  }### Answer:
@Test public void testBuilder() { Variable.Builder<?> var = Variable.builder().setName("member").setDataType(DataType.FLOAT); Structure struct = Structure.builder().setName("name").addMemberVariable(var) .addAttribute(new Attribute("att", "value")).build(makeDummyGroup()); assertThat(struct.getDataType()).isEqualTo(DataType.STRUCTURE); assertThat(struct.getShortName()).isEqualTo("name"); assertThat(struct.isScalar()).isTrue(); assertThat(struct.getVariableNames()).hasSize(1); assertThat(struct.getVariableNames().get(0)).isEqualTo("member"); assertThat(struct.getVariables()).hasSize(1); assertThat(struct.getVariables().get(0).getShortName()).isEqualTo("member"); assertThat(struct.getVariables().get(0).getDataType()).isEqualTo(DataType.FLOAT); assertThat(struct.getElementSize()).isEqualTo(4); assertThat(struct.isSubset()).isFalse(); assertThat(struct.getNameAndAttributes()).startsWith("Structure name"); assertThat(struct.toString()) .startsWith(String.format("%nStructure {%n" + " float member;%n" + "} name;%n" + ":att = \"value\";")); }
@Test public void testAddMembers() { Group.Builder parent = Group.builder(); Structure.Builder<?> structb = Structure.builder().setName("struct").setParentGroupBuilder(parent) .addMemberVariable("one", DataType.BYTE, "").addMemberVariable("two", DataType.CHAR, ""); Variable.Builder<?> two = Variable.builder().setName("two").setDataType(DataType.FLOAT); assertThat(structb.replaceMemberVariable(two)).isTrue(); assertThat(structb.removeMemberVariable("one")).isTrue(); assertThat(structb.removeMemberVariable("nope")).isFalse(); assertThat(structb.findMemberVariable("nope").isPresent()).isFalse(); assertThat(structb.findMemberVariable("one").isPresent()).isFalse(); assertThat(structb.findMemberVariable("two").isPresent()).isTrue(); Variable.Builder<?> vb = structb.findMemberVariable("two").orElse(null); assertThat(vb).isNotNull(); assertThat(vb.dataType).isEqualTo(DataType.FLOAT); }