Changeset 611

Show
Ignore:
Timestamp:
27-03-12 15:51:34 (2 years ago)
Author:
david.vanenckevort@…
Message:

* Added tests for the ConceptServiceImpl?.deleteConcept() call.

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • trunk/code/conceptwiki/service/service-impl/src/test/java/nl/nbic/conceptwiki/service/ConceptServiceImplUnitTest.java

    r610 r611  
    88 
    99import com.google.common.collect.Iterables; 
    10 import com.google.common.collect.Lists; 
    1110import com.google.common.collect.Sets; 
    1211import java.util.ArrayList; 
     
    3130import nl.nbic.conceptwiki.storage.api.ConceptSearchService; 
    3231import nl.nbic.conceptwiki.storage.api.ConceptStorageService; 
     32import org.junit.Ignore; 
    3333 
    3434import org.junit.Test; 
     
    150150    } 
    151151 
     152    @Test 
     153    // TODO Enable when implementation is fixed. 
     154    @Ignore("Implementation doesn't support the history service yet.") 
     155    public void deleteConcept() { 
     156        when(mockStorageService.isExistingConcept(Mockito.anyString())).thenReturn(true); 
     157        final String uuid = UUID.randomUUID().toString(); 
     158         
     159        conceptService.deleteConcept(uuid, "Deletion of a valid concept.", DEFAULT_BRANCH); 
     160         
     161        Mockito.verify(mockStorageService).markAsDeleted(Mockito.eq(uuid), Mockito.anyString(), Mockito.anyInt()); 
     162        Mockito.verify(mockHistoryService).storeRevision(Mockito.eq(uuid), Mockito.any(Changeset.class)); 
     163    } 
     164     
     165    @Test(expected = IllegalArgumentException.class) 
     166    public void deleteNonExistantConcept() { 
     167        when(mockStorageService.isExistingConcept(Mockito.anyString())).thenReturn(false); 
     168        final String uuid = UUID.randomUUID().toString(); 
     169         
     170        conceptService.deleteConcept(uuid, "Deletion of a non-existant object.", DEFAULT_BRANCH); 
     171    } 
     172     
     173    @Test(expected = IllegalArgumentException.class) 
     174    public void deleteInvalidConcept() { 
     175        conceptService.deleteConcept("Invalid UUID", "Deletion of an invalid UUID", DEFAULT_BRANCH); 
     176    } 
    152177}