TSK-80: make GetClassificationAccTest run

This commit is contained in:
BVier 2018-01-10 11:26:55 +01:00 committed by Holger Hagen
parent 7878eb3f50
commit 679346cfe2
3 changed files with 11 additions and 4 deletions

View File

@ -267,7 +267,10 @@ public class ClassificationServiceImpl implements ClassificationService {
taskanaEngineImpl.openConnection();
result = classificationMapper.findByKeyAndDomain(key, domain, CURRENT_CLASSIFICATIONS_VALID_UNTIL);
if (result == null) {
throw new ClassificationNotFoundException(key);
result = classificationMapper.findByKeyAndDomain(key, "", CURRENT_CLASSIFICATIONS_VALID_UNTIL);
if (result == null) {
throw new ClassificationNotFoundException(key);
}
}
return result;
} finally {

View File

@ -6,7 +6,6 @@ import java.util.List;
import org.h2.store.fs.FileUtils;
import org.junit.AfterClass;
import org.junit.Assert;
import org.junit.Ignore;
import org.junit.Test;
import acceptance.AbstractAccTest;
@ -39,7 +38,6 @@ public class GetClassificationAccTest extends AbstractAccTest {
Assert.assertNotNull(classification);
}
@Ignore
@Test
public void testGetOneClassificationForDomainAndGetClassificationFromRootDomain()
throws SQLException, ClassificationNotFoundException {

View File

@ -143,7 +143,7 @@ public class ClassificationServiceImplTest {
verify(taskanaEngineImplMock, times(2)).openConnection();
verify(classificationMapperMock, times(1)).findByKeyAndDomain(key, domain, validUntil);
verify(classificationMapperMock, times(1)).findByKeyAndDomain(key, "", validUntil);
verify(classificationMapperMock, times(2)).findByKeyAndDomain(key, "", validUntil);
verify(classificationMapperMock, times(2)).insert(any());
verify(taskanaEngineImplMock, times(2)).returnConnection();
verifyNoMoreInteractions(classificationMapperMock, taskanaEngineImplMock, classificationQueryImplMock);
@ -259,6 +259,9 @@ public class ClassificationServiceImplTest {
doReturn(null).when(classificationMapperMock).findByKeyAndDomain(classification.getKey(),
classification.getDomain(),
ClassificationServiceImpl.CURRENT_CLASSIFICATIONS_VALID_UNTIL);
doReturn(null).when(classificationMapperMock).findByKeyAndDomain(classification.getKey(),
"",
ClassificationServiceImpl.CURRENT_CLASSIFICATIONS_VALID_UNTIL);
try {
cutSpy.getClassification(classification.getKey(), classification.getDomain());
@ -267,6 +270,9 @@ public class ClassificationServiceImplTest {
verify(classificationMapperMock, times(1)).findByKeyAndDomain(classification.getKey(),
classification.getDomain(),
ClassificationServiceImpl.CURRENT_CLASSIFICATIONS_VALID_UNTIL);
verify(classificationMapperMock, times(1)).findByKeyAndDomain(classification.getKey(),
"",
ClassificationServiceImpl.CURRENT_CLASSIFICATIONS_VALID_UNTIL);
verify(taskanaEngineImplMock, times(1)).returnConnection();
verifyNoMoreInteractions(classificationMapperMock, taskanaEngineImplMock, classificationQueryImplMock);
throw e;