Skip to content

Commit

Permalink
Renamed EventSystem implementation
Browse files Browse the repository at this point in the history
  • Loading branch information
slu-it authored and Axel Schüssler committed Oct 23, 2016
1 parent 5669728 commit 5924713
Show file tree
Hide file tree
Showing 5 changed files with 13 additions and 16 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
import info.novatec.testit.webtester.config.Configuration;
import info.novatec.testit.webtester.config.builders.DefaultConfigurationBuilder;
import info.novatec.testit.webtester.events.EventSystem;
import info.novatec.testit.webtester.events.EventSystemImpl;
import info.novatec.testit.webtester.events.DispatchingEventSystem;
import info.novatec.testit.webtester.events.browser.ClosedBrowserEvent;
import info.novatec.testit.webtester.internal.PageFactory;
import info.novatec.testit.webtester.pages.Page;
Expand Down Expand Up @@ -74,7 +74,7 @@ private WebDriverBrowser(Configuration configuration, WebDriver webDriver) {
this.pageSource = new PageSourceSaver(this);
this.javaScript = new JavaScriptExecutor(this);
this.focus = new FocusSetter(this);
this.eventSystem = new EventSystemImpl(this);
this.eventSystem = new DispatchingEventSystem(this);

this.adHocFinder = new AdHocFinder(this);
this.pageFactory = new PageFactory(this);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,22 +3,19 @@
import java.util.LinkedList;
import java.util.List;

import lombok.AllArgsConstructor;
import lombok.extern.slf4j.Slf4j;

import info.novatec.testit.webtester.browser.Browser;


@Slf4j
public class EventSystemImpl implements EventSystem {
@AllArgsConstructor
public class DispatchingEventSystem implements EventSystem {

private final List<EventListener> listeners;
private final List<EventListener> listeners = new LinkedList<>();
private final Browser browser;

public EventSystemImpl(Browser browser) {
this.listeners = new LinkedList<>();
this.browser = browser;
}

@Override
public void register(EventListener listener) {
listeners.add(listener);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
* I.e. this could be the text before and after for a text set event.
*
* @see EventListener
* @see EventSystemImpl
* @see DispatchingEventSystem
* @since 2.0
*/
public interface Event {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,23 +1,23 @@
package info.novatec.testit.webtester.events;

/**
* Defines a listener that can be registered at the {@link EventSystemImpl event system}.
* Defines a listener that can be registered at the {@link DispatchingEventSystem event system}.
* <p>
* If an {@link Event event} is reported by the system the {@link #eventOccurred(Event)} method of all registered
* listeners is invoked.
*
* @see Event
* @see EventSystemImpl
* @see DispatchingEventSystem
* @since 2.0
*/
public interface EventListener {

/**
* This method will be called if any {@link Event event} is reported by the {@link EventSystemImpl event system}.
* This method will be called if any {@link Event event} is reported by the {@link DispatchingEventSystem event system}.
*
* @param event the {@link Event event} that occurred.
* @see Event
* @see EventSystemImpl
* @see DispatchingEventSystem
* @since 2.0
*/
void eventOccurred(Event event);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@


@RunWith(MockitoJUnitRunner.class)
public class EventSystemImplTest {
public class DispatchingEventSystemTest {

@Mock
EventListener listener1;
Expand All @@ -41,7 +41,7 @@ public class EventSystemImplTest {
@Mock(answer = Answers.RETURNS_DEEP_STUBS)
Browser browser;
@InjectMocks
EventSystemImpl cut;
DispatchingEventSystem cut;

@Before
public void eventSystemIsEnabledByDefault() {
Expand Down

0 comments on commit 5924713

Please sign in to comment.