Skip to content

Commit

Permalink
Fixing a bug in the page object initialization
Browse files Browse the repository at this point in the history
  • Loading branch information
littleclay committed Dec 13, 2019
1 parent 700e3d2 commit 6ba9103
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 7 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ Via maven:
<dependency>
<groupId>com.redfin</groupId>
<artifactId>patient-selenium</artifactId>
<version>3.1.0</version>
<version>3.1.1</version>
</dependency>
```

Expand Down
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

<groupId>com.redfin</groupId>
<artifactId>patient-selenium</artifactId>
<version>3.1.0</version>
<version>3.1.1</version>
<modelVersion>4.0.0</modelVersion>
<packaging>jar</packaging>

Expand Down
12 changes: 8 additions & 4 deletions src/main/java/com/redfin/selenium/AbstractBaseWidgetObject.java
Original file line number Diff line number Diff line change
Expand Up @@ -27,14 +27,18 @@ protected final E getWidgetElement() {
return widgetElement;
}

/*
* Only intended for use by the AbstractPageObjectInitializer so make
* the visibility package private.
*/
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
// Package private methods intended for use only by AbstractPageObjectInitializer
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

void setWidgetElement(E value) {
if (null != widgetElement) {
throw new PageObjectInitializationException("This widget was already initialized");
}
this.widgetElement = value;
}

boolean isWidgetElementSet() {
return null != widgetElement;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -293,7 +293,7 @@ private void initializeField(Object object,
if (isWidget.get()) {
if (builtValue.get() instanceof AbstractBaseWidgetObject<?, ?, ?, ?>) {
AbstractBaseWidgetObject<?, ?, ?, ?> widget = (AbstractBaseWidgetObject<?, ?, ?, ?>) builtValue.get();
if (null != widget.getWidgetElement()) {
if (widget.isWidgetElementSet()) {
throw new PageObjectInitializationException(String.format("Received a widget from %s with a non-null base element for field: %s", buildMethodNameString, field));
}
} else {
Expand Down

0 comments on commit 6ba9103

Please sign in to comment.