public Capacity getCapacityWithDefault(String group, String tenant) {
        Capacity capacity;
        boolean isTenant = StringUtils.isNotBlank(tenant);
        if (isTenant) {
            capacity = getTenantCapacity(tenant);
        } else {
            capacity = getGroupCapacity(group);
        }
        if (capacity == null) {
            return null;
        }
        Integer quota = capacity.getQuota();
        if (quota == 0) {
            if (isTenant) {
                capacity.setQuota(PropertyUtil.getDefaultTenantQuota());
            } else {
                if (GroupCapacityPersistService.CLUSTER.equals(group)) {
                    capacity.setQuota(PropertyUtil.getDefaultClusterQuota());
                } else {
                    capacity.setQuota(PropertyUtil.getDefaultGroupQuota());
                }
            }
        }
        Integer maxSize = capacity.getMaxSize();
        if (maxSize == 0) {
            capacity.setMaxSize(PropertyUtil.getDefaultMaxSize());
        }
        Integer maxAggrCount = capacity.getMaxAggrCount();
        if (maxAggrCount == 0) {
            capacity.setMaxAggrCount(PropertyUtil.getDefaultMaxAggrCount());
        }
        Integer maxAggrSize = capacity.getMaxAggrSize();
        if (maxAggrSize == 0) {
            capacity.setMaxAggrSize(PropertyUtil.getDefaultMaxAggrSize());
        }
        return capacity;
    }
@Test
    void testGetCapacityWithDefault() {
        TenantCapacity tenantCapacity = new TenantCapacity();
        tenantCapacity.setQuota(0);
        tenantCapacity.setMaxSize(0);
        tenantCapacity.setMaxAggrCount(0);
        tenantCapacity.setMaxAggrSize(0);
        when(tenantCapacityPersistService.getTenantCapacity(anyString())).thenReturn(tenantCapacity);
        
        GroupCapacity groupCapacity1 = new GroupCapacity();
        groupCapacity1.setQuota(0);
        groupCapacity1.setMaxSize(0);
        groupCapacity1.setMaxAggrCount(0);
        groupCapacity1.setMaxAggrSize(0);
        when(groupCapacityPersistService.getGroupCapacity(anyString())).thenReturn(groupCapacity1);
        
        //group is null
        Capacity resCapacity1 = service.getCapacityWithDefault(null, "testTenant");
        assertEquals(PropertyUtil.getDefaultGroupQuota(), resCapacity1.getQuota().intValue());
        assertEquals(PropertyUtil.getDefaultMaxSize(), resCapacity1.getMaxSize().intValue());
        assertEquals(PropertyUtil.getDefaultMaxAggrCount(), resCapacity1.getMaxAggrCount().intValue());
        assertEquals(PropertyUtil.getDefaultMaxAggrSize(), resCapacity1.getMaxAggrSize().intValue());
        
        //group is GroupCapacityPersistService.CLUSTER
        Capacity resCapacity2 = service.getCapacityWithDefault(GroupCapacityPersistService.CLUSTER, null);
        assertEquals(PropertyUtil.getDefaultClusterQuota(), resCapacity2.getQuota().intValue());
        assertEquals(PropertyUtil.getDefaultMaxSize(), resCapacity2.getMaxSize().intValue());
        assertEquals(PropertyUtil.getDefaultMaxAggrCount(), resCapacity2.getMaxAggrCount().intValue());
        assertEquals(PropertyUtil.getDefaultMaxAggrSize(), resCapacity2.getMaxAggrSize().intValue());
        
        GroupCapacity groupCapacity2 = new GroupCapacity();
        groupCapacity2.setQuota(0);
        groupCapacity2.setMaxSize(0);
        groupCapacity2.setMaxAggrCount(0);
        groupCapacity2.setMaxAggrSize(0);
        when(groupCapacityPersistService.getGroupCapacity(anyString())).thenReturn(groupCapacity2);
        
        //tenant is null
        Capacity resCapacity3 = service.getCapacityWithDefault("testGroup", null);
        assertEquals(PropertyUtil.getDefaultGroupQuota(), resCapacity3.getQuota().intValue());
        assertEquals(PropertyUtil.getDefaultMaxSize(), resCapacity3.getMaxSize().intValue());
        assertEquals(PropertyUtil.getDefaultMaxAggrCount(), resCapacity3.getMaxAggrCount().intValue());
        assertEquals(PropertyUtil.getDefaultMaxAggrSize(), resCapacity3.getMaxAggrSize().intValue());
    }