Skip to content

Commit

Permalink
Homologacion add tests (#188)
Browse files Browse the repository at this point in the history
  • Loading branch information
carlosthe19916 authored Feb 2, 2023
1 parent b3efe9d commit 8e05992
Show file tree
Hide file tree
Showing 8 changed files with 2,395 additions and 0 deletions.
181 changes: 181 additions & 0 deletions core/src/test/java/e2e/homologacion/Group5Test.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,181 @@
/*
* Copyright 2019 Project OpenUBL, Inc. and/or its affiliates
* and other contributors as indicated by the @author tags.
*
* Licensed under the Apache License - 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package e2e.homologacion;

import e2e.AbstractTest;
import io.github.project.openubl.xbuilder.content.models.standard.general.CreditNote;
import io.github.project.openubl.xbuilder.content.models.standard.general.DebitNote;
import io.github.project.openubl.xbuilder.content.models.standard.general.DocumentoVentaDetalle;
import io.github.project.openubl.xbuilder.content.models.standard.general.Invoice;
import org.junit.jupiter.api.Order;
import org.junit.jupiter.api.Test;

import java.math.BigDecimal;

public class Group5Test extends AbstractTest {

@Order(1)
@Test
public void factura1Con5Items() throws Exception {
Invoice input = Invoice.builder()
.serie("FF30")
.numero(1)
.proveedor(HomologacionConstants.proveedor)
.cliente(HomologacionConstants.cliente)
.detalle(DocumentoVentaDetalle.builder()
.descripcion("Item1")
.cantidad(new BigDecimal("1"))
.precio(new BigDecimal("100"))
.tasaIsc(new BigDecimal("0.1"))
.build()
)
.detalle(DocumentoVentaDetalle.builder()
.descripcion("Item2")
.cantidad(new BigDecimal("2"))
.precio(new BigDecimal("200"))
.tasaIsc(new BigDecimal("0.1"))
.build()
)
.detalle(DocumentoVentaDetalle.builder()
.descripcion("Item3")
.cantidad(new BigDecimal("3"))
.precio(new BigDecimal("300"))
.tasaIsc(new BigDecimal("0.1"))
.build()
)
.detalle(DocumentoVentaDetalle.builder()
.descripcion("Item4")
.cantidad(new BigDecimal("4"))
.precio(new BigDecimal("400"))
.tasaIsc(new BigDecimal("0.1"))
.build()
)
.detalle(DocumentoVentaDetalle.builder()
.descripcion("Item5")
.cantidad(new BigDecimal("5"))
.precio(new BigDecimal("500"))
.tasaIsc(new BigDecimal("0.1"))
.build()
)
.build();

assertInput(input, "factura1Con5Items.xml");
}

//

@Order(2)
@Test
public void notaDeCreditoDeFactura1() throws Exception {
CreditNote input = CreditNote.builder()
.serie("FF30")
.numero(1)
.comprobanteAfectadoSerieNumero("FF30-1")
.sustentoDescripcion("Homologacion")
.proveedor(HomologacionConstants.proveedor)
.cliente(HomologacionConstants.cliente)
.detalle(DocumentoVentaDetalle.builder()
.descripcion("Item1")
.cantidad(new BigDecimal("1"))
.precio(new BigDecimal("100"))
.tasaIsc(new BigDecimal("0.1"))
.build()
)
.detalle(DocumentoVentaDetalle.builder()
.descripcion("Item2")
.cantidad(new BigDecimal("2"))
.precio(new BigDecimal("200"))
.tasaIsc(new BigDecimal("0.1"))
.build()
)
.detalle(DocumentoVentaDetalle.builder()
.descripcion("Item3")
.cantidad(new BigDecimal("3"))
.precio(new BigDecimal("300"))
.tasaIsc(new BigDecimal("0.1"))
.build()
)
.detalle(DocumentoVentaDetalle.builder()
.descripcion("Item4")
.cantidad(new BigDecimal("4"))
.precio(new BigDecimal("400"))
.tasaIsc(new BigDecimal("0.1"))
.build()
)
.detalle(DocumentoVentaDetalle.builder()
.descripcion("Item5")
.cantidad(new BigDecimal("5"))
.precio(new BigDecimal("500"))
.tasaIsc(new BigDecimal("0.1"))
.build()
)
.build();

assertInput(input, "notaDeCreditoDeFactura1.xml");
}

@Order(3)
@Test
public void notaDeDebitoDeFactura1() throws Exception {
DebitNote input = DebitNote.builder()
.serie("FF30")
.numero(1)
.comprobanteAfectadoSerieNumero("FF30-1")
.sustentoDescripcion("Homologacion")
.proveedor(HomologacionConstants.proveedor)
.cliente(HomologacionConstants.cliente)
.detalle(DocumentoVentaDetalle.builder()
.descripcion("Item1")
.cantidad(new BigDecimal("1"))
.precio(new BigDecimal("100"))
.tasaIsc(new BigDecimal("0.1"))
.build()
)
.detalle(DocumentoVentaDetalle.builder()
.descripcion("Item2")
.cantidad(new BigDecimal("2"))
.precio(new BigDecimal("200"))
.tasaIsc(new BigDecimal("0.1"))
.build()
)
.detalle(DocumentoVentaDetalle.builder()
.descripcion("Item3")
.cantidad(new BigDecimal("3"))
.precio(new BigDecimal("300"))
.tasaIsc(new BigDecimal("0.1"))
.build()
)
.detalle(DocumentoVentaDetalle.builder()
.descripcion("Item4")
.cantidad(new BigDecimal("4"))
.precio(new BigDecimal("400"))
.tasaIsc(new BigDecimal("0.1"))
.build()
)
.detalle(DocumentoVentaDetalle.builder()
.descripcion("Item5")
.cantidad(new BigDecimal("5"))
.precio(new BigDecimal("500"))
.tasaIsc(new BigDecimal("0.1"))
.build()
)
.build();

assertInput(input, "notaDeDebitoDeFactura2.xml");
}

}
182 changes: 182 additions & 0 deletions core/src/test/java/e2e/homologacion/Group7Test.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,182 @@
/*
* Copyright 2019 Project OpenUBL, Inc. and/or its affiliates
* and other contributors as indicated by the @author tags.
*
* Licensed under the Apache License - 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package e2e.homologacion;

import e2e.AbstractTest;
import io.github.project.openubl.xbuilder.content.models.standard.general.CreditNote;
import io.github.project.openubl.xbuilder.content.models.standard.general.DebitNote;
import io.github.project.openubl.xbuilder.content.models.standard.general.DocumentoVentaDetalle;
import io.github.project.openubl.xbuilder.content.models.standard.general.Invoice;
import org.junit.jupiter.api.Order;
import org.junit.jupiter.api.Test;

import java.math.BigDecimal;

public class Group7Test extends AbstractTest {

@Order(1)
@Test
public void factura1Con5Items() throws Exception {
Invoice input = Invoice.builder()
.serie("FF50")
.numero(1)
.moneda("USD")
.proveedor(HomologacionConstants.proveedor)
.cliente(HomologacionConstants.cliente)
.detalle(DocumentoVentaDetalle.builder()
.descripcion("Item1")
.cantidad(new BigDecimal("1"))
.precio(new BigDecimal("100"))
.tasaIsc(new BigDecimal("0.1"))
.build()
)
.detalle(DocumentoVentaDetalle.builder()
.descripcion("Item2")
.cantidad(new BigDecimal("2"))
.precio(new BigDecimal("200"))
.tasaIsc(new BigDecimal("0.1"))
.build()
)
.detalle(DocumentoVentaDetalle.builder()
.descripcion("Item3")
.cantidad(new BigDecimal("3"))
.precio(new BigDecimal("300"))
.tasaIsc(new BigDecimal("0.1"))
.build()
)
.detalle(DocumentoVentaDetalle.builder()
.descripcion("Item4")
.cantidad(new BigDecimal("4"))
.precio(new BigDecimal("400"))
.tasaIsc(new BigDecimal("0.1"))
.build()
)
.detalle(DocumentoVentaDetalle.builder()
.descripcion("Item5")
.cantidad(new BigDecimal("5"))
.precio(new BigDecimal("500"))
.tasaIsc(new BigDecimal("0.1"))
.build()
)
.build();

assertInput(input, "factura1Con5Items.xml");
}

@Order(2)
@Test
public void notaDeCreditoDeFactura1() throws Exception {
CreditNote input = CreditNote.builder()
.serie("FF50")
.numero(1)
.moneda("USD")
.comprobanteAfectadoSerieNumero("FF50-1")
.sustentoDescripcion("Homologacion")
.proveedor(HomologacionConstants.proveedor)
.cliente(HomologacionConstants.cliente)
.detalle(DocumentoVentaDetalle.builder()
.descripcion("Item1")
.cantidad(new BigDecimal("1"))
.precio(new BigDecimal("100"))
.tasaIsc(new BigDecimal("0.1"))
.build()
)
.detalle(DocumentoVentaDetalle.builder()
.descripcion("Item2")
.cantidad(new BigDecimal("2"))
.precio(new BigDecimal("200"))
.tasaIsc(new BigDecimal("0.1"))
.build()
)
.detalle(DocumentoVentaDetalle.builder()
.descripcion("Item3")
.cantidad(new BigDecimal("3"))
.precio(new BigDecimal("300"))
.tasaIsc(new BigDecimal("0.1"))
.build()
)
.detalle(DocumentoVentaDetalle.builder()
.descripcion("Item4")
.cantidad(new BigDecimal("4"))
.precio(new BigDecimal("400"))
.tasaIsc(new BigDecimal("0.1"))
.build()
)
.detalle(DocumentoVentaDetalle.builder()
.descripcion("Item5")
.cantidad(new BigDecimal("5"))
.precio(new BigDecimal("500"))
.tasaIsc(new BigDecimal("0.1"))
.build()
)
.build();

assertInput(input, "notaDeCreditoDeFactura1.xml");
}

@Order(3)
@Test
public void notaDeDebitoDeFactura1() throws Exception {
DebitNote input = DebitNote.builder()
.serie("FF50")
.numero(1)
.moneda("USD")
.comprobanteAfectadoSerieNumero("FF50-1")
.sustentoDescripcion("Homologacion")
.proveedor(HomologacionConstants.proveedor)
.cliente(HomologacionConstants.cliente)
.detalle(DocumentoVentaDetalle.builder()
.descripcion("Item1")
.cantidad(new BigDecimal("1"))
.precio(new BigDecimal("100"))
.tasaIsc(new BigDecimal("0.1"))
.build()
)
.detalle(DocumentoVentaDetalle.builder()
.descripcion("Item2")
.cantidad(new BigDecimal("2"))
.precio(new BigDecimal("200"))
.tasaIsc(new BigDecimal("0.1"))
.build()
)
.detalle(DocumentoVentaDetalle.builder()
.descripcion("Item3")
.cantidad(new BigDecimal("3"))
.precio(new BigDecimal("300"))
.tasaIsc(new BigDecimal("0.1"))
.build()
)
.detalle(DocumentoVentaDetalle.builder()
.descripcion("Item4")
.cantidad(new BigDecimal("4"))
.precio(new BigDecimal("400"))
.tasaIsc(new BigDecimal("0.1"))
.build()
)
.detalle(DocumentoVentaDetalle.builder()
.descripcion("Item5")
.cantidad(new BigDecimal("5"))
.precio(new BigDecimal("500"))
.tasaIsc(new BigDecimal("0.1"))
.build()
)
.build();

assertInput(input, "notaDeDebitoDeFactura2.xml");
}

}
Loading

0 comments on commit 8e05992

Please sign in to comment.