View SoftAssertionJunit5Test.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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(); |
View SoftAssertionTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 -> { |
View HardAssertionTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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(); |
View SoftAssertTestNGTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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"); |
View AgeTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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(); | |
} | |
View Example.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class Example { | |
private Boolean isAgeValid(int age) { | |
return age >= 18 && age <= 30 ? Boolean.TRUE : Boolean.FALSE; | |
} | |
} |
View modern_testing_tools.md
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 and, sometimes, missed things: quality! How the quality evolves within the adoption of new versions of development frameworks and libraries?
View service-container.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
jobs: | |
build: | |
runs-on: ubuntu-latest | |
services: | |
credit-api: | |
image: eliasnogueira/combined-credit-api:latest | |
ports: | |
- 8088:8088 |
View docker-compose.yml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
version: '3.9' | |
services: | |
wiremock: | |
build: | |
context: ./ | |
dockerfile: Dockerfile | |
image: wiremock-custom | |
container_name: wiremock-credit-restriction-api | |
ports: |
NewerOlder