QuotaCounts { void setTypeSpaces(EnumCounters<StorageType> that) { if (that == STORAGE_TYPE_DEFAULT || that == STORAGE_TYPE_RESET) { tsCounts = that; } else if (that != null) { tsCounts = modify(tsCounts, ec -> ec.set(that)); } } 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 testSetTypeSpaces() throws Exception { QuotaCounts qc1 = new QuotaCounts.Builder().build(); QuotaCounts qc2 = new QuotaCounts.Builder().nameSpace(1).storageSpace(512) .typeSpaces(5).build(); qc1.setTypeSpaces(qc2.getTypeSpaces()); for (StorageType t : StorageType.values()) { assertEquals(qc2.getTypeSpace(t), qc1.getTypeSpace(t)); } qc1.setTypeSpaces(QuotaCounts.STORAGE_TYPE_RESET); assertSame(QuotaCounts.STORAGE_TYPE_RESET, qc1.tsCounts); }