blob: 836cc3879a369ac2744c93cb46a1dd9c02cb2fbe (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
|
/*******************************************************************************
* Copyright (c) 2015, 2016 Red Hat Inc.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
* Red Hat - Initial Contribution
*******************************************************************************/
package org.eclipse.linuxtools.internal.docker.ui.testutils.swt;
import static org.hamcrest.Matchers.notNullValue;
import org.eclipse.swtbot.swt.finder.widgets.SWTBotButton;
import org.eclipse.swtbot.swt.finder.widgets.SWTBotMenu;
/**
* Custom assertions on a given {@link SWTBotButton}.
*/
public class MenuAssertion extends AbstractSWTBotAssertions<MenuAssertion, SWTBotMenu> {
protected MenuAssertion(final SWTBotMenu actual) {
super(actual, MenuAssertion.class);
}
public static MenuAssertion assertThat(final SWTBotMenu actual) {
return new MenuAssertion(actual);
}
public MenuAssertion isVisible() {
notNullValue();
if (!actual.isVisible()) {
failWithMessage("Expected menu with text '%s' to be visible but it was not", actual.getText());
}
return this;
}
public MenuAssertion isNotVisible() {
notNullValue();
if (actual.isVisible()) {
failWithMessage("Expected menu with text '%s' to be visible but it was not", actual.getText());
}
return this;
}
}
|