BAEL-5760: Creating a separate mocks-2 module (#12882)
This commit is contained in:
@@ -1,19 +0,0 @@
|
||||
package com.baeldung.datafaker;
|
||||
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
import static org.assertj.core.api.Assertions.assertThat;
|
||||
import static org.junit.jupiter.api.Assertions.assertAll;
|
||||
|
||||
class CollectionUnitTest {
|
||||
|
||||
@Test
|
||||
void whenGettingFictionaCharacters_thenResultNotEmptyAndOfCorrectSize() {
|
||||
assertAll(
|
||||
() -> assertThat(Collection.getFictionalCharacters()).isNotEmpty(),
|
||||
() -> assertThat(Collection.getFictionalCharacters()).size().isGreaterThanOrEqualTo(Collection.MIN),
|
||||
() -> assertThat(Collection.getFictionalCharacters()).size().isLessThanOrEqualTo(Collection.MAX)
|
||||
);
|
||||
|
||||
}
|
||||
}
|
||||
@@ -1,27 +0,0 @@
|
||||
package com.baeldung.datafaker;
|
||||
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
import static org.assertj.core.api.Assertions.assertThat;
|
||||
import static org.junit.jupiter.api.Assertions.assertAll;
|
||||
|
||||
class CsvUnitTest {
|
||||
|
||||
@Test
|
||||
void whenGettingFirstExpression_thenResultNotEmptyAndOfCorrectSizeAndFormat() {
|
||||
assertAll(
|
||||
() -> assertThat(Csv.getFirstExpression()).isNotBlank(),
|
||||
() -> assertThat(Csv.getFirstExpression().split("\n")).hasSize(5),
|
||||
() -> assertThat(Csv.getFirstExpression().split("\n")[0]).isEqualTo("\"name_column\",\"last_name_column\"")
|
||||
);
|
||||
}
|
||||
|
||||
@Test
|
||||
void whenGettingSecondExpression_thenResultNotEmptyAndOfCorrectSizeAndFormat() {
|
||||
assertAll(
|
||||
() -> assertThat(Csv.getFirstExpression()).isNotBlank(),
|
||||
() -> assertThat(Csv.getFirstExpression().split("\n")).hasSize(5),
|
||||
() -> assertThat(Csv.getFirstExpression().split("\n")[0]).isEqualTo("\"name_column\",\"last_name_column\"")
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -1,26 +0,0 @@
|
||||
package com.baeldung.datafaker;
|
||||
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
import static org.assertj.core.api.Assertions.assertThat;
|
||||
import static org.junit.jupiter.api.Assertions.*;
|
||||
|
||||
class ExamplifyUnitTest {
|
||||
|
||||
@Test
|
||||
void whenGettingNumberExpression_thenResultNotEmptyAndMathesRegex() {
|
||||
assertAll(
|
||||
() -> assertThat(Examplify.getNumberExpression()).isNotBlank(),
|
||||
() -> assertThat(Examplify.getNumberExpression()).matches("\\d{3}-\\d{3}-\\d{3}")
|
||||
);
|
||||
}
|
||||
|
||||
@Test
|
||||
void whenGettingExpression_thenResultNotEmptyAndMathesRegex() {
|
||||
assertAll(
|
||||
() -> assertThat(Examplify.getExpression()).isNotBlank(),
|
||||
() -> assertThat(Examplify.getExpression())
|
||||
.matches("[A-Z][a-z]{2} [a-z]{2} [a-z]{3} [A-Z][a-z]{2}")
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -1,21 +0,0 @@
|
||||
package com.baeldung.datafaker;
|
||||
|
||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
import static org.assertj.core.api.Assertions.assertThat;
|
||||
import static org.assertj.core.api.Assertions.assertThatNoException;
|
||||
import static org.junit.jupiter.api.Assertions.*;
|
||||
|
||||
class JsonUnitTest {
|
||||
|
||||
private static final ObjectMapper objectMapper = new ObjectMapper();
|
||||
|
||||
@Test
|
||||
void whenGettingJsonExpression_thenResultIsValidJson() {
|
||||
assertAll(
|
||||
() -> assertThatNoException().isThrownBy(() -> objectMapper.readTree(Json.getExpression())),
|
||||
() -> assertThat(Json.getExpression()).isNotBlank()
|
||||
);
|
||||
}
|
||||
}
|
||||
-18
@@ -1,18 +0,0 @@
|
||||
package com.baeldung.datafaker;
|
||||
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
import static org.assertj.core.api.Assertions.assertThat;
|
||||
|
||||
class MethodInvocationUnitTest {
|
||||
|
||||
@Test
|
||||
void whenGettingNameFromExpression_thenResultNotEmpty() {
|
||||
assertThat(MethodInvocation.getNameFromMethod()).isNotBlank();
|
||||
}
|
||||
|
||||
@Test
|
||||
void whenGettingNameFromMethod_thenResultNotEmpty() {
|
||||
assertThat(MethodInvocation.getNameFromExpression()).isNotBlank();
|
||||
}
|
||||
}
|
||||
-23
@@ -1,23 +0,0 @@
|
||||
package com.baeldung.datafaker;
|
||||
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
import java.time.Duration;
|
||||
|
||||
import static org.assertj.core.api.Assertions.assertThat;
|
||||
|
||||
class MethodInvocationWithParamsUnitTest {
|
||||
|
||||
@Test
|
||||
void whenGettingDurationFromExpression_thenResultNotEmpty() {
|
||||
assertThat(MethodInvocationWithParams.getDurationFromExpression()).isNotBlank();
|
||||
}
|
||||
|
||||
@Test
|
||||
void whenGettingDurationFromMethod_thenResultNotNullAndInBoundaries() {
|
||||
assertThat(MethodInvocationWithParams.getDurationFromMethod())
|
||||
.isNotNull()
|
||||
.isBetween(Duration.ofSeconds(MethodInvocationWithParams.MIN),
|
||||
Duration.ofSeconds(MethodInvocationWithParams.MAX));
|
||||
}
|
||||
}
|
||||
-18
@@ -1,18 +0,0 @@
|
||||
package com.baeldung.datafaker;
|
||||
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
import static org.assertj.core.api.Assertions.assertThat;
|
||||
import static org.junit.jupiter.api.Assertions.assertAll;
|
||||
|
||||
class MixedCollectionUnitTest {
|
||||
|
||||
@Test
|
||||
void whenGettingMixedCollection_thenResultNotEmptyAndOfCorrectSize() {
|
||||
assertAll(
|
||||
() -> assertThat(MixedCollection.getMixedCollection()).isNotEmpty(),
|
||||
() -> assertThat(MixedCollection.getMixedCollection()).size().isGreaterThanOrEqualTo(MixedCollection.MIN),
|
||||
() -> assertThat(MixedCollection.getMixedCollection()).size().isLessThanOrEqualTo(MixedCollection.MAX)
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -1,25 +0,0 @@
|
||||
package com.baeldung.datafaker;
|
||||
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
import static org.assertj.core.api.Assertions.assertThat;
|
||||
|
||||
class OptionUnitTest {
|
||||
@Test
|
||||
void whenGettingThirdExpression_thenResultNotBlankAndMatchesRegex() {
|
||||
assertThat(Option.getThirdExpression()).isNotBlank()
|
||||
.matches("(Hi|Hello|Hey)");
|
||||
}
|
||||
|
||||
@Test
|
||||
void whenGettingSecondExpression_thenResultNotBlankAndMatchesRegex() {
|
||||
assertThat(Option.getSecondExpression()).isNotBlank()
|
||||
.matches("(1|2|3|4|\\*)");
|
||||
}
|
||||
|
||||
@Test
|
||||
void whenGettingFirstExpression_thenResultNotBlankAndMatchesRegex() {
|
||||
assertThat(Option.getFirstExpression()).isNotBlank()
|
||||
.matches("(Hi|Hello|Hey)");
|
||||
}
|
||||
}
|
||||
@@ -1,20 +0,0 @@
|
||||
package com.baeldung.datafaker;
|
||||
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
import static org.assertj.core.api.Assertions.assertThat;
|
||||
|
||||
class RegexifyUnitTest {
|
||||
|
||||
@Test
|
||||
void whenGettingMethidExpression_thenResultNotBlankAndMatchesRegex() {
|
||||
assertThat(Regexify.getMethodExpression()).isNotBlank()
|
||||
.matches("[A-D]{4,10}");
|
||||
}
|
||||
|
||||
@Test
|
||||
void whenGettingExpression_thenResultNotBlankAndMatchesRegex() {
|
||||
assertThat(Regexify.getExpression()).isNotBlank()
|
||||
.matches("(hello|bye|hey)");
|
||||
}
|
||||
}
|
||||
@@ -1,19 +0,0 @@
|
||||
package com.baeldung.datafaker;
|
||||
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
import static org.assertj.core.api.Assertions.assertThat;
|
||||
|
||||
class TemplatifyUnitTest {
|
||||
@Test
|
||||
void whenGettingPlaceholderExpression_thenResultNotBlankAndMatchesRegex() {
|
||||
assertThat(Templatify.getExpressionWithPlaceholder()).isNotBlank()
|
||||
.matches(".ight");
|
||||
}
|
||||
|
||||
@Test
|
||||
void whenGettingExpression_thenResultNotBlankAndMatchesRegex() {
|
||||
assertThat(Templatify.getExpression()).isNotBlank()
|
||||
.matches(".es.");
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user