diff --git a/lombok/lombok.config b/lombok/lombok.config
new file mode 100644
index 0000000000..6f1b2fffea
--- /dev/null
+++ b/lombok/lombok.config
@@ -0,0 +1,8 @@
+import lombok_feature.config
+
+config.stopBubbling = true
+lombok.anyconstructor.addconstructorproperties=false
+lombok.addLombokGeneratedAnnotation = true
+lombok.addSuppressWarnings = false
+
+
diff --git a/lombok/lombok_feature.config b/lombok/lombok_feature.config
new file mode 100644
index 0000000000..01b41e1504
--- /dev/null
+++ b/lombok/lombok_feature.config
@@ -0,0 +1 @@
+lombok.experimental.flagUsage = warning
\ No newline at end of file
diff --git a/lombok/pom.xml b/lombok/pom.xml
index 2daaf9f438..4a78c5422c 100644
--- a/lombok/pom.xml
+++ b/lombok/pom.xml
@@ -26,6 +26,11 @@
hibernate-jpa-2.1-api
${hibernate-jpa-2.1-api.version}
+
+ org.jetbrains
+ annotations
+ 23.0.0
+
@@ -70,7 +75,7 @@
1.0.0.Final
- 1.18.10.0
+ 1.18.20.0
\ No newline at end of file
diff --git a/lombok/src/main/java/com/baeldung/lombok/configexamples/Account.java b/lombok/src/main/java/com/baeldung/lombok/configexamples/Account.java
new file mode 100644
index 0000000000..2442f9fa4b
--- /dev/null
+++ b/lombok/src/main/java/com/baeldung/lombok/configexamples/Account.java
@@ -0,0 +1,40 @@
+package com.baeldung.lombok.configexamples;
+
+import lombok.*;
+import lombok.extern.java.Log;
+
+import java.util.logging.Level;
+
+import static java.lang.Math.abs;
+
+@NoArgsConstructor
+@AllArgsConstructor
+@Getter
+@Setter
+@Log
+public class Account {
+
+ @NonNull
+ private Double balance = 0.;
+ @NonNull
+ private String accountHolder = "";
+
+ public Account addBalance(double amount) {
+ if (amount < 0) {
+ throw new IllegalArgumentException("Can not add negative amount");
+ }
+
+ this.balance += amount;
+ return this;
+ }
+
+ public Account withdraw(double amount) {
+ if (this.balance - abs(amount) < 0) {
+ domainLog.log(Level.INFO, String.format("Transaction denied for account holder: %s", this.accountHolder));
+ throw new IllegalArgumentException(String.format("Not enough balance, you have %.2f", this.balance));
+ }
+
+ this.balance -= abs(amount);
+ return this;
+ }
+}
\ No newline at end of file
diff --git a/lombok/src/main/java/com/baeldung/lombok/configexamples/TransactionLog.java b/lombok/src/main/java/com/baeldung/lombok/configexamples/TransactionLog.java
new file mode 100644
index 0000000000..61a7a94a16
--- /dev/null
+++ b/lombok/src/main/java/com/baeldung/lombok/configexamples/TransactionLog.java
@@ -0,0 +1,13 @@
+package com.baeldung.lombok.configexamples;
+
+import lombok.AllArgsConstructor;
+import lombok.Getter;
+import lombok.experimental.Accessors;
+
+@AllArgsConstructor
+@Getter
+@Accessors(prefix = {"op"})
+public class TransactionLog {
+ double amount;
+ String description;
+}
diff --git a/lombok/src/main/java/com/baeldung/lombok/configexamples/lombok.config b/lombok/src/main/java/com/baeldung/lombok/configexamples/lombok.config
new file mode 100644
index 0000000000..824d11a92f
--- /dev/null
+++ b/lombok/src/main/java/com/baeldung/lombok/configexamples/lombok.config
@@ -0,0 +1,6 @@
+clear lombok.experimental.flagUsage
+
+lombok.anyconstructor.addconstructorproperties=true
+lombok.addNullAnnotations = jetbrains
+lombok.accessors.chain = true
+lombok.log.fieldName = domainLog
\ No newline at end of file
diff --git a/lombok/src/test/java/com/baeldung/lombok/configexamples/AccountUnitTest.java b/lombok/src/test/java/com/baeldung/lombok/configexamples/AccountUnitTest.java
new file mode 100644
index 0000000000..c030acf905
--- /dev/null
+++ b/lombok/src/test/java/com/baeldung/lombok/configexamples/AccountUnitTest.java
@@ -0,0 +1,50 @@
+package com.baeldung.lombok.configexamples;
+
+import org.junit.jupiter.api.Test;
+
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertThrows;
+
+class AccountUnitTest {
+
+ @Test
+ void should_initialize_account() {
+ Account myAccount = new Account()
+ .setBalance(2000.00)
+ .setAccountHolder("John Snow");
+
+ assertEquals(2000.00, myAccount.getBalance());
+ assertEquals("John Snow", myAccount.getAccountHolder());
+ }
+
+ @Test
+ void should_throw_error_when_balance_becomes_negative() {
+ Account myAccount = new Account()
+ .setBalance(20.00)
+ .setAccountHolder("John Snow");
+
+ assertThrows(IllegalArgumentException.class, () -> myAccount.withdraw(100.00));
+ }
+
+ @Test
+ void should_throw_no_error_when_balance_becomes_zero() {
+ Account myAccount = new Account()
+ .setBalance(20.00)
+ .setAccountHolder("John Snow");
+
+ myAccount.withdraw(20.00);
+
+ assertEquals(0.00, myAccount.getBalance());
+ }
+
+ @Test
+ void should_update_balance_properly() {
+ Account myAccount = new Account()
+ .setBalance(20.00)
+ .setAccountHolder("John Snow");
+
+ myAccount.withdraw(5.00).withdraw(10.00);
+
+ assertEquals(5.00, myAccount.getBalance());
+ }
+}
\ No newline at end of file