### Question:
NetcdfFile implements FileCacheable, Closeable { public static Builder<?> builder() { return new Builder2(); } protected  NetcdfFile(Builder<?> builder); @Deprecated static void setDebugFlags(DebugFlags debugFlag); synchronized void close(); @Nullable Attribute findAttribute(String fullNameEscaped); @Nullable Dimension findDimension(String fullName); @Nullable Attribute findGlobalAttribute(String attName); @Nullable Attribute findGlobalAttributeIgnoreCase(String name); @Nullable Group findGroup(@Nullable String fullName); @Nullable Variable findVariable(String fullNameEscaped); ImmutableList<Dimension> getDimensions(); String getFileTypeId(); String getFileTypeDescription(); String getFileTypeVersion(); ImmutableList<Attribute> getGlobalAttributes(); String getLocation(); @Nullable String getId(); Group getRootGroup(); @Nullable String getTitle(); ImmutableList<Variable> getVariables(); @Nullable Dimension getUnlimitedDimension(); boolean hasUnlimitedDimension(); Array readSection(String variableSection); Object sendIospMessage(Object message); @Override String toString(); String toNcml(String url); void writeNcml(OutputStream os, String uri); void writeNcml(Writer writer, String uri); @Deprecated @Override long getLastModified(); @Deprecated void release(); @Deprecated void reacquire(); @Deprecated synchronized void setFileCache(FileCacheIF cache); @Deprecated String getDetailInfo(); @Deprecated void getDetailInfo(Formatter f); Builder<?> toBuilder(); static Builder<?> builder(); @Deprecated
  static final String IOSP_MESSAGE_ADD_RECORD_STRUCTURE; static final String IOSP_MESSAGE_RANDOM_ACCESS_FILE; static final String IOSP_MESSAGE_GET_IOSP; static final String IOSP_MESSAGE_GET_NETCDF_FILE_FORMAT; }### Answer:
@Test public void testBuilder() { Attribute att = new Attribute("attName", "value"); Dimension dim = new Dimension("dimName", 42); Group.Builder nested = Group.builder().setName("child"); Variable.Builder<?> vb = Variable.builder().setName("varName").setDataType(DataType.STRING); Group.Builder groupb = Group.builder().setName("").addAttribute(att).addDimension(dim).addGroup(nested).addVariable(vb); NetcdfFile.Builder<?> builder = NetcdfFile.builder().setId("Hid").setLocation("location").setRootGroup(groupb).setTitle("title"); NetcdfFile ncfile = builder.build(); assertThat(ncfile.getId()).isEqualTo("Hid"); assertThat(ncfile.getLocation()).isEqualTo("location"); assertThat(ncfile.getTitle()).isEqualTo("title"); Group group = ncfile.getRootGroup(); assertThat(group.getNetcdfFile()).isEqualTo(ncfile); assertThat(group.getShortName()).isEqualTo(""); assertThat(group.isRoot()).isTrue(); assertThat(group.attributes()).isNotEmpty(); assertThat(group.attributes()).hasSize(1); assertThat(group.findAttribute("attName")).isEqualTo(att); assertThat(group.findAttributeString("attName", null)).isEqualTo("value"); assertThat(group.getDimensions()).isNotEmpty(); assertThat(group.getDimensions()).hasSize(1); assertThat(group.findDimension("dimName").isPresent()).isTrue(); assertThat(group.findDimension("dimName").get()).isEqualTo(dim); assertThat(group.getGroups()).isNotEmpty(); assertThat(group.getGroups()).hasSize(1); Group child = group.findGroupLocal("child"); assertThat(child.getParentGroup()).isEqualTo(group); assertThat(group.getVariables()).isNotEmpty(); assertThat(group.getVariables()).hasSize(1); Variable v = group.findVariableLocal("varName"); assertThat(v.getParentGroup()).isEqualTo(group); assertThat(v.getNetcdfFile()).isEqualTo(ncfile); }