public void testSentryWithOnPart() {
// given
CmmnActivity casePlanModelActivity = new CasePlanModelHandler().handleElement(casePlanModel, context);
context.setParent(casePlanModelActivity);
CmmnSentryDeclaration sentryDeclaration = sentryHandler.handleElement(sentry, context);
CmmnActivity source = taskItemHandler.handleElement(planItem, context);
// when
sentryHandler.initializeOnParts(sentry, context);
// then
assertNotNull(sentryDeclaration);
List<CmmnOnPartDeclaration> onParts = sentryDeclaration.getOnParts();
assertNotNull(onParts);
assertFalse(onParts.isEmpty());
assertEquals(1, onParts.size());
List<CmmnOnPartDeclaration> onPartsAssociatedWithSource = sentryDeclaration.getOnParts(source.getId());
assertNotNull(onPartsAssociatedWithSource);
assertFalse(onPartsAssociatedWithSource.isEmpty());
assertEquals(1, onParts.size());
CmmnOnPartDeclaration onPartDeclaration = onPartsAssociatedWithSource.get(0);
assertNotNull(onPartDeclaration);
// source
assertEquals(source, onPartDeclaration.getSource());
assertEquals(onPart.getSource().getId(), onPartDeclaration.getSource().getId());
// standardEvent
assertEquals(onPart.getStandardEvent().name(), onPartDeclaration.getStandardEvent());
// sentry
assertNull(onPartDeclaration.getSentry());
assertNull(sentryDeclaration.getIfPart());
}