• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

wmixvideo / nfe / #6582

17 Jul 2025 09:30PM UTC coverage: 51.231% (+24.2%) from 26.996%
#6582

push

web-flow
Adequação do mapeamento de infLocalCarrega e infLocalDescarrega ao xs:choice do schema MDF-e (#1054)

* Adequação do mapeamento de infLocalCarrega e infLocalDescarrega ao xs:choice do schema MDF-e

* Adequação do mapeamento de infLocalCarrega e infLocalDescarrega ao xs:choice do schema MDF-e

14006 of 27339 relevant lines covered (51.23%)

0.51 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

0.0
/src/main/java/com/fincatto/documentofiscal/cte300/parsers/CTChaveParser.java
1
package com.fincatto.documentofiscal.cte300.parsers;
2

3
import com.fincatto.documentofiscal.DFModelo;
4
import com.fincatto.documentofiscal.DFUnidadeFederativa;
5
import com.fincatto.documentofiscal.cte.CTTipoEmissao;
6

7
import org.apache.commons.lang3.StringUtils;
8

9
import java.time.LocalDate;
10

11
public class CTChaveParser {
12

13
    private final String chave;
14

15
    public CTChaveParser(final String chave) {
×
16
        this.chave = StringUtils.stripToEmpty(chave).replaceAll("\\D", "");
×
17
        if (this.chave.length() != 44) {
×
18
            throw new IllegalArgumentException(String.format("A chave deve ter exatos 44 caracteres numericos: %s", chave));
×
19
        }
20
    }
×
21

22
    public String getChave() {
23
        return chave;
×
24
    }
25

26
    public DFUnidadeFederativa getNFUnidadeFederativa() {
27
        return DFUnidadeFederativa.valueOfCodigo(this.chave.substring(0, 2));
×
28
    }
29

30
    public LocalDate getDataEmissao() {
31
        return LocalDate.of(this.getDataEmissaoAno(), this.getDataEmissaoMes(), 1);
×
32
    }
33

34
    private int getDataEmissaoMes() {
35
        return Integer.parseInt(this.chave.substring(4, 6));
×
36
    }
37

38
    private int getDataEmissaoAno() {
39
        return 2000 + Integer.parseInt(this.chave.substring(2, 4));
×
40
    }
41

42
    public String getCnpjEmitente() {
43
        return this.chave.substring(6, 20);
×
44
    }
45

46
    public DFModelo getModelo() {
47
        return DFModelo.valueOfCodigo(this.chave.substring(20, 22));
×
48
    }
49

50
    public String getSerie() {
51
        return this.chave.substring(22, 25);
×
52
    }
53

54
    public String getNumero() {
55
        return this.chave.substring(25, 34);
×
56
    }
57

58
    public CTTipoEmissao getFormaEmissao() {
59
        return CTTipoEmissao.valueOfCodigo(this.chave.substring(34, 35));
×
60
    }
61

62
    public String getCodigoNumerico() {
63
        return this.chave.substring(35, 43);
×
64
    }
65

66
    public String getDV() {
67
        return this.chave.substring(43, 44);
×
68
    }
69

70
    public boolean isEmitidaContingenciaSCAN() {
71
        return this.getSerie().matches("9[0-9]{2}");
×
72
    }
73

74
    public boolean isEmitidaContingenciaSCVSP() {
75
        return this.chave.matches("\\d{34}6\\d{9}");
×
76
    }
77

78
    public boolean isEmitidaContingenciaSCVRS() {
79
        return this.chave.matches("\\d{34}7\\d{9}");
×
80
    }
81

82
    public String getFormatado() {
83
        return this.chave.replaceFirst("(\\d{4})(\\d{4})(\\d{4})(\\d{4})(\\d{4})(\\d{4})(\\d{4})(\\d{4})(\\d{4})(\\d{4})(\\d{4})", "$1 $2 $3 $4 $5 $6 $7 $8 $9 $10 $11");
×
84
    }
85
}
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc