Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Format tests #168

Merged
merged 1 commit into from
Jan 6, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 3 additions & 6 deletions core/src/test/java/e2e/enricher/enrich/DetalleTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -82,8 +82,7 @@ public void testEnrichIgvTipo() {
@Test
public void testDontEnrichIgvTipo() {
// Given
Invoice input = Invoice
.builder()
Invoice input = Invoice.builder()
.detalle(DocumentoVentaDetalle.builder().igvTipo(Catalog7.INAFECTO_RETIRO.getCode()).build())
.build();

Expand All @@ -102,8 +101,7 @@ public void testDontEnrichIgvTipo() {
@Test
public void testEnrichPrecioReferenciaTipo_PrecioConIgv() {
// Given
Invoice input = Invoice
.builder()
Invoice input = Invoice.builder()
.detalle(DocumentoVentaDetalle.builder().igvTipo(Catalog7.GRAVADO_OPERACION_ONEROSA.getCode()).build())
.build();

Expand All @@ -122,8 +120,7 @@ public void testEnrichPrecioReferenciaTipo_PrecioConIgv() {
@Test
public void testEnrichPrecioReferenciaTipo_ValorReferencial() {
// Given
Invoice input = Invoice
.builder()
Invoice input = Invoice.builder()
.detalle(DocumentoVentaDetalle.builder().igvTipo(Catalog7.GRAVADO_RETIRO_POR_DONACION.getCode()).build())
.build();

Expand Down
15 changes: 5 additions & 10 deletions core/src/test/java/e2e/enricher/enrich/GeneralDocumentTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -102,8 +102,7 @@ public void testEnrichFormaPagoTipo_Contado() {
@Test
public void testEnrichFormaPagoTipo_Credito() {
// Given
Invoice input = Invoice
.builder()
Invoice input = Invoice.builder()
.formaDePago(
FormaDePago
.builder()
Expand All @@ -125,14 +124,12 @@ public void testEnrichFormaPagoTipo_CorrectWrongUserDefinedValue() {
// Given

// Invoice with no "cuotas" has "formaDePago" CREDITO. It must be corrected
Invoice input1 = Invoice
.builder()
Invoice input1 = Invoice.builder()
.formaDePago(FormaDePago.builder().tipo(CatalogContadoCredito.CREDITO.getCode()).build())
.build();

// Invoice with "cuotas" has "formaDePago" CONTADO. It must be corrected
Invoice input2 = Invoice
.builder()
Invoice input2 = Invoice.builder()
.formaDePago(
FormaDePago
.builder()
Expand All @@ -155,8 +152,7 @@ public void testEnrichFormaPagoTipo_CorrectWrongUserDefinedValue() {
@Test
public void testEnrichFirmante() {
// Given
Invoice input = Invoice
.builder()
Invoice input = Invoice.builder()
.proveedor(Proveedor.builder().ruc("12345678912").razonSocial("Mi razón social").build())
.build();

Expand All @@ -172,8 +168,7 @@ public void testEnrichFirmante() {
@Test
public void testEnrichFirmante_whenFirmanteIsPartiallyFilled() {
// Given
Invoice input = Invoice
.builder()
Invoice input = Invoice.builder()
.proveedor(Proveedor.builder().ruc("12345678912").razonSocial("Mi razón social").build())
.firmante(Firmante.builder().ruc("12345678912").build())
.build();
Expand Down
3 changes: 1 addition & 2 deletions core/src/test/java/e2e/enricher/enrich/InvoiceTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,7 @@ public class InvoiceTest extends AbstractTest {
@Test
public void testEnrichTipoComprobante() {
// Given
Invoice input = Invoice
.builder()
Invoice input = Invoice.builder()
.serie("F001-1")
.tipoComprobante(Catalog1_Invoice.BOLETA.getCode()) // This should be overwritten
.build();
Expand Down
157 changes: 62 additions & 95 deletions core/src/test/java/e2e/enricher/process/DetalleTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -33,15 +33,12 @@ public class DetalleTest extends AbstractTest {
@Test
public void testEnrichPrecioDeReferencia_precioConImpuestos_OperacionOnerosa() {
// Given
Invoice input = Invoice
.builder()
.detalle(
DocumentoVentaDetalle
.builder()
.precio(BigDecimal.TEN)
.precioConImpuestos(false)
.igvTipo(Catalog7.GRAVADO_OPERACION_ONEROSA.getCode())
.build()
Invoice input = Invoice.builder()
.detalle(DocumentoVentaDetalle.builder()
.precio(BigDecimal.TEN)
.precioConImpuestos(false)
.igvTipo(Catalog7.GRAVADO_OPERACION_ONEROSA.getCode())
.build()
)
.build();

Expand All @@ -60,15 +57,12 @@ public void testEnrichPrecioDeReferencia_precioConImpuestos_OperacionOnerosa() {
@Test
public void testEnrichPrecioDeReferencia_precioConImpuestos_OperacionNoOnerosa() {
// Given
Invoice input = Invoice
.builder()
.detalle(
DocumentoVentaDetalle
.builder()
.precio(BigDecimal.TEN)
.precioConImpuestos(false)
.igvTipo(Catalog7.GRAVADO_RETIRO.getCode())
.build()
Invoice input = Invoice.builder()
.detalle(DocumentoVentaDetalle.builder()
.precio(BigDecimal.TEN)
.precioConImpuestos(false)
.igvTipo(Catalog7.GRAVADO_RETIRO.getCode())
.build()
)
.build();

Expand All @@ -87,15 +81,12 @@ public void testEnrichPrecioDeReferencia_precioConImpuestos_OperacionNoOnerosa()
@Test
public void testEnrichPrecioDeReferencia_precioSinImpuestos_OperacionOnerosa() {
// Given
Invoice input = Invoice
.builder()
.detalle(
DocumentoVentaDetalle
.builder()
.precio(new BigDecimal("11.80"))
.precioConImpuestos(true)
.igvTipo(Catalog7.GRAVADO_OPERACION_ONEROSA.getCode())
.build()
Invoice input = Invoice.builder()
.detalle(DocumentoVentaDetalle.builder()
.precio(new BigDecimal("11.80"))
.precioConImpuestos(true)
.igvTipo(Catalog7.GRAVADO_OPERACION_ONEROSA.getCode())
.build()
)
.build();

Expand All @@ -114,15 +105,12 @@ public void testEnrichPrecioDeReferencia_precioSinImpuestos_OperacionOnerosa() {
@Test
public void testEnrichPrecioDeReferencia_precioSinImpuestos_OperacionNoOnerosa() {
// Given
Invoice input = Invoice
.builder()
.detalle(
DocumentoVentaDetalle
.builder()
.precio(new BigDecimal("11.80"))
.precioConImpuestos(true)
.igvTipo(Catalog7.GRAVADO_RETIRO.getCode())
.build()
Invoice input = Invoice.builder()
.detalle(DocumentoVentaDetalle.builder()
.precio(new BigDecimal("11.80"))
.precioConImpuestos(true)
.igvTipo(Catalog7.GRAVADO_RETIRO.getCode())
.build()
)
.build();

Expand Down Expand Up @@ -158,8 +146,7 @@ public void testEnrichIcb() {
@Test
public void testDontEnrichIcb() {
// Given
Invoice input = Invoice
.builder()
Invoice input = Invoice.builder()
.detalle(DocumentoVentaDetalle.builder().icb(BigDecimal.TEN).icbAplica(false).build())
.build();

Expand All @@ -178,14 +165,11 @@ public void testDontEnrichIcb() {
@Test
public void testEnrichIcbAplica() {
// Given
Invoice input = Invoice
.builder()
.detalle(
DocumentoVentaDetalle
.builder()
.icb(BigDecimal.TEN)
.icbAplica(false) // this should be corrected
.build()
Invoice input = Invoice.builder()
.detalle(DocumentoVentaDetalle.builder()
.icb(BigDecimal.TEN)
.icbAplica(false) // this should be corrected
.build()
)
.build();

Expand All @@ -204,15 +188,12 @@ public void testEnrichIcbAplica() {
@Test
public void testEnrichBaseImponible_whenPrecioConImpuestos() {
// Given
Invoice input = Invoice
.builder()
.detalle(
DocumentoVentaDetalle
.builder()
.cantidad(new BigDecimal(2))
.precio(BigDecimal.TEN)
.precioConImpuestos(false)
.build()
Invoice input = Invoice.builder()
.detalle(DocumentoVentaDetalle.builder()
.cantidad(new BigDecimal(2))
.precio(BigDecimal.TEN)
.precioConImpuestos(false)
.build()
)
.build();

Expand All @@ -231,15 +212,12 @@ public void testEnrichBaseImponible_whenPrecioConImpuestos() {
@Test
public void testEnrichBaseImponible_whenPrecioSinImpuestos() {
// Given
Invoice input = Invoice
.builder()
.detalle(
DocumentoVentaDetalle
.builder()
.cantidad(new BigDecimal(2))
.precio(new BigDecimal("11.8"))
.precioConImpuestos(true)
.build()
Invoice input = Invoice.builder()
.detalle(DocumentoVentaDetalle.builder()
.cantidad(new BigDecimal(2))
.precio(new BigDecimal("11.8"))
.precioConImpuestos(true)
.build()
)
.build();

Expand All @@ -258,16 +236,13 @@ public void testEnrichBaseImponible_whenPrecioSinImpuestos() {
@Test
public void testDontEnrichBaseImponible() {
// Given
Invoice input = Invoice
.builder()
.detalle(
DocumentoVentaDetalle
.builder()
.cantidad(new BigDecimal(2))
.precio(new BigDecimal("10"))
.precioConImpuestos(false)
.igvBaseImponible(new BigDecimal(999)) // This user defined value should not be altered
.build()
Invoice input = Invoice.builder()
.detalle(DocumentoVentaDetalle.builder()
.cantidad(new BigDecimal(2))
.precio(new BigDecimal("10"))
.precioConImpuestos(false)
.igvBaseImponible(new BigDecimal(999)) // This user defined value should not be altered
.build()
)
.build();

Expand All @@ -286,8 +261,7 @@ public void testDontEnrichBaseImponible() {
@Test
public void testEnrichIgv() {
// Given
Invoice input = Invoice
.builder()
Invoice input = Invoice.builder()
.tasaIgv(new BigDecimal("0.18"))
.detalle(DocumentoVentaDetalle.builder().igvBaseImponible(new BigDecimal("10")).build())
.build();
Expand All @@ -307,15 +281,12 @@ public void testEnrichIgv() {
@Test
public void testDontEnrichIgv() {
// Given
Invoice input = Invoice
.builder()
Invoice input = Invoice.builder()
.tasaIgv(new BigDecimal("0.18"))
.detalle(
DocumentoVentaDetalle
.builder()
.igvBaseImponible(new BigDecimal("10"))
.igv(new BigDecimal("999")) // Dont change user defined value
.build()
.detalle(DocumentoVentaDetalle.builder()
.igvBaseImponible(new BigDecimal("10"))
.igv(new BigDecimal("999")) // Dont change user defined value
.build()
)
.build();

Expand All @@ -334,8 +305,7 @@ public void testDontEnrichIgv() {
@Test
public void testEnrichTotalImpuestos() {
// Given
Invoice input = Invoice
.builder()
Invoice input = Invoice.builder()
.detalle(DocumentoVentaDetalle.builder().igv(new BigDecimal("10")).icb(new BigDecimal("2")).build())
.build();

Expand All @@ -354,15 +324,12 @@ public void testEnrichTotalImpuestos() {
@Test
public void testDontEnrichTotalImpuestos() {
// Given
Invoice input = Invoice
.builder()
.detalle(
DocumentoVentaDetalle
.builder()
.igv(new BigDecimal("10"))
.icb(new BigDecimal("2"))
.totalImpuestos(new BigDecimal("999")) // Dont change user defined value
.build()
Invoice input = Invoice.builder()
.detalle(DocumentoVentaDetalle.builder()
.igv(new BigDecimal("10"))
.icb(new BigDecimal("2"))
.totalImpuestos(new BigDecimal("999")) // Dont change user defined value
.build()
)
.build();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,37 +38,34 @@ public class CreditNoteOrdenDeCompraTest extends AbstractTest {
@Test
public void testInvoiceWithCustomUnidadMedida() throws Exception {
// Given
CreditNote input = CreditNote
.builder()
CreditNote input = CreditNote.builder()
.serie("FC01")
.numero(1)
.comprobanteAfectadoSerieNumero("F001-1")
.sustentoDescripcion("mi sustento")
.ordenDeCompra("123456")
.proveedor(Proveedor.builder().ruc("12345678912").razonSocial("Softgreen S.A.C.").build())
.cliente(
Cliente
.builder()
.nombre("Carlos Feria")
.numeroDocumentoIdentidad("12121212121")
.tipoDocumentoIdentidad(Catalog6.RUC.toString())
.build()
.proveedor(Proveedor.builder()
.ruc("12345678912")
.razonSocial("Softgreen S.A.C.")
.build()
)
.detalle(
DocumentoVentaDetalle
.builder()
.descripcion("Item1")
.cantidad(new BigDecimal("10"))
.precio(new BigDecimal("100"))
.build()
.cliente(Cliente.builder()
.nombre("Carlos Feria")
.numeroDocumentoIdentidad("12121212121")
.tipoDocumentoIdentidad(Catalog6.RUC.toString())
.build()
)
.detalle(
DocumentoVentaDetalle
.builder()
.descripcion("Item2")
.cantidad(new BigDecimal("10"))
.precio(new BigDecimal("100"))
.build()
.detalle(DocumentoVentaDetalle.builder()
.descripcion("Item1")
.cantidad(new BigDecimal("10"))
.precio(new BigDecimal("100"))
.build()
)
.detalle(DocumentoVentaDetalle.builder()
.descripcion("Item2")
.cantidad(new BigDecimal("10"))
.precio(new BigDecimal("100"))
.build()
)
.build();

Expand Down
Loading