Builder Pattern to the rescue!

cover image
  1. First Name
  2. Last Name
  3. Address
  4. City
  5. State
  6. Country
  7. Mobile Number

Before Using the Builder Pattern

GitHub Repository

GitHub repository

What is Builder Pattern?

What is Lombok?

<!-- https://mvnrepository.com/artifact/org.projectlombok/lombok -->
<dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
<version>1.18.24</version>
<scope>provided</scope>
</dependency>

Using the Builder Pattern with Lombok

<!-- https://mvnrepository.com/artifact/com.github.javafaker/javafaker -->
<dependency>
<groupId>com.github.javafaker</groupId>
<artifactId>javafaker</artifactId>
<version>1.0.2</version>
</dependency>
RegisterUserWithBuilder class
RegisterUserWithBuilder.builder ()
.firstName (FAKER.name ()
.firstName ())

Running the Test

Running tests on intellij IDE

Some more example blog links

Conclusion

--

--

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Mohammad Faisal Khatri

Mohammad Faisal Khatri

QA with 14+ years of experience in automation as well as manual testing. Freelancer, blogger and open source contributor.