Skip to content

Commit

Permalink
test: remove easymock usage (#1702) (#1704)
Browse files Browse the repository at this point in the history
Co-authored-by: Manuel Carrasco Moñino <[email protected]>
  • Loading branch information
vaadin-bot and manolo authored May 26, 2021
1 parent 25ab792 commit ca4d128
Showing 1 changed file with 9 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,8 @@
import java.io.Serializable;
import java.util.HashMap;
import java.util.Set;
import java.util.concurrent.atomic.AtomicBoolean;

import com.helger.commons.mutable.MutableBoolean;
import org.easymock.Capture;
import org.junit.Assert;
import org.junit.Test;

Expand Down Expand Up @@ -207,14 +206,14 @@ public void setText_slotAttributeIsPreserved() {
@Test
public void testFireClick() {
button = new Button();
MutableBoolean clicked = new MutableBoolean(false);
AtomicBoolean clicked = new AtomicBoolean(false);
button.addClickListener(e -> {
clicked.set(true);
});

Assert.assertFalse(clicked.booleanValue());
Assert.assertFalse(clicked.get());
button.click();
Assert.assertTrue(clicked.booleanValue());
Assert.assertTrue(clicked.get());
}

@Test
Expand Down Expand Up @@ -255,16 +254,16 @@ public void changeIcon_iconThemeIsPreserved() {

@Test
public void disableOnClick_click_disablesComponent() {
Capture<Boolean> disabledCapture = new Capture<>();
button = new Button("foo", event -> disabledCapture
.setValue(event.getSource().isEnabled()));
button.setDisableOnClick(true);
AtomicBoolean buttonIsEnabled = new AtomicBoolean(true);

button = new Button("foo",
event -> buttonIsEnabled.set(event.getSource().isEnabled()));
button.setDisableOnClick(true);
button.click();

Assert.assertFalse(
"Button should have been disabled when event has been fired",
disabledCapture.getValue());
buttonIsEnabled.get());
}

@Test
Expand Down

0 comments on commit ca4d128

Please sign in to comment.