If your project has multiple methods that either do similar things or depend on each other, they should be grouped together:
public boolean isHomeDisplayed() { return urlContains("www.vpl.ca"); } public boolean isResultDisplayed() { return urlContains("vpl.bibliocommons.com"); } public boolean urlContains(String keyword) { return wait.until(ExpectedConditions.urlContains(keyword)); }
First, you should have methods that do similar things like isHomeDisplayed() and isResultsDisplayed().
Then, since both these methods depend on the urlContains() method, urlContains() should be right after the first 2 methods.
What is the reason?
When reading the code of isHomeDisplayed, it is clear that it depends on urlContains.
So you should look into urlContains next.
If urlContains is after isHomeDisplayed, it is easy to see it.
Otherwise, you have to locate it in the file which takes time.
I know we haven't quite covered it in class yet, but what if one of these methods was protected or private. Methods should also be grouped by visibility (public then protected then private)
Later, Oleg, later :)
Not important for now.
We will get there soon.
Ok ok ... I will hold these things in for now :)