diff --git a/.github/workflows/maven.yml b/.github/workflows/maven.yml index fb15566..bb97a0e 100644 --- a/.github/workflows/maven.yml +++ b/.github/workflows/maven.yml @@ -28,5 +28,7 @@ jobs: - name: Build with Maven run: mvn clean verify - - name: Upload codecov report - uses: codecov/codecov-action@v3 + - name: Upload coverage to Codecov + uses: codecov/codecov-action@v5 + env: + CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }} diff --git a/pom.xml b/pom.xml index 5001389..2fbcaa4 100644 --- a/pom.xml +++ b/pom.xml @@ -87,16 +87,6 @@ - - - repo-bridge - https://repositorio.bridge.ufsc.br/repository/snapshots/ - - - ossrh - https://oss.sonatype.org/service/local/staging/deploy/maven2/ - - @@ -216,14 +206,12 @@ - org.sonatype.plugins - nexus-staging-maven-plugin - 1.6.13 + org.sonatype.central + central-publishing-maven-plugin + 0.9.0 true - ossrh - https://oss.sonatype.org/ - true + central diff --git a/src/main/java/br/ufsc/bridge/platform/validation/rules/CnsRule.java b/src/main/java/br/ufsc/bridge/platform/validation/rules/CnsRule.java index f95a6ce..8045531 100644 --- a/src/main/java/br/ufsc/bridge/platform/validation/rules/CnsRule.java +++ b/src/main/java/br/ufsc/bridge/platform/validation/rules/CnsRule.java @@ -6,7 +6,7 @@ public class CnsRule implements Rule { private final static String CNS1 = "^[1-2][0-9]{10}00[0-1][0-9]$"; - private final static String CNS2 = "^[7-9][0-9]{14}$"; + private final static String CNS2 = "^[57-9][0-9]{14}$"; @Override public String validate(String value) { if (!Util.isEmpty(value) && !this.isValid(value)) { diff --git a/src/main/script/rules/cns.ts b/src/main/script/rules/cns.ts index 95f7593..cbfc70c 100644 --- a/src/main/script/rules/cns.ts +++ b/src/main/script/rules/cns.ts @@ -3,7 +3,7 @@ import { msg } from '..' import { length } from './length' const CNS1 = '^[1-2][0-9]{10}00[0-1][0-9]$' -const CNS2 = '^[7-9][0-9]{14}$' +const CNS2 = '^[57-9][0-9]{14}$' function somaPonderada(cnsValue: string) { let soma = 0 diff --git a/src/test/java/br/ufsc/bridge/platform/validation/rules/CnsTest.java b/src/test/java/br/ufsc/bridge/platform/validation/rules/CnsTest.java index 7fb355c..35eebc7 100644 --- a/src/test/java/br/ufsc/bridge/platform/validation/rules/CnsTest.java +++ b/src/test/java/br/ufsc/bridge/platform/validation/rules/CnsTest.java @@ -18,6 +18,8 @@ public void testarRequired() { public void testarValorDeCns() { Assert.assertNull("975055825130003 é um Cns válido", this.validate("975055825130003", Rules.cns)); + Assert.assertNull("586309087428878 é um Cns válido", this.validate("586309087428878", Rules.cns)); + Assert.assertNull("118725165660004 é um Cns válido", this.validate("118725165660004", Rules.cns)); Assert.assertNull("218342347130008 é um Cns válido", this.validate("218342347130008", Rules.cns)); @@ -30,6 +32,8 @@ public void testarValorDeCns() { Assert.assertNotNull("O Cns é invalido", this.validate("109878998754646", Rules.cns)); + Assert.assertNotNull("O Cns é invalido", this.validate("594516874912612", Rules.cns)); + Assert.assertNotNull("O Cns é invalido", this.validate("236951545487965", Rules.cns)); Assert.assertNotNull("O Cns é invalido", this.validate("478976532213336", Rules.cns)); @@ -46,8 +50,6 @@ public void testarValorDeCns() { Assert.assertNotNull("O Cns não pode comeaçar com 4", this.validate("431439904710009", Rules.cns)); - Assert.assertNotNull("O Cns não pode comeaçar com 5", this.validate("562593396660002", Rules.cns)); - Assert.assertNotNull("O Cns não pode comeaçar com 6", this.validate("667429114440003", Rules.cns)); Assert.assertNotNull("111111111111111 não é um Cns válido", this.validate("111111111111111", Rules.cns));