Skip to content

Instantly share code, notes, and snippets.

View eliasnogueira's full-sized avatar
🇧🇷

Elias Nogueira eliasnogueira

🇧🇷
View GitHub Profile
@eliasnogueira
eliasnogueira / datafaker-talk.md
Last active December 22, 2023 08:24
DataFaker: the most powerful fake data generator library

Title

Datafaker: the most powerful fake data generator library

Description

Data generators in software testing play a critical role in creating realistic and diverse datasets for testing scenarios. However, they present challenges, such as ensuring data diversity, maintaining quality, facilitating validation, and ensuring long-term maintainability.

While many engineers are familiar with these challenges, they often resort to non-specialized tools like the RandomStringUtils class from Apache Commons or the Random class, concatenating fixed data with it. This approach lacks scalability and may not yield a valid dataset.

@eliasnogueira
eliasnogueira / beyond-senior-level.md
Last active December 15, 2023 14:09
Essential Soft and Tech Skills for Advancing Beyond Senior Level

Title

Essential Soft and Tech Skills for Advancing Beyond Senior Level

Abstract

In today's dynamic professional landscape, the journey beyond the senior level requires a mix of soft and technical skills. This talk explores the key competencies essential for your career progression, offering insights into the dynamic interaction between interpersonal and technological expertise to help you excel and thrive beyond the senior level.

Description

@eliasnogueira
eliasnogueira / SimulationTest.java
Last active December 3, 2023 17:43
Example of a test validating the constants of Simulation
class SimulationTest {
@Test
void basicCheck() {
Simulation simulation = Simulation.builder().name("Elias").cpf("123456").email("[email protected]")
.amount(new BigDecimal(1000)).installments(48).insurance(false).build();
SoftAssertions.assertSoftly(softly -> {
softly.assertThat(simulation.getName()).isEqualTo("Elias");
softly.assertThat(simulation.getCpf()).isNotEmpty();
@eliasnogueira
eliasnogueira / Simulation.java
Created December 3, 2023 16:38
Code snippet of the Simulation entity
public class Simulation {
@NotNull(message = "Amount cannot be empty")
@Min(value = 1000, message = "Amount must be equal or greater than $ 1.000")
@Max(value = 40000, message = "Amount must be equal or less than than $ 40.000")
private BigDecimal amount;
@NotNull(message = "Installments cannot be empty")
@Min(value = 2, message = "Installments must be equal or greater than 2")
@Max(value = 48, message = "Installments must be equal or less than 48")
@eliasnogueira
eliasnogueira / enhancing_project_test.md
Last active December 22, 2023 07:22
Enhancing Project Integrity: A Test Modernization for Bug-Free Code

Title

Enhancing Project Integrity: A Test Modernization for Bug-Free Code

Description

Embarking on a Java project involves employing the best strategies, patterns, and architectural decisions, all geared towards a customer-centric.

Yet, there exists an often overlooked facet: quality assurance. While not entirely disregarded, we, as developers, sometimes limit ourselves to performing the basic unity and integration tests, which may leave room for bugs.

Fortunately, several straightforward approaches and tools can be implemented to deliver a bug-free project with minimal effort.

@eliasnogueira
eliasnogueira / docker-compose.yml
Last active October 23, 2023 09:37
Example of Wiremock docker usage mapping the internal files to the container
version: '3.9'
services:
wiremock:
image: "wiremock/wiremock:latest"
container_name: wiremock-credit-restriction-api
ports:
- "8087:8080"
volumes:
# copy the local Wiremock files (__files and mappings folder) into the container

Enhancing Project Integrity: A Modernization for Bug-Free Code

Description

Embarking on a Java project involves employing the best strategies, patterns, and architectural decisions, all geared towards a customer-centric.

Yet, there exists an often overlooked facet: quality assurance. While not entirely disregarded, we, as developers, sometimes limit ourselves to performing the basic unity and integration tests, which may leave room for bugs.

Fortunately, there are several straightforward approaches and tools that can be implemented to deliver a bug-free project with minimal effort.

class MethodSourceCase3ExampleTest {
@DisplayName("Unpronounceable entity tests")
@ParameterizedTest(name = "The Simulation {0} shows the error {1}")
@MethodSource("expensiveProducts")
void edgeCases(Simulation simulation, String errorMessage) {
Response response = postSimulation(simulation);
assertThat(response.statusCode).isEqualTo(422);
assertThat(response.body().errorMessage()).isEqualsTo(errorMessage);
class MethodSourceCase2ExampleTest {
@DisplayName("Payment status")
@ParameterizedTest(name = "The payment with status {0} returns the message {1}")
@MethodSource("statusList")
void paymentStatus(Status status, String message) {
String auditedPayment = auditService.getPayments(status);
assertThat(status).isEqualTo(message);
}
@eliasnogueira
eliasnogueira / ValueSourceSimpleExample.java
Created June 15, 2023 20:00
Simple example that explain how the MethodSource annotation from JUnit 5 works
class MyTestClass {
@DisplayName("Date must be from the current year")
@ParameterizedTest(name = "Check the current year of {0}")
@MethodSource("dateList")
void myTest(LocalDate date) {
assertThat(date).hasYear(2023);
}
static Stream<Arguments> dateList() {