Skip to content

Commit

Permalink
Merge branch 'SRU2024' into CU-86b1g1mye_SRU2024_Generar-un-enum-de-F…
Browse files Browse the repository at this point in the history
…ieldNames-para-validar-que-el-Field-exista
  • Loading branch information
zubri authored Sep 30, 2024
2 parents b6c99c0 + de92a77 commit 8072676
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 23 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/codeql.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ on:
push:
branches: [ "main", "CU-*", "SRU*" ]
pull_request:
branches: [ "main", "SRU*" ]
branches: [ "main" ]
schedule:
- cron: "59 12 * * 2"

Expand Down
2 changes: 1 addition & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# Prowide Core - CHANGELOG

#### 9.5.2 - SNAPSHOT
* Added new FieldEnum with all the available field names
* Added new `FieldEnum` with all the available field names

#### 9.5.1 - June 2024
* (PW-1913) Added IBAN validation for Egypt local account structure
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,9 +61,6 @@ public enum FieldEnum {
F14N,
F14O,
F14J,
F14P,
F14Q,
F14R,
F14S,
F15A,
F15B,
Expand All @@ -83,10 +80,8 @@ public enum FieldEnum {
F15P,
F16A,
F16C,
F16D,
F16R,
F16S,
F16W,
F17A,
F17B,
F17C,
Expand Down Expand Up @@ -147,6 +142,7 @@ public enum FieldEnum {
F22F,
F22G,
F22H,
F22J,
F22K,
F22L,
F22M,
Expand Down Expand Up @@ -208,6 +204,7 @@ public enum FieldEnum {
F29H,
F29I,
F29J,
F29K,
F29L,
F29M,
F29N,
Expand All @@ -216,14 +213,11 @@ public enum FieldEnum {
F29S,
F29T,
F29U,
F29Q,
F29W,
F30F,
F30G,
F30H,
F30I,
F30J,
F30K,
F30M,
F30N,
F30P,
Expand Down Expand Up @@ -326,7 +320,9 @@ public enum FieldEnum {
F37L,
F37M,
F37N,
F37P,
F37R,
F37U,
F37V,
F38A,
F38D,
Expand All @@ -337,6 +333,7 @@ public enum FieldEnum {
F39A,
F39B,
F39C,
F39D,
F39E,
F39F,
F39M,
Expand All @@ -363,6 +360,7 @@ public enum FieldEnum {
F44D,
F44E,
F44F,
F44H,
F44J,
F45A,
F45B,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,23 +3,21 @@
import static org.junit.jupiter.api.Assertions.*;

import org.junit.jupiter.api.Test;
import org.junit.jupiter.params.ParameterizedTest;
import org.junit.jupiter.params.provider.CsvSource;

class FieldEnumTest {
class FieldEnu5mTest {

@Test
void testfieldName() {
// Validate that fieldName returns the correct value
assertEquals("11A", FieldEnum.F11A.fieldName());
assertEquals("14P", FieldEnum.F14P.fieldName());
assertEquals("30K", FieldEnum.F30K.fieldName());
@ParameterizedTest
@CsvSource({"F11A,11A", "F22J,22J", "F44H,44H"})
void testFieldName(FieldEnum field, String expectedName) {
assertEquals(expectedName, field.fieldName());
}

@Test
void testfromFieldNameValid() {
// Validate that fromFieldName returns the correct enum when a valid code is provided
assertEquals(FieldEnum.F11A, FieldEnum.fromFieldName("11A"));
assertEquals(FieldEnum.F14R, FieldEnum.fromFieldName("14R"));
assertEquals(FieldEnum.F30K, FieldEnum.fromFieldName("30K"));
@ParameterizedTest
@CsvSource({"11A,F11A", "22J,F22J", "44H,F44H"})
void testFromFieldNameValid(String fieldName, FieldEnum expectedEnum) {
assertEquals(expectedEnum, FieldEnum.fromFieldName(fieldName));
}

@Test
Expand All @@ -36,6 +34,9 @@ void testfromFieldNameEdgeCases() {
assertNull(FieldEnum.fromFieldName("11a")); // should return null because "11a" is lowercase
assertNull(FieldEnum.fromFieldName(" 11A")); // should return null because of the leading space
assertNull(FieldEnum.fromFieldName("11A ")); // should return null because of the trailing space
assertNull(FieldEnum.fromFieldName(null)); // Test null input
assertNull(FieldEnum.fromFieldName("11")); // Test partial field name
assertNull(FieldEnum.fromFieldName("111A")); // Test invalid format with correct length
}

@Test
Expand Down

0 comments on commit 8072676

Please sign in to comment.