Skip to content

Commit 19ac28a

Browse files
Format tests (#168)
1 parent b4e99b5 commit 19ac28a

19 files changed

+595
-743
lines changed

core/src/test/java/e2e/enricher/enrich/DetalleTest.java

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -82,8 +82,7 @@ public void testEnrichIgvTipo() {
8282
@Test
8383
public void testDontEnrichIgvTipo() {
8484
// Given
85-
Invoice input = Invoice
86-
.builder()
85+
Invoice input = Invoice.builder()
8786
.detalle(DocumentoVentaDetalle.builder().igvTipo(Catalog7.INAFECTO_RETIRO.getCode()).build())
8887
.build();
8988

@@ -102,8 +101,7 @@ public void testDontEnrichIgvTipo() {
102101
@Test
103102
public void testEnrichPrecioReferenciaTipo_PrecioConIgv() {
104103
// Given
105-
Invoice input = Invoice
106-
.builder()
104+
Invoice input = Invoice.builder()
107105
.detalle(DocumentoVentaDetalle.builder().igvTipo(Catalog7.GRAVADO_OPERACION_ONEROSA.getCode()).build())
108106
.build();
109107

@@ -122,8 +120,7 @@ public void testEnrichPrecioReferenciaTipo_PrecioConIgv() {
122120
@Test
123121
public void testEnrichPrecioReferenciaTipo_ValorReferencial() {
124122
// Given
125-
Invoice input = Invoice
126-
.builder()
123+
Invoice input = Invoice.builder()
127124
.detalle(DocumentoVentaDetalle.builder().igvTipo(Catalog7.GRAVADO_RETIRO_POR_DONACION.getCode()).build())
128125
.build();
129126

core/src/test/java/e2e/enricher/enrich/GeneralDocumentTest.java

Lines changed: 5 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -102,8 +102,7 @@ public void testEnrichFormaPagoTipo_Contado() {
102102
@Test
103103
public void testEnrichFormaPagoTipo_Credito() {
104104
// Given
105-
Invoice input = Invoice
106-
.builder()
105+
Invoice input = Invoice.builder()
107106
.formaDePago(
108107
FormaDePago
109108
.builder()
@@ -125,14 +124,12 @@ public void testEnrichFormaPagoTipo_CorrectWrongUserDefinedValue() {
125124
// Given
126125

127126
// Invoice with no "cuotas" has "formaDePago" CREDITO. It must be corrected
128-
Invoice input1 = Invoice
129-
.builder()
127+
Invoice input1 = Invoice.builder()
130128
.formaDePago(FormaDePago.builder().tipo(CatalogContadoCredito.CREDITO.getCode()).build())
131129
.build();
132130

133131
// Invoice with "cuotas" has "formaDePago" CONTADO. It must be corrected
134-
Invoice input2 = Invoice
135-
.builder()
132+
Invoice input2 = Invoice.builder()
136133
.formaDePago(
137134
FormaDePago
138135
.builder()
@@ -155,8 +152,7 @@ public void testEnrichFormaPagoTipo_CorrectWrongUserDefinedValue() {
155152
@Test
156153
public void testEnrichFirmante() {
157154
// Given
158-
Invoice input = Invoice
159-
.builder()
155+
Invoice input = Invoice.builder()
160156
.proveedor(Proveedor.builder().ruc("12345678912").razonSocial("Mi razón social").build())
161157
.build();
162158

@@ -172,8 +168,7 @@ public void testEnrichFirmante() {
172168
@Test
173169
public void testEnrichFirmante_whenFirmanteIsPartiallyFilled() {
174170
// Given
175-
Invoice input = Invoice
176-
.builder()
171+
Invoice input = Invoice.builder()
177172
.proveedor(Proveedor.builder().ruc("12345678912").razonSocial("Mi razón social").build())
178173
.firmante(Firmante.builder().ruc("12345678912").build())
179174
.build();

core/src/test/java/e2e/enricher/enrich/InvoiceTest.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,7 @@ public class InvoiceTest extends AbstractTest {
2929
@Test
3030
public void testEnrichTipoComprobante() {
3131
// Given
32-
Invoice input = Invoice
33-
.builder()
32+
Invoice input = Invoice.builder()
3433
.serie("F001-1")
3534
.tipoComprobante(Catalog1_Invoice.BOLETA.getCode()) // This should be overwritten
3635
.build();

core/src/test/java/e2e/enricher/process/DetalleTest.java

Lines changed: 62 additions & 95 deletions
Original file line numberDiff line numberDiff line change
@@ -33,15 +33,12 @@ public class DetalleTest extends AbstractTest {
3333
@Test
3434
public void testEnrichPrecioDeReferencia_precioConImpuestos_OperacionOnerosa() {
3535
// Given
36-
Invoice input = Invoice
37-
.builder()
38-
.detalle(
39-
DocumentoVentaDetalle
40-
.builder()
41-
.precio(BigDecimal.TEN)
42-
.precioConImpuestos(false)
43-
.igvTipo(Catalog7.GRAVADO_OPERACION_ONEROSA.getCode())
44-
.build()
36+
Invoice input = Invoice.builder()
37+
.detalle(DocumentoVentaDetalle.builder()
38+
.precio(BigDecimal.TEN)
39+
.precioConImpuestos(false)
40+
.igvTipo(Catalog7.GRAVADO_OPERACION_ONEROSA.getCode())
41+
.build()
4542
)
4643
.build();
4744

@@ -60,15 +57,12 @@ public void testEnrichPrecioDeReferencia_precioConImpuestos_OperacionOnerosa() {
6057
@Test
6158
public void testEnrichPrecioDeReferencia_precioConImpuestos_OperacionNoOnerosa() {
6259
// Given
63-
Invoice input = Invoice
64-
.builder()
65-
.detalle(
66-
DocumentoVentaDetalle
67-
.builder()
68-
.precio(BigDecimal.TEN)
69-
.precioConImpuestos(false)
70-
.igvTipo(Catalog7.GRAVADO_RETIRO.getCode())
71-
.build()
60+
Invoice input = Invoice.builder()
61+
.detalle(DocumentoVentaDetalle.builder()
62+
.precio(BigDecimal.TEN)
63+
.precioConImpuestos(false)
64+
.igvTipo(Catalog7.GRAVADO_RETIRO.getCode())
65+
.build()
7266
)
7367
.build();
7468

@@ -87,15 +81,12 @@ public void testEnrichPrecioDeReferencia_precioConImpuestos_OperacionNoOnerosa()
8781
@Test
8882
public void testEnrichPrecioDeReferencia_precioSinImpuestos_OperacionOnerosa() {
8983
// Given
90-
Invoice input = Invoice
91-
.builder()
92-
.detalle(
93-
DocumentoVentaDetalle
94-
.builder()
95-
.precio(new BigDecimal("11.80"))
96-
.precioConImpuestos(true)
97-
.igvTipo(Catalog7.GRAVADO_OPERACION_ONEROSA.getCode())
98-
.build()
84+
Invoice input = Invoice.builder()
85+
.detalle(DocumentoVentaDetalle.builder()
86+
.precio(new BigDecimal("11.80"))
87+
.precioConImpuestos(true)
88+
.igvTipo(Catalog7.GRAVADO_OPERACION_ONEROSA.getCode())
89+
.build()
9990
)
10091
.build();
10192

@@ -114,15 +105,12 @@ public void testEnrichPrecioDeReferencia_precioSinImpuestos_OperacionOnerosa() {
114105
@Test
115106
public void testEnrichPrecioDeReferencia_precioSinImpuestos_OperacionNoOnerosa() {
116107
// Given
117-
Invoice input = Invoice
118-
.builder()
119-
.detalle(
120-
DocumentoVentaDetalle
121-
.builder()
122-
.precio(new BigDecimal("11.80"))
123-
.precioConImpuestos(true)
124-
.igvTipo(Catalog7.GRAVADO_RETIRO.getCode())
125-
.build()
108+
Invoice input = Invoice.builder()
109+
.detalle(DocumentoVentaDetalle.builder()
110+
.precio(new BigDecimal("11.80"))
111+
.precioConImpuestos(true)
112+
.igvTipo(Catalog7.GRAVADO_RETIRO.getCode())
113+
.build()
126114
)
127115
.build();
128116

@@ -158,8 +146,7 @@ public void testEnrichIcb() {
158146
@Test
159147
public void testDontEnrichIcb() {
160148
// Given
161-
Invoice input = Invoice
162-
.builder()
149+
Invoice input = Invoice.builder()
163150
.detalle(DocumentoVentaDetalle.builder().icb(BigDecimal.TEN).icbAplica(false).build())
164151
.build();
165152

@@ -178,14 +165,11 @@ public void testDontEnrichIcb() {
178165
@Test
179166
public void testEnrichIcbAplica() {
180167
// Given
181-
Invoice input = Invoice
182-
.builder()
183-
.detalle(
184-
DocumentoVentaDetalle
185-
.builder()
186-
.icb(BigDecimal.TEN)
187-
.icbAplica(false) // this should be corrected
188-
.build()
168+
Invoice input = Invoice.builder()
169+
.detalle(DocumentoVentaDetalle.builder()
170+
.icb(BigDecimal.TEN)
171+
.icbAplica(false) // this should be corrected
172+
.build()
189173
)
190174
.build();
191175

@@ -204,15 +188,12 @@ public void testEnrichIcbAplica() {
204188
@Test
205189
public void testEnrichBaseImponible_whenPrecioConImpuestos() {
206190
// Given
207-
Invoice input = Invoice
208-
.builder()
209-
.detalle(
210-
DocumentoVentaDetalle
211-
.builder()
212-
.cantidad(new BigDecimal(2))
213-
.precio(BigDecimal.TEN)
214-
.precioConImpuestos(false)
215-
.build()
191+
Invoice input = Invoice.builder()
192+
.detalle(DocumentoVentaDetalle.builder()
193+
.cantidad(new BigDecimal(2))
194+
.precio(BigDecimal.TEN)
195+
.precioConImpuestos(false)
196+
.build()
216197
)
217198
.build();
218199

@@ -231,15 +212,12 @@ public void testEnrichBaseImponible_whenPrecioConImpuestos() {
231212
@Test
232213
public void testEnrichBaseImponible_whenPrecioSinImpuestos() {
233214
// Given
234-
Invoice input = Invoice
235-
.builder()
236-
.detalle(
237-
DocumentoVentaDetalle
238-
.builder()
239-
.cantidad(new BigDecimal(2))
240-
.precio(new BigDecimal("11.8"))
241-
.precioConImpuestos(true)
242-
.build()
215+
Invoice input = Invoice.builder()
216+
.detalle(DocumentoVentaDetalle.builder()
217+
.cantidad(new BigDecimal(2))
218+
.precio(new BigDecimal("11.8"))
219+
.precioConImpuestos(true)
220+
.build()
243221
)
244222
.build();
245223

@@ -258,16 +236,13 @@ public void testEnrichBaseImponible_whenPrecioSinImpuestos() {
258236
@Test
259237
public void testDontEnrichBaseImponible() {
260238
// Given
261-
Invoice input = Invoice
262-
.builder()
263-
.detalle(
264-
DocumentoVentaDetalle
265-
.builder()
266-
.cantidad(new BigDecimal(2))
267-
.precio(new BigDecimal("10"))
268-
.precioConImpuestos(false)
269-
.igvBaseImponible(new BigDecimal(999)) // This user defined value should not be altered
270-
.build()
239+
Invoice input = Invoice.builder()
240+
.detalle(DocumentoVentaDetalle.builder()
241+
.cantidad(new BigDecimal(2))
242+
.precio(new BigDecimal("10"))
243+
.precioConImpuestos(false)
244+
.igvBaseImponible(new BigDecimal(999)) // This user defined value should not be altered
245+
.build()
271246
)
272247
.build();
273248

@@ -286,8 +261,7 @@ public void testDontEnrichBaseImponible() {
286261
@Test
287262
public void testEnrichIgv() {
288263
// Given
289-
Invoice input = Invoice
290-
.builder()
264+
Invoice input = Invoice.builder()
291265
.tasaIgv(new BigDecimal("0.18"))
292266
.detalle(DocumentoVentaDetalle.builder().igvBaseImponible(new BigDecimal("10")).build())
293267
.build();
@@ -307,15 +281,12 @@ public void testEnrichIgv() {
307281
@Test
308282
public void testDontEnrichIgv() {
309283
// Given
310-
Invoice input = Invoice
311-
.builder()
284+
Invoice input = Invoice.builder()
312285
.tasaIgv(new BigDecimal("0.18"))
313-
.detalle(
314-
DocumentoVentaDetalle
315-
.builder()
316-
.igvBaseImponible(new BigDecimal("10"))
317-
.igv(new BigDecimal("999")) // Dont change user defined value
318-
.build()
286+
.detalle(DocumentoVentaDetalle.builder()
287+
.igvBaseImponible(new BigDecimal("10"))
288+
.igv(new BigDecimal("999")) // Dont change user defined value
289+
.build()
319290
)
320291
.build();
321292

@@ -334,8 +305,7 @@ public void testDontEnrichIgv() {
334305
@Test
335306
public void testEnrichTotalImpuestos() {
336307
// Given
337-
Invoice input = Invoice
338-
.builder()
308+
Invoice input = Invoice.builder()
339309
.detalle(DocumentoVentaDetalle.builder().igv(new BigDecimal("10")).icb(new BigDecimal("2")).build())
340310
.build();
341311

@@ -354,15 +324,12 @@ public void testEnrichTotalImpuestos() {
354324
@Test
355325
public void testDontEnrichTotalImpuestos() {
356326
// Given
357-
Invoice input = Invoice
358-
.builder()
359-
.detalle(
360-
DocumentoVentaDetalle
361-
.builder()
362-
.igv(new BigDecimal("10"))
363-
.icb(new BigDecimal("2"))
364-
.totalImpuestos(new BigDecimal("999")) // Dont change user defined value
365-
.build()
327+
Invoice input = Invoice.builder()
328+
.detalle(DocumentoVentaDetalle.builder()
329+
.igv(new BigDecimal("10"))
330+
.icb(new BigDecimal("2"))
331+
.totalImpuestos(new BigDecimal("999")) // Dont change user defined value
332+
.build()
366333
)
367334
.build();
368335

core/src/test/java/e2e/renderer/creditnote/CreditNoteOrdenDeCompraTest.java

Lines changed: 21 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -38,37 +38,34 @@ public class CreditNoteOrdenDeCompraTest extends AbstractTest {
3838
@Test
3939
public void testInvoiceWithCustomUnidadMedida() throws Exception {
4040
// Given
41-
CreditNote input = CreditNote
42-
.builder()
41+
CreditNote input = CreditNote.builder()
4342
.serie("FC01")
4443
.numero(1)
4544
.comprobanteAfectadoSerieNumero("F001-1")
4645
.sustentoDescripcion("mi sustento")
4746
.ordenDeCompra("123456")
48-
.proveedor(Proveedor.builder().ruc("12345678912").razonSocial("Softgreen S.A.C.").build())
49-
.cliente(
50-
Cliente
51-
.builder()
52-
.nombre("Carlos Feria")
53-
.numeroDocumentoIdentidad("12121212121")
54-
.tipoDocumentoIdentidad(Catalog6.RUC.toString())
55-
.build()
47+
.proveedor(Proveedor.builder()
48+
.ruc("12345678912")
49+
.razonSocial("Softgreen S.A.C.")
50+
.build()
5651
)
57-
.detalle(
58-
DocumentoVentaDetalle
59-
.builder()
60-
.descripcion("Item1")
61-
.cantidad(new BigDecimal("10"))
62-
.precio(new BigDecimal("100"))
63-
.build()
52+
.cliente(Cliente.builder()
53+
.nombre("Carlos Feria")
54+
.numeroDocumentoIdentidad("12121212121")
55+
.tipoDocumentoIdentidad(Catalog6.RUC.toString())
56+
.build()
6457
)
65-
.detalle(
66-
DocumentoVentaDetalle
67-
.builder()
68-
.descripcion("Item2")
69-
.cantidad(new BigDecimal("10"))
70-
.precio(new BigDecimal("100"))
71-
.build()
58+
.detalle(DocumentoVentaDetalle.builder()
59+
.descripcion("Item1")
60+
.cantidad(new BigDecimal("10"))
61+
.precio(new BigDecimal("100"))
62+
.build()
63+
)
64+
.detalle(DocumentoVentaDetalle.builder()
65+
.descripcion("Item2")
66+
.cantidad(new BigDecimal("10"))
67+
.precio(new BigDecimal("100"))
68+
.build()
7269
)
7370
.build();
7471

0 commit comments

Comments
 (0)