DBaseFileAttributePool { @SuppressWarnings("resource") @Pure public Collection<String> getAllAttributeNames(int recordNumber) { try { final DBaseFileReader dbReader = getReader(); synchronized (dbReader) { final List<DBaseFileField> fields = dbReader.getDBFFields(); if (fields == null) { return Collections.emptyList(); } final ArrayList<String> titles = new ArrayList<>(fields.size()); for (int i = 0; i < fields.size(); ++i) { titles.add(fields.get(i).getName()); } return titles; } } catch (IOException exception) { return Collections.emptyList(); } } private  DBaseFileAttributePool(URL dbaseFile); @Pure static DBaseFileAttributeProvider getContainer(URL dbaseFile, int recordNumber); @Pure static DBaseFileAttributeProvider getProvider(URI dbaseFile, int recordNumber); @Pure static DBaseFileAttributeProvider getProvider(File dbaseFile, int recordNumber); @Pure static DBaseFileAttributeProvider getProvider(String resource, int recordNumber); @Pure static DBaseFileAttributeCollection getCollection(URL dbaseFile, int recordNumber); @Pure static DBaseFileAttributeCollection getCollection(URI dbaseFile, int recordNumber); @Pure static DBaseFileAttributeCollection getCollection(File dbaseFile, int recordNumber); @Pure static DBaseFileAttributeCollection getCollection(String resource, int recordNumber); void close(); @Override @SuppressWarnings("checkstyle:nofinalizer") @Deprecated(since = "17.0", forRemoval = true) void finalize(); @Pure URL getResource(); @SuppressWarnings("resource") @Pure Collection<String> getAllAttributeNames(int recordNumber); @SuppressWarnings("resource") @Pure int getAttributeCount(); @SuppressWarnings("resource") @Pure Object getRawValue(int recordNumber, String name, OutputParameter<AttributeType> type);  }
@Test public void testGetAllAttributeNames() { Collection<String> names = this.pool.getAllAttributeNames(2); assertNotNull(names); assertEquals(4, names.size()); Iterator<String> iterator = names.iterator(); assertTrue(iterator.hasNext()); assertEquals("SOURCE", iterator.next()); assertTrue(iterator.hasNext()); assertEquals("CATEGORIE", iterator.next()); assertTrue(iterator.hasNext()); assertEquals("NATURE", iterator.next()); assertTrue(iterator.hasNext()); assertEquals("HAUTEUR", iterator.next()); assertFalse(iterator.hasNext()); }