forked from eugenp/tutorials
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'master' into BAEL-6242-move-code
- Loading branch information
Showing
33 changed files
with
166 additions
and
52 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
18 changes: 18 additions & 0 deletions
18
lombok-modules/lombok-3/src/main/java/com/baeldung/lombok/locked/Counter.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
package com.baeldung.lombok.locked; | ||
|
||
import lombok.Locked; | ||
|
||
public class Counter { | ||
|
||
private int counter = 0; | ||
|
||
@Locked.Write | ||
public void increment() { | ||
counter++; | ||
} | ||
|
||
@Locked.Read | ||
public int get() { | ||
return counter; | ||
} | ||
} |
25 changes: 25 additions & 0 deletions
25
lombok-modules/lombok-3/src/test/java/com/baeldung/lombok/locked/CounterUnitTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
package com.baeldung.lombok.locked; | ||
|
||
import static org.junit.jupiter.api.Assertions.assertEquals; | ||
|
||
import org.junit.jupiter.api.Test; | ||
|
||
class CounterUnitTest { | ||
|
||
@Test | ||
void givenCounter_whenIncrementCalledMultipleTimes_thenReturnCorrectResult() throws InterruptedException { | ||
Counter counter = new Counter(); | ||
|
||
Thread.Builder builder = Thread.ofVirtual() | ||
.name("worker-", 0); | ||
Runnable task = counter::increment; | ||
|
||
Thread t1 = builder.start(task); | ||
t1.join(); | ||
|
||
Thread t2 = builder.start(task); | ||
t2.join(); | ||
|
||
assertEquals(2, counter.get()); | ||
} | ||
} |
File renamed without changes
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
50 changes: 50 additions & 0 deletions
50
testing-modules/selenium-2/src/main/java/com/baeldung/selenium/config/SeleniumConfig.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
package com.baeldung.selenium.config; | ||
|
||
import java.io.File; | ||
import java.time.Duration; | ||
|
||
import org.openqa.selenium.WebDriver; | ||
import org.openqa.selenium.WebElement; | ||
import org.openqa.selenium.firefox.FirefoxDriver; | ||
|
||
public class SeleniumConfig { | ||
|
||
private WebDriver driver; | ||
|
||
public SeleniumConfig() { | ||
driver = new FirefoxDriver(); | ||
driver.manage() | ||
.timeouts() | ||
.implicitlyWait(Duration.ofSeconds(5)); | ||
} | ||
|
||
static { | ||
System.setProperty("webdriver.gecko.driver", findFile("geckodriver.mac")); | ||
} | ||
|
||
private static String findFile(String filename) { | ||
String[] paths = { "", "bin/", "target/classes" }; // if you have chromedriver somewhere else on the path, then put it here. | ||
for (String path : paths) { | ||
if (new File(path + filename).exists()) | ||
return path + filename; | ||
} | ||
return ""; | ||
} | ||
|
||
public void close() { | ||
driver.close(); | ||
} | ||
|
||
public void navigateTo(String url) { | ||
driver.navigate() | ||
.to(url); | ||
} | ||
|
||
public void clickElement(WebElement element) { | ||
element.click(); | ||
} | ||
|
||
public WebDriver getDriver() { | ||
return driver; | ||
} | ||
} |
8 changes: 4 additions & 4 deletions
8
...ldung/selenium/stale/RobustWebDriver.java → ...ldung/selenium/stale/RobustWebDriver.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
4 changes: 2 additions & 2 deletions
4
...ldung/selenium/stale/WebElementUtils.java → ...ldung/selenium/stale/WebElementUtils.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
3 changes: 2 additions & 1 deletion
3
...leupload/FileUploadWebDriverLiveTest.java → ...leupload/FileUploadWebDriverLiveTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
11 changes: 5 additions & 6 deletions
11
...enium/visualregression/DriverManager.java → ...enium/visualregression/DriverManager.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
File renamed without changes.
File renamed without changes.
Oops, something went wrong.