コード例 #1
0
 @Test
 public void testUpdateSameQuotaWithoutChangingName() throws Exception {
   List<String> messages = new ArrayList<String>();
   Quota mockQuota = mockGeneralStorageQuota();
   when(quotaDAO.getQuotaByQuotaName(quotaName)).thenReturn(mockQuota);
   boolean isQuotaValid = quotaHelper.checkQuotaNameExisting(mockQuota, messages);
   assertTrue(isQuotaValid);
 }
コード例 #2
0
 @Test
 public void testQuotaWithSameNameExists() throws Exception {
   List<String> messages = new ArrayList<String>();
   Quota mockQuota = mockGeneralStorageQuota();
   when(quotaDAO.getQuotaByQuotaName(quotaName)).thenReturn(mockQuota);
   Quota sameMockedQuotaWithDifferentId = mockGeneralStorageQuota();
   boolean isQuotaValid =
       quotaHelper.checkQuotaNameExisting(sameMockedQuotaWithDifferentId, messages);
   assertTrue(
       messages.contains(VdcBllMessages.ACTION_TYPE_FAILED_QUOTA_NAME_ALREADY_EXISTS.toString()));
   assertFalse(isQuotaValid);
 }