### Question:
PersistOperationBuilder { public void commit() throws RrdException { if (m_declarations.size() == 0) { return; } try { final String ownerName = m_resource.getOwnerName(); final String absolutePath = getResourceDir(m_resource).getAbsolutePath(); RrdUtils.createRRD(ownerName, absolutePath, m_rrdName, getRepository().getStep(), getDataSources(), getRepository().getRraList(), getAttributeMappings()); RrdUtils.updateRRD(ownerName, absolutePath, m_rrdName, m_timeKeeper.getCurrentTime(), getValues()); RrdUtils.createMetaDataFile(absolutePath, m_rrdName, m_metaData); } catch (FileNotFoundException e) { LoggerFactory.getLogger(getClass()).warn("Could not get resource directory: " + e.getMessage(), e); return; } } PersistOperationBuilder(RrdRepository repository, ResourceIdentifier resource, String rrdName); RrdRepository getRepository(); void declareAttribute(AttributeDefinition attrType); void setAttributeValue(AttributeDefinition attrType, String value); void setAttributeMetadata(String metricIdentifier, String name); static String mapType(String objectType); void commit(); String getName(); TimeKeeper getTimeKeeper(); void setTimeKeeper(TimeKeeper timeKeeper); static final int MAX_DS_NAME_LENGTH; }### Answer:
@Test public void testCommitWithNoDeclaredAttributes() throws Exception { RrdRepository repository = createRrdRepository(); CollectionAgent agent = getCollectionAgent(); MockDataCollectionConfig dataCollectionConfig = new MockDataCollectionConfig(); OnmsSnmpCollection collection = new OnmsSnmpCollection(agent, new ServiceParameters(new HashMap<String, Object>()), dataCollectionConfig); NodeResourceType resourceType = new NodeResourceType(agent, collection); CollectionResource resource = new NodeInfo(resourceType, agent); PersistOperationBuilder builder = new PersistOperationBuilder(repository, resource, "rrdName"); builder.commit(); }