Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion com.avaloq.tools.ddk.test.core/META-INF/MANIFEST.MF
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,8 @@ Require-Bundle: org.eclipse.core.runtime,
junit-jupiter-api,
org.opentest4j,
org.eclipse.jdt.annotation
Import-Package: org.apache.logging.log4j
Import-Package: org.apache.logging.log4j,
org.apache.logging.log4j.util
Export-Package: com.avaloq.tools.ddk.test.core,
com.avaloq.tools.ddk.test.core.data,
com.avaloq.tools.ddk.test.core.junit.runners,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,9 +54,7 @@ public static LoggingRule getInstance() {

@Override
public void beforeEach(final ExtensionContext context) throws Exception {
if (LOGGER.isInfoEnabled()) {
LOGGER.info("STARTING: " + getDescriptionName(context));
}
LOGGER.info("STARTING: {}", () -> getDescriptionName(context));
}

/**
Expand All @@ -72,22 +70,16 @@ private String getDescriptionName(final ExtensionContext context) {

@Override
public void testSuccessful(final ExtensionContext context) {
if (LOGGER.isInfoEnabled()) {
LOGGER.info("SUCCEEDED: " + getDescriptionName(context));
}
LOGGER.info("SUCCEEDED: {}", () -> getDescriptionName(context));
}

@Override
public void testFailed(final ExtensionContext context, final Throwable cause) {
if (LOGGER.isInfoEnabled()) {
LOGGER.info("FAILED: " + getDescriptionName(context));
}
LOGGER.info("FAILED: {}", () -> getDescriptionName(context));
}

@Override
public void afterEach(final ExtensionContext context) throws Exception {
if (LOGGER.isInfoEnabled()) {
LOGGER.info("FINISHED: " + getDescriptionName(context));
}
LOGGER.info("FINISHED: {}", () -> getDescriptionName(context));
}
}
3 changes: 2 additions & 1 deletion com.avaloq.tools.ddk.test.ui/META-INF/MANIFEST.MF
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ Export-Package: com.avaloq.tools.ddk.test.ui,
com.avaloq.tools.ddk.test.ui.swtbot,
com.avaloq.tools.ddk.test.ui.swtbot.condition,
com.avaloq.tools.ddk.test.ui.swtbot.util
Import-Package: org.slf4j, org.apache.logging.log4j
Import-Package: org.slf4j, org.apache.logging.log4j,
org.apache.logging.log4j.util
Eclipse-RegisterBuddy: org.eclipse.swtbot.swt.finder
Automatic-Module-Name: com.avaloq.tools.ddk.test.ui
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,9 @@ public SwtBotButton(final Button button, final SelfDescribing description) {
*/
@Override
public SwtBotButton click() {
log.debug("Clicking on {}", SWTUtils.getText(widget)); //$NON-NLS-1$
if (log.isDebugEnabled()) {
log.debug("Clicking on {}", SWTUtils.getText(widget)); //$NON-NLS-1$
}
waitForEnabled();
notify(SWT.MouseEnter);
notify(SWT.MouseMove);
Expand All @@ -48,7 +50,9 @@ public SwtBotButton click() {
notify(SWT.MouseDown);
notify(SWT.MouseUp);
notify(SWT.Selection);
log.debug("Clicked on {}", SWTUtils.getText(widget)); //$NON-NLS-1$
if (log.isDebugEnabled()) {
log.debug("Clicked on {}", SWTUtils.getText(widget)); //$NON-NLS-1$
}
return this;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -65,9 +65,7 @@ public static void clickContextMenu(final AbstractSWTBot<? extends Control> bot,
* @throw {@link WidgetNotFoundException} if the context menu could not be found
*/
public static void clickContextMenu(final Runnable setSelection, final AbstractSWTBot<? extends Control> bot, final DynamicMenuPredicate predicate, final String... labels) {
if (LOGGER.isDebugEnabled()) {
LOGGER.debug("clickContextMenu(" + bot + " , " + Arrays.asList(labels) + ");"); //$NON-NLS-1$//$NON-NLS-2$//$NON-NLS-3$
}
LOGGER.debug("clickContextMenu({} , {});", () -> bot, () -> Arrays.asList(labels)); //$NON-NLS-1$
try {
setSelection.run();
logSelection(bot);
Expand Down Expand Up @@ -101,7 +99,7 @@ private static void logSelection(final AbstractSWTBot<? extends Control> bot) {
if (LOGGER.isDebugEnabled()) {
TableCollection selection = tryGetSelection(bot);
if (selection != null) {
LOGGER.debug("setSelection(" + selection + ")"); // NOPMD GuardLogStatement //$NON-NLS-1$//$NON-NLS-2$
LOGGER.debug("setSelection({})", selection); //$NON-NLS-1$
}
}
}
Expand Down Expand Up @@ -140,9 +138,7 @@ private static void tryUnselect(final AbstractSWTBot<? extends Control> bot) {
* @return {@code true} if on the given widget bot a context menu with the given text is available, else {@code false}
*/
public static boolean hasContextMenuItem(final AbstractSWTBot<? extends Control> widgetBot, final DynamicMenuPredicate predicate, final String... labels) {
if (LOGGER.isDebugEnabled()) {
LOGGER.debug("hasContextMenuItem(" + widgetBot + " , " + Arrays.asList(labels) + ");"); //$NON-NLS-1$//$NON-NLS-2$//$NON-NLS-3$
}
LOGGER.debug("hasContextMenuItem({} , {});", () -> widgetBot, () -> Arrays.asList(labels)); //$NON-NLS-1$
try {
return new SwtBotDynamicContextMenu(widgetBot.contextMenu(), predicate).menu(labels) != null;
} catch (WidgetNotFoundException widgetNotFound) {
Expand All @@ -164,9 +160,7 @@ public static boolean hasContextMenuItem(final AbstractSWTBot<? extends Control>
* @throw {@link WidgetNotFoundException} if the context menu could not be found
*/
public static boolean isEnabled(final AbstractSWTBot<? extends Control> widgetBot, final DynamicMenuPredicate predicate, final String... labels) {
if (LOGGER.isDebugEnabled()) {
LOGGER.debug("isEnabled(" + widgetBot + " , " + Arrays.asList(labels) + ");"); //$NON-NLS-1$//$NON-NLS-2$//$NON-NLS-3$
}
LOGGER.debug("isEnabled({} , {});", () -> widgetBot, () -> Arrays.asList(labels)); //$NON-NLS-1$
try {
return new SwtBotDynamicContextMenu(widgetBot.contextMenu(), predicate).menu(labels).isEnabled();
} catch (WidgetNotFoundException widgetNotFound) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@
*/
public class WaitForDynamicContextMenuItem extends WaitForMenuItem {
private static final Logger LOGGER = LogManager.getLogger(WaitForDynamicContextMenuItem.class);
private static final String LOG_MENU_ITEM_FINDER = "MenuItem finder matching {}"; //$NON-NLS-1$

/**
* Custom wrapper around a given {@link Matcher} that collects data about waiting dynamic menu items as
Expand Down Expand Up @@ -78,18 +79,14 @@ public WaitForDynamicContextMenuItem(final SwtBotDynamicContextMenuItem menu, fi
super(menu, new DynamicContextMenuItemMatcher(matcher, menu.getPredicate()), recursive, index);
itemMatcher = (DynamicContextMenuItemMatcher) this.matcher;
this.widget = menu.widget;
if (LOGGER.isDebugEnabled()) {
LOGGER.debug("MenuItem finder matching " + itemMatcher); //$NON-NLS-1$
}
LOGGER.debug(LOG_MENU_ITEM_FINDER, itemMatcher);
}

public WaitForDynamicContextMenuItem(final SwtBotDynamicContextMenu menu, final Matcher<MenuItem> matcher, final boolean recursive, final int index) {
super(menu, new DynamicContextMenuItemMatcher(matcher, menu.getPredicate()), recursive, index);
itemMatcher = (DynamicContextMenuItemMatcher) this.matcher;
this.widget = menu.widget;
if (LOGGER.isDebugEnabled()) {
LOGGER.debug("MenuItem finder matching " + itemMatcher); //$NON-NLS-1$
}
LOGGER.debug(LOG_MENU_ITEM_FINDER, itemMatcher);
}

@Override
Expand Down