Skip to content

Commit

Permalink
Reformat and organize imports for whole project using IntelliJ IDEA 15
Browse files Browse the repository at this point in the history
  • Loading branch information
Toilal committed Nov 19, 2015
1 parent a73b396 commit 38df891
Show file tree
Hide file tree
Showing 96 changed files with 1,153 additions and 1,168 deletions.
3 changes: 2 additions & 1 deletion fluentlenium-assertj/pom.xml
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>org.fluentlenium</groupId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@
import org.fluentlenium.assertj.custom.PageAssert;
import org.fluentlenium.core.Alert;
import org.fluentlenium.core.FluentPage;
import org.fluentlenium.core.domain.FluentWebElement;
import org.fluentlenium.core.domain.FluentList;
import org.fluentlenium.core.domain.FluentWebElement;

public final class FluentLeniumAssertions {

Expand All @@ -27,8 +27,8 @@ public static FluentWebElementAssert assertThat(FluentWebElement actual) {
return new FluentWebElementAssert(actual);
}

public static FluentListAssert assertThat(FluentList<?> actual) {
public static FluentListAssert assertThat(FluentList<?> actual) {
return new FluentListAssert(actual);
}
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -12,63 +12,63 @@ public FluentListAssert(FluentList<?> actual) {
super(actual, FluentListAssert.class);
}

/**
/**
* check if at least one element of the FluentList contains the text
*
* @return
*/
public FluentListAssert hasText(String textToFind) {
List<String> actualTexts = actual.getTexts();
for(String text : actualTexts) {
if(text.contains(textToFind)){
for (String text : actualTexts) {
if (text.contains(textToFind)) {
return this;
}
}
super.failWithMessage("No selected elements contains text: " + textToFind + " . Actual texts found : " + actualTexts);
return this;
}

/**
/**
* check if at no element of the FluentList contains the text
*
* @return
*/
public FluentListAssert hasNotText(String textToFind) {
List<String> actualTexts = actual.getTexts();
for(String text : actualTexts) {
if(text.contains(textToFind)){
for (String text : actualTexts) {
if (text.contains(textToFind)) {
super.failWithMessage("At least one selected elements contains text: " + textToFind + " . Actual texts found : " + actualTexts);
}
}
return this;
}

public FluentListAssert hasSize(int expectedSize) {
if(actual.size() != expectedSize) {
super.failWithMessage("Expected size: " + expectedSize + ". Actual size: " + actual.size() + ".");
}
return this;
}
public FluentListSizeBuilder hasSize() {
return new FluentListSizeBuilder(actual.size(), this);
}
/**
public FluentListAssert hasSize(int expectedSize) {
if (actual.size() != expectedSize) {
super.failWithMessage("Expected size: " + expectedSize + ". Actual size: " + actual.size() + ".");
}
return this;
}

public FluentListSizeBuilder hasSize() {
return new FluentListSizeBuilder(actual.size(), this);
}

/**
* check if an element of the FluentList has the id
*
* @param idToFind
* @param idToFind
* @return
*/
public FluentListAssert hasId(String idToFind) {
List actualIds = actual.getIds();
if (!actualIds.contains(idToFind)) {
super.failWithMessage("No selected elements has id: " + idToFind + " . Actual texts found : " + actualIds);
}
return this;
}
public FluentListAssert hasId(String idToFind) {
List actualIds = actual.getIds();
if (!actualIds.contains(idToFind)) {
super.failWithMessage("No selected elements has id: " + idToFind + " . Actual texts found : " + actualIds);
}
return this;
}

/**
/**
* check if at least one element of the FluentList contains the text
*
* @return
Expand All @@ -85,11 +85,11 @@ public FluentListAssert hasClass(String classToFind) {
return this;
}

/*
* Used in FluentListSizeBuilder to raise AssertionError
*/
void internalFail(String reason) {
super.failWithMessage(reason);
}
/*
* Used in FluentListSizeBuilder to raise AssertionError
*/
void internalFail(String reason) {
super.failWithMessage(reason);
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -2,40 +2,40 @@

public class FluentListSizeBuilder {

private int actualSize;
private FluentListAssert listAssert;

public FluentListSizeBuilder(int size, FluentListAssert listeAssert) {
this.actualSize = size;
this.listAssert = listeAssert;
}

public FluentListAssert lessThan(int size) {
if (this.actualSize >= size) {
this.listAssert.internalFail("Actual size: " + actualSize + " is not less than: " + size);
}
return this.listAssert;
}

public Object lessThanOrEqualTo(int size) {
if (this.actualSize > size) {
this.listAssert.internalFail("Actual size: " + actualSize + " is not less than or equal to: " + size);
}
return this.listAssert;
}
public FluentListAssert greaterThan(int size) {
if (this.actualSize <= size) {
this.listAssert.internalFail("Actual size: " + actualSize + " is not greater than: " + size);
}
return this.listAssert;
}

public Object greaterThanOrEqualTo(int size) {
if (this.actualSize < size) {
this.listAssert.internalFail("Actual size: " + actualSize + " is not greater than or equal to: " + size);
}
return this.listAssert;
}
private int actualSize;
private FluentListAssert listAssert;

public FluentListSizeBuilder(int size, FluentListAssert listeAssert) {
this.actualSize = size;
this.listAssert = listeAssert;
}

public FluentListAssert lessThan(int size) {
if (this.actualSize >= size) {
this.listAssert.internalFail("Actual size: " + actualSize + " is not less than: " + size);
}
return this.listAssert;
}

public Object lessThanOrEqualTo(int size) {
if (this.actualSize > size) {
this.listAssert.internalFail("Actual size: " + actualSize + " is not less than or equal to: " + size);
}
return this.listAssert;
}

public FluentListAssert greaterThan(int size) {
if (this.actualSize <= size) {
this.listAssert.internalFail("Actual size: " + actualSize + " is not greater than: " + size);
}
return this.listAssert;
}

public Object greaterThanOrEqualTo(int size) {
if (this.actualSize < size) {
this.listAssert.internalFail("Actual size: " + actualSize + " is not greater than or equal to: " + size);
}
return this.listAssert;
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -109,12 +109,12 @@ public FluentWebElementAssert isNotSelected() {
* @return
*/
public FluentWebElementAssert hasText(String textToFind) {
if(!actual.getText().contains(textToFind)){
if (!actual.getText().contains(textToFind)) {
super.failWithMessage("The element does not contain the text: " + textToFind + " . Actual text found : " + actual.getText());

}

return this;
return this;
}

/**
Expand All @@ -123,12 +123,12 @@ public FluentWebElementAssert hasText(String textToFind) {
* @return
*/
public FluentWebElementAssert hasTextMatching(String regexToBeMatched) {
if(!actual.getText().matches(regexToBeMatched)){
if (!actual.getText().matches(regexToBeMatched)) {
super.failWithMessage("The element does not match the regex: " + regexToBeMatched + " . Actual text found : " + actual.getText());

}

return this;
return this;
}

/**
Expand All @@ -137,11 +137,11 @@ public FluentWebElementAssert hasTextMatching(String regexToBeMatched) {
* @return
*/
public FluentWebElementAssert hasNotText(String textToFind) {
if(actual.getText().contains(textToFind)){
if (actual.getText().contains(textToFind)) {
super.failWithMessage("The element contain the text: " + textToFind);
}

return this;
return this;
}

private void failIsSelected() {
Expand All @@ -155,24 +155,24 @@ private void failIsNotSelected() {
/**
* check if the element has the given id
*
* @param id to check
* @param id to check
* @return
*/
public FluentWebElementAssert hasId(String id) {
if(!actual.getId().equals(id)) {
super.failWithMessage("The element does not have the id: " + id + " . Actual id found : " + actual.getId());
}
return this;
}
public FluentWebElementAssert hasId(String id) {
if (!actual.getId().equals(id)) {
super.failWithMessage("The element does not have the id: " + id + " . Actual id found : " + actual.getId());
}
return this;
}

/**
* check if the element has the class
*
* @param classToFind
* @param classToFind
* @return
*/
public FluentWebElementAssert hasClass(String classToFind) {
if(!getClasses().contains(classToFind)) {
if (!getClasses().contains(classToFind)) {
super.failWithMessage("The element does not have the class: " + classToFind + " . Actual class found : " + actual.getAttribute("class"));
}
return this;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@ public class AlertAssertTest {

@Before
public void before() {
MockitoAnnotations.initMocks(this);
alertAssert = FluentLeniumAssertions.assertThat(alert);
MockitoAnnotations.initMocks(this);
alertAssert = FluentLeniumAssertions.assertThat(alert);
}

@Test
Expand Down
Loading

0 comments on commit 38df891

Please sign in to comment.