QuotaCounts { public QuotaCounts add(QuotaCounts that) { nsSsCounts = modify(nsSsCounts, ec -> ec.add(that.nsSsCounts)); tsCounts = modify(tsCounts, ec -> ec.add(that.tsCounts)); return this; } private  QuotaCounts(Builder builder); QuotaCounts add(QuotaCounts that); QuotaCounts subtract(QuotaCounts that); QuotaCounts negation(); long getNameSpace(); void setNameSpace(long nameSpaceCount); void addNameSpace(long nsDelta); long getStorageSpace(); void setStorageSpace(long spaceCount); void addStorageSpace(long dsDelta); EnumCounters<StorageType> getTypeSpaces(); void addTypeSpace(StorageType type, long delta); boolean anyNsSsCountGreaterOrEqual(long val); boolean anyTypeSpaceCountGreaterOrEqual(long val); @Override String toString(); @Override boolean equals(Object obj); @Override int hashCode();  }
@Test public void testAdd() throws Exception { QuotaCounts qc1 = new QuotaCounts.Builder().build(); QuotaCounts qc2 = new QuotaCounts.Builder().nameSpace(1).storageSpace(512) .typeSpaces(5).build(); qc1.add(qc2); assertEquals(1, qc1.getNameSpace()); assertEquals(512, qc1.getStorageSpace()); for (StorageType type : StorageType.values()) { assertEquals(5, qc1.getTypeSpace(type)); } }