### Question:
AbstractTree implements Tree<E> { @Override public synchronized int insert(final E object) throws IllegalArgumentException , StoreIndexException{ try { ArgumentChecks.ensureNonNull("insert : object", object); final Envelope env = treeEltMap.getEnvelope(object); if (!Utilities.equalsIgnoreMetadata(crs, env.getCoordinateReferenceSystem())) throw new IllegalArgumentException("During insertion element should have same CoordinateReferenceSystem as Tree."); final double[] coordinates = TreeUtilities.getCoords(env); for (double d : coordinates) if (Double.isNaN(d)) throw new IllegalArgumentException("coordinates contain at least one NAN value"); treeEltMap.setTreeIdentifier(object, treeIdentifier); insert(treeIdentifier, coordinates); treeIdentifier++; return treeIdentifier - 1; } catch (IOException ex) { throw new StoreIndexException(ex); } } protected  AbstractTree(final TreeAccess treeAccess, final CoordinateReferenceSystem crs, final TreeElementMapper<E> treeEltMap); @Override synchronized int[] searchID(final Envelope regionSearch); @Override TreeIdentifierIterator search(final Envelope regionSearch); @Override synchronized int insert(final E object); void insert(final int identifier, final double... coordinates); @Override synchronized boolean remove(final E object); boolean remove(final int entry, Envelope entryEnvelope); @Override int getMaxElements(); @Override Node getRoot(); @Override void setRoot(final Node root); @Override CoordinateReferenceSystem getCrs(); @Override synchronized void clear(); @Override int getElementsNumber(); void setElementsNumber(final int value); @Override TreeElementMapper getTreeElementMapper(); @Override void close(); @Override synchronized void flush(); @Override boolean isClosed(); @Override double[] getExtent(); @Override String toString();  }### Answer:
@Test public void insertTest() throws StoreIndexException, IOException { tree.setRoot(null); insert(); final double[] gr = tree.getRoot().getBoundary(); final double[] envSearch = gr.clone(); final GeneralEnvelope rG = new GeneralEnvelope(crs); rG.setEnvelope(gr); int[] tabSearch = tree.searchID(rG); final TreeIdentifierIterator triter = tree.search(rG); final int[] tabIterSearch = new int[tabSearch.length]; int tabID = 0; while (triter.hasNext()) { tabIterSearch[tabID++] = triter.nextInt(); } assertTrue("comparison between tabSearch from iterator not equals with tabSearch", compareID(tabSearch, tabIterSearch)); assertTrue(tabSearch.length == lData.size()); assertTrue(tree.getElementsNumber() == lData.size()); try { final double[] ge = new double[]{ Double.NaN, 10, 5, Double.NaN}; tree.insert(ge); Assert.fail("test should have fail"); } catch (Exception ex) { assertTrue(ex instanceof IllegalArgumentException); } }