Skip to content

Commit f331959

Browse files
committed
Merge pull request apache#850 from DaanHoogland/CLOUDSTACK-8656
CLOUDSTACK-8656: tests ignoring exceptionsfinal few ignored exceptions supplied with log messages. * pr/850: CLOUDSTACK-8656: tests ignoring exceptions Signed-off-by: Daan Hoogland <daan@onecht.net>
2 parents 638f1cf + 52037e8 commit f331959

1 file changed

Lines changed: 6 additions & 0 deletions

File tree

‎server/test/com/cloud/ha/HighAvailabilityManagerImplTest.java‎

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@
3333
import org.apache.cloudstack.engine.orchestration.service.VolumeOrchestrationService;
3434
import org.apache.cloudstack.framework.config.dao.ConfigurationDao;
3535
import org.apache.cloudstack.managed.context.ManagedContext;
36+
import org.apache.log4j.Logger;
3637
import org.junit.Before;
3738
import org.junit.BeforeClass;
3839
import org.junit.Test;
@@ -70,6 +71,7 @@
7071

7172
@RunWith(MockitoJUnitRunner.class)
7273
public class HighAvailabilityManagerImplTest {
74+
private static final Logger s_logger = Logger.getLogger(HighAvailabilityManagerImplTest.class);
7375
@Mock
7476
HighAvailabilityDao _haDao;
7577
@Mock
@@ -121,6 +123,7 @@ public static void initOnce() {
121123
processWorkMethod = HighAvailabilityManagerImpl.class.getDeclaredMethod("processWork", HaWorkVO.class);
122124
processWorkMethod.setAccessible(true);
123125
} catch (NoSuchMethodException e) {
126+
s_logger.info("[ignored] expected NoSuchMethodException caught: " + e.getLocalizedMessage());
124127
}
125128
}
126129

@@ -230,8 +233,11 @@ private void processWorkWithRetryCount(int count, Step expectedStep) {
230233
try {
231234
processWorkMethod.invoke(highAvailabilityManagerSpy, work);
232235
} catch (IllegalAccessException e) {
236+
s_logger.info("[ignored] expected IllegalAccessException caught: " + e.getLocalizedMessage());
233237
} catch (IllegalArgumentException e) {
238+
s_logger.info("[ignored] expected IllegalArgumentException caught: " + e.getLocalizedMessage());
234239
} catch (InvocationTargetException e) {
240+
s_logger.info("[ignored] expected InvocationTargetException caught: " + e.getLocalizedMessage());
235241
}
236242
assertTrue(work.getStep() == expectedStep);
237243
}

0 commit comments

Comments
 (0)