Skip to content

Commit 406338d

Browse files
authored
Merge branch 'master' into BAEL-6242-move-code
2 parents 2c886db + 510dc41 commit 406338d

File tree

33 files changed

+166
-52
lines changed

33 files changed

+166
-52
lines changed

core-java-modules/core-java-io-5/pom.xml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,11 @@
5050
<artifactId>jmh-generator-annprocess</artifactId>
5151
<version>${jmh.version}</version>
5252
</dependency>
53+
<dependency>
54+
<groupId>de.vandermeer</groupId>
55+
<artifactId>asciitable</artifactId>
56+
<version>0.3.2</version>
57+
</dependency>
5358
</dependencies>
5459

5560
<build>

lombok-modules/lombok-3/pom.xml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,4 +34,9 @@
3434
</plugins>
3535
</build>
3636

37+
<properties>
38+
<maven.compiler.source>21</maven.compiler.source>
39+
<maven.compiler.target>21</maven.compiler.target>
40+
</properties>
41+
3742
</project>
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
package com.baeldung.lombok.locked;
2+
3+
import lombok.Locked;
4+
5+
public class Counter {
6+
7+
private int counter = 0;
8+
9+
@Locked.Write
10+
public void increment() {
11+
counter++;
12+
}
13+
14+
@Locked.Read
15+
public int get() {
16+
return counter;
17+
}
18+
}
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
package com.baeldung.lombok.locked;
2+
3+
import static org.junit.jupiter.api.Assertions.assertEquals;
4+
5+
import org.junit.jupiter.api.Test;
6+
7+
class CounterUnitTest {
8+
9+
@Test
10+
void givenCounter_whenIncrementCalledMultipleTimes_thenReturnCorrectResult() throws InterruptedException {
11+
Counter counter = new Counter();
12+
13+
Thread.Builder builder = Thread.ofVirtual()
14+
.name("worker-", 0);
15+
Runnable task = counter::increment;
16+
17+
Thread t1 = builder.start(task);
18+
t1.join();
19+
20+
Thread t2 = builder.start(task);
21+
t2.join();
22+
23+
assertEquals(2, counter.get());
24+
}
25+
}

testing-modules/selenium-2/README.md

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,18 @@
11
### Relevant Articles:
22
- [Running Selenium Scripts with JMeter](https://www.baeldung.com/selenium-jmeter)
3-
- [Fixing Selenium WebDriver Executable Path Error](https://www.baeldung.com/java-selenium-webdriver-path-error)
4-
- [Implicit Wait vs Explicit Wait in Selenium Webdriver](https://www.baeldung.com/selenium-implicit-explicit-wait)
53
- [Switching Between Frames Using Selenium WebDriver in Java](https://www.baeldung.com/java-selenium-change-frames)
4+
- [Uploading File Using Selenium Webdriver in Java](https://www.baeldung.com/java-selenium-upload-file)
5+
- [Using Cookies With Selenium WebDriver in Java](https://www.baeldung.com/java-selenium-webdriver-cookies)
6+
- [StaleElementReferenceException in Selenium](https://www.baeldung.com/selenium-staleelementreferenceexception)
7+
- [Retrieve the Value of an HTML Input in Selenium WebDriver](https://www.baeldung.com/java-selenium-html-input-value)
8+
- [Clicking Elements in Selenium using JavaScript](https://www.baeldung.com/java-selenium-javascript)
9+
- [Guide to Selenium with JUnit / TestNG](http://www.baeldung.com/java-selenium-with-junit-and-testng)
610
- [Finding Element by Attribute in Selenium](https://www.baeldung.com/selenium-find-element-by-attribute)
711
- [Automated Visual Regression Testing Over Scalable Cloud Grid](https://www.baeldung.com/automated-visual-regression-testing)
812
- [How to Handle Alerts and Popups in Selenium](https://www.baeldung.com/java-selenium-handle-alerts-popups)
913
- [Automated Accessibility Testing With Selenium](https://www.baeldung.com/java-selenium-accessibility-testing)
1014

15+
1116
#### Notes:
1217
- to run the live tests for the article *Fixing Selenium WebDriver Executable Path Error*, follow the manual setup described
1318
[Fixing Selenium WebDriver Executable Path Error](https://www.baeldung.com/java-selenium-webdriver-path-error#manual-setup); download the 3
Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
package com.baeldung.selenium.config;
2+
3+
import java.io.File;
4+
import java.time.Duration;
5+
6+
import org.openqa.selenium.WebDriver;
7+
import org.openqa.selenium.WebElement;
8+
import org.openqa.selenium.firefox.FirefoxDriver;
9+
10+
public class SeleniumConfig {
11+
12+
private WebDriver driver;
13+
14+
public SeleniumConfig() {
15+
driver = new FirefoxDriver();
16+
driver.manage()
17+
.timeouts()
18+
.implicitlyWait(Duration.ofSeconds(5));
19+
}
20+
21+
static {
22+
System.setProperty("webdriver.gecko.driver", findFile("geckodriver.mac"));
23+
}
24+
25+
private static String findFile(String filename) {
26+
String[] paths = { "", "bin/", "target/classes" }; // if you have chromedriver somewhere else on the path, then put it here.
27+
for (String path : paths) {
28+
if (new File(path + filename).exists())
29+
return path + filename;
30+
}
31+
return "";
32+
}
33+
34+
public void close() {
35+
driver.close();
36+
}
37+
38+
public void navigateTo(String url) {
39+
driver.navigate()
40+
.to(url);
41+
}
42+
43+
public void clickElement(WebElement element) {
44+
element.click();
45+
}
46+
47+
public WebDriver getDriver() {
48+
return driver;
49+
}
50+
}

testing-modules/selenium/src/main/java/com/baeldung/selenium/stale/RobustWebDriver.java renamed to testing-modules/selenium-2/src/main/java/com/baeldung/selenium/stale/RobustWebDriver.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
package com.baeldung.selenium.stale;
22

3-
import org.openqa.selenium.By;
4-
import org.openqa.selenium.WebDriver;
5-
import org.openqa.selenium.WebElement;
6-
73
import java.util.List;
84
import java.util.Set;
95
import java.util.stream.Collectors;
106

7+
import org.openqa.selenium.By;
8+
import org.openqa.selenium.WebDriver;
9+
import org.openqa.selenium.WebElement;
10+
1111
public class RobustWebDriver implements WebDriver {
1212

1313
private final WebDriver originalWebDriver;

testing-modules/selenium/src/main/java/com/baeldung/selenium/stale/RobustWebElement.java renamed to testing-modules/selenium-2/src/main/java/com/baeldung/selenium/stale/RobustWebElement.java

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,11 @@
11
package com.baeldung.selenium.stale;
22

3+
import java.util.List;
4+
import java.util.function.BiConsumer;
5+
import java.util.function.BiFunction;
6+
import java.util.function.Consumer;
7+
import java.util.function.Function;
8+
39
import org.openqa.selenium.By;
410
import org.openqa.selenium.Dimension;
511
import org.openqa.selenium.OutputType;
@@ -9,12 +15,6 @@
915
import org.openqa.selenium.WebDriverException;
1016
import org.openqa.selenium.WebElement;
1117

12-
import java.util.List;
13-
import java.util.function.BiConsumer;
14-
import java.util.function.BiFunction;
15-
import java.util.function.Consumer;
16-
import java.util.function.Function;
17-
1818
public class RobustWebElement implements WebElement {
1919

2020
private WebElement originalElement;

0 commit comments

Comments
 (0)