Skip to content

Commit

Permalink
#285 Solved some codacy problems
Browse files Browse the repository at this point in the history
  • Loading branch information
IsaUlloa committed Aug 26, 2022
1 parent 21c0455 commit 5e9af4b
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ public static Object generateSeq(final String fieldName, final String fieldType,
}

private static Object getFirstValueOrDefaultForType(final List<String> fieldValueList, final String fieldType) {
Object result;
final Object result;
if (!fieldValueList.isEmpty()) {
result = ValueUtils.castValue(fieldValueList.get(0), fieldType);
} else {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,7 @@
import static java.util.Collections.singletonList;

import static org.assertj.core.api.Assertions.assertThat;
import static org.junit.Assert.assertThrows;
import static org.junit.Assert.assertTrue;
import org.junit.jupiter.api.Assertions;

import java.math.BigDecimal;
import java.util.ArrayList;
Expand Down Expand Up @@ -54,17 +53,17 @@ private static Stream<Arguments> parametersForGenerateRandomValueWithList() {
@DisplayName("Testing Generate a Random Value With a List of Values")
@MethodSource("parametersForGenerateRandomValueWithList")
void testGenerateRandomValueWithList(final int size, final List<String> values) {
Exception exception = assertThrows(IllegalArgumentException.class, () -> {
final Exception exception = Assertions.assertThrows(IllegalArgumentException.class, () -> {
final var intList = new ArrayList<>();
final var context = new HashMap<String, Object>();
for (int i=0; i <= size; i++) {
intList.add(RandomSequence.generateSeq("ClientCode", "seq", values, context));
}
});

String expectedMessage = "Sequences do not accept more than one option as initial value";
String actualMessage = exception.getMessage();
final String expectedMessage = "Sequences do not accept more than one option as initial value";
final String actualMessage = exception.getMessage();

assertTrue(actualMessage.contains(expectedMessage));
Assertions.assertTrue(actualMessage.contains(expectedMessage));
}
}

0 comments on commit 5e9af4b

Please sign in to comment.