Skip to content

Instantly share code, notes, and snippets.

View eliasnogueira's full-sized avatar
🇧🇷

Elias Nogueira eliasnogueira

🇧🇷
View GitHub Profile
@eliasnogueira
eliasnogueira / good-testing-practices-open-source-talk.md
Created June 11, 2023 14:32
Good testing practices in an open-source project

Title

Good testing practices in an open-source project

Description

Nowadays the contribution guide in every open-source project is not sufficient to describe the approaches, techniques, and how people solve break changes.

We all know: they are the most democratic projects we can work on, but sometimes not follow basic practices to elevate the project quality.

@eliasnogueira
eliasnogueira / SoftAssertionJunit5Test.java
Last active March 26, 2023 11:30
SoftAssertions: JUnit 5
import org.junit.jupiter.api.Test;
import static org.junit.jupiter.api.Assertions.assertAll;
import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertNotNull;
class SoftAssertionJunit5Test {
@Test
void softAssertionUsingJUnit5() {
var person = Person.builder().name("John").phoneNumber(null).age(16).build();
@eliasnogueira
eliasnogueira / SoftAssertionTest.java
Last active March 25, 2023 14:00
SoftAssertion: AssertJ
import org.assertj.core.api.SoftAssertions;
import org.junit.jupiter.api.Test;
class SoftAssertionTest {
@Test
void softAssertionUsingAssertJ() {
var person = Person.builder().name("John").phoneNumber(null).age(16).build();
SoftAssertions.assertSoftly(softly -> {
@eliasnogueira
eliasnogueira / HardAssertionTest.java
Last active March 25, 2023 14:01
HardAssertion: JUnit 5
import org.assertj.core.api.SoftAssertions;
import org.junit.jupiter.api.Test;
class HardAssertionTest {
@Test
void hardAssertion() {
var person = Person.builder().name("John").phoneNumber(null).age(16).build();
assertThat(person.getName()).isNotBlank();
@eliasnogueira
eliasnogueira / SoftAssertTestNGTest.java
Created March 25, 2023 12:53
SoftAssertions: TestNG
public class SoftAssertTestNGTest {
@Test
public void testNGSoftAssertion() {
var person = Person.builder().name("John").phoneNumber(null).age(16).build();
SoftAssert softAssert = new SoftAssert();
softAssert.assertEquals(person.getName(), "John");
softAssert.assertNotNull(person.getPhoneNumber(), "Phone number cannot be null");
softAssert.assertEquals(person.getAge(), 25, "Age should be equal");
@eliasnogueira
eliasnogueira / AgeTest.java
Last active March 23, 2023 19:53
JUnit 5 - When to use @valuesource: test example
class AgeTest {
@DisplayName("Valid ages")
@ParameterizedTest(name = "{0} is a valid age for the requirement 18 to 30")
@ValueSource(ints = {18, 19, 29, 30})
void validAges(int age) {
Assertions.assertThat(isAgeValid(age)).isTrue();
}
@eliasnogueira
eliasnogueira / Example.java
Created March 23, 2023 17:35
JUnit 5 - When to use @valuesource: code example
public class Example {
private Boolean isAgeValid(int age) {
return age >= 18 && age <= 30 ? Boolean.TRUE : Boolean.FALSE;
}
}
@eliasnogueira
eliasnogueira / modern_testing_tools.md
Last active September 6, 2023 14:51
Modern Testing Tools for Java Developers

Title

Modern Testing Tools for Java Developers

Description

We are, constantly, evolving the codebase by applying the best development practices, approaches, and design patterns. There's a lot of support from frameworks and libraries to do this during the SDLC. New versions of the API framework appear, adding the last trending and here we go again: changing our code to adopt these new things. How awesome it is! We are improving!

How about one of the most important but missed items: quality! matchestalk will show you 5 libraries you, as a Java Developer, to improve the application quality with real-world examples.

@eliasnogueira
eliasnogueira / service-container.yaml
Created January 2, 2023 18:30
Example of a service container
jobs:
build:
runs-on: ubuntu-latest
services:
credit-api:
image: eliasnogueira/combined-credit-api:latest
ports:
- 8088:8088