@@ -37,7 +37,7 @@ public StampV4Test() {
3737 * Método de UT timbrado versión 1 y envio de email.
3838 */
3939 @ Test
40- public void testStampV1 () {
40+ public void testStampV1Email () {
4141 try {
4242 StampV4 stamp = new StampV4 (settings .getUrlSW (), settings .getUserSW (), settings .getPasswordSW (), null , 0 );
4343 String xml = settings .getCFDI (true );
@@ -51,54 +51,51 @@ public void testStampV1() {
5151 Assertions .assertNotNull (ex );
5252 }
5353 }
54-
55- /**
56- * Método de UT timbrado versión 1 y envio de email erroneo.
54+ /**
55+ * Método de UT timbrado versión 2 y envio de email.
5756 */
5857 @ Test
59- public void testV4StampV1_errorEmail () {
58+ public void testStampV2Email () {
6059 try {
6160 StampV4 stamp = new StampV4 (settings .getUrlSW (), settings .getUserSW (), settings .getPasswordSW (), null , 0 );
6261 String xml = settings .getCFDI (true );
63- List <String > email = Arrays .asList ("invalid email" );
64- StampResponseV1 response = stamp .timbrarV1 (xml , email , null ,false , false );
65- String messageExpect = "El listado de correos no contiene un formato válido o alguno de los correos es inválido." ;
62+ StampResponseV2 response = stamp .timbrarV2 (xml , settings .getCorreo (), null ,false , false );
6663 Assertions .assertNotNull (response );
67- Assertions .assertTrue ("error" .equalsIgnoreCase (response .getStatus ()));
68- Assertions .assertTrue (messageExpect .equalsIgnoreCase (response .getMessage ()));
64+ Assertions .assertNotNull (response .getData ());
65+ Assertions .assertNotNull (response .getStatus ());
66+ Assertions .assertNotNull (response .getData ().getTFD ());
67+ Assertions .assertTrue ("success" .equalsIgnoreCase (response .getStatus ()));
6968 } catch (ServicesException ex ) {
7069 Assertions .assertNotNull (ex );
7170 }
7271 }
73-
74- /**
75- * Método de UT timbrado versión 1 y envio de 6 emails.
72+ /**
73+ * Método de UT timbrado versión 3 y envio de email.
7674 */
7775 @ Test
78- public void testV4StampV1_maxEmail () {
76+ public void testStampV3Email () {
7977 try {
8078 StampV4 stamp = new StampV4 (settings .getUrlSW (), settings .getUserSW (), settings .getPasswordSW (), null , 0 );
8179 String xml = settings .getCFDI (true );
82- StampResponseV1 response = stamp .timbrarV1 (xml , settings .getCorreos (), null ,false , false );
83- String messageExpect = "El listado de correos está vacío o contiene más de 5 correos." ;
80+ StampResponseV3 response = stamp .timbrarV3 (xml , settings .getCorreo (), null ,false , false );
8481 Assertions .assertNotNull (response );
85- Assertions .assertTrue ("error" .equalsIgnoreCase (response .getStatus ()));
86- Assertions .assertTrue (messageExpect .equalsIgnoreCase (response .getMessage ()));
82+ Assertions .assertNotNull (response .getData ());
83+ Assertions .assertNotNull (response .getStatus ());
84+ Assertions .assertNotNull (response .getData ().getCFDI ());
85+ Assertions .assertTrue ("success" .equalsIgnoreCase (response .getStatus ()));
8786 } catch (ServicesException ex ) {
8887 Assertions .assertNotNull (ex );
8988 }
9089 }
91-
92- /**
93- * Método de UT timbrado versión 1 con envio de parametro customId.
90+ /**
91+ * Método de UT timbrado versión 4 y envio de email.
9492 */
9593 @ Test
96- public void testStampV1_customId () {
94+ public void testStampV4Email () {
9795 try {
9896 StampV4 stamp = new StampV4 (settings .getUrlSW (), settings .getUserSW (), settings .getPasswordSW (), null , 0 );
9997 String xml = settings .getCFDI (true );
100- String customId = UUID .randomUUID ().toString ();
101- StampResponseV1 response = stamp .timbrarV1 (xml , null , customId , false , false );
98+ StampResponseV1 response = stamp .timbrarV1 (xml , settings .getCorreo (), null ,false , false );
10299 Assertions .assertNotNull (response );
103100 Assertions .assertNotNull (response .getData ());
104101 Assertions .assertNotNull (response .getStatus ());
@@ -110,38 +107,34 @@ public void testStampV1_customId() {
110107 }
111108
112109 /**
113- * Método de UT timbrado versión 1 con envio de parametro customId duplicado .
110+ * Método de UT timbrado versión 1 y envio de email erroneo .
114111 */
115112 @ Test
116- public void testStampV1_duplicateCustomId () {
113+ public void testV4StampV1_errorEmail () {
117114 try {
118- String customId = UUID .randomUUID ().toString ();
119115 StampV4 stamp = new StampV4 (settings .getUrlSW (), settings .getUserSW (), settings .getPasswordSW (), null , 0 );
120116 String xml = settings .getCFDI (true );
121- StampResponseV1 response = stamp .timbrarV1 (xml , null , customId , false , false );
117+ List <String > email = Arrays .asList ("invalid email" );
118+ StampResponseV1 response = stamp .timbrarV1 (xml , email , null ,false , false );
119+ String messageExpect = "El listado de correos no contiene un formato válido o alguno de los correos es inválido." ;
122120 Assertions .assertNotNull (response );
123- Assertions .assertTrue ("success" .equalsIgnoreCase (response .getStatus ()));
124- xml = settings .getCFDI (true );
125- response = stamp .timbrarV1 (xml , null , customId , false , false );
126121 Assertions .assertTrue ("error" .equalsIgnoreCase (response .getStatus ()));
127- Assertions .assertTrue ("CFDI3307 - Timbre duplicado. El customId proporcionado está duplicado." .equalsIgnoreCase (response .getMessage ()));
122+ Assertions .assertTrue (messageExpect .equalsIgnoreCase (response .getMessage ()));
128123 } catch (ServicesException ex ) {
129124 Assertions .assertNotNull (ex );
130125 }
131126 }
132127
133128 /**
134- * Método de UT timbrado versión 1 con envio de parametro customId inválido .
129+ * Método de UT timbrado versión 3 y envio de 6 emails .
135130 */
136131 @ Test
137- public void testStampV1_invalidCustomId () {
132+ public void testV4StampV3_maxEmail () {
138133 try {
139134 StampV4 stamp = new StampV4 (settings .getUrlSW (), settings .getUserSW (), settings .getPasswordSW (), null , 0 );
140135 String xml = settings .getCFDI (true );
141- String customId = UUID .randomUUID ().toString ();
142- customId = Collections .nCopies (10 , customId ).stream ().collect (Collectors .joining ());
143- StampResponseV1 response = stamp .timbrarV1 (xml , null , customId , false , false );
144- String messageExpect = "El CustomId no es válido o viene vacío." ;
136+ StampResponseV3 response = stamp .timbrarV3 (xml , settings .getCorreos (), null ,false , false );
137+ String messageExpect = "El listado de correos está vacío o contiene más de 5 correos." ;
145138 Assertions .assertNotNull (response );
146139 Assertions .assertTrue ("error" .equalsIgnoreCase (response .getStatus ()));
147140 Assertions .assertTrue (messageExpect .equalsIgnoreCase (response .getMessage ()));
@@ -151,32 +144,34 @@ public void testStampV1_invalidCustomId() {
151144 }
152145
153146 /**
154- * Método de UT timbrado versión 1 con envio de parametro PDF .
147+ * Método de UT timbrado versión 1 con envio de parametro customId .
155148 */
156149 @ Test
157- public void testStampV1_pdf () {
150+ public void testStampV1_customId () {
158151 try {
159152 StampV4 stamp = new StampV4 (settings .getUrlSW (), settings .getUserSW (), settings .getPasswordSW (), null , 0 );
160153 String xml = settings .getCFDI (true );
161- StampResponseV1 response = stamp .timbrarV1 (xml , null , null ,true , false );
154+ String customId = UUID .randomUUID ().toString ();
155+ StampResponseV1 response = stamp .timbrarV1 (xml , null , customId , false , false );
162156 Assertions .assertNotNull (response );
163157 Assertions .assertNotNull (response .getData ());
164158 Assertions .assertNotNull (response .getStatus ());
165159 Assertions .assertNotNull (response .getData ().getTFD ());
160+ Assertions .assertTrue ("success" .equalsIgnoreCase (response .getStatus ()));
166161 } catch (ServicesException ex ) {
167162 Assertions .assertNotNull (ex );
168163 }
169164 }
170-
171165 /**
172- * Método de UT timbrado versión 2.
166+ * Método de UT timbrado versión 2 con envio de parametro CustomId .
173167 */
174168 @ Test
175- public void testStampV2 () {
169+ public void testStampV2_customId () {
176170 try {
177171 StampV4 stamp = new StampV4 (settings .getUrlSW (), settings .getUserSW (), settings .getPasswordSW (), null , 0 );
178172 String xml = settings .getCFDI (true );
179- StampResponseV2 response = stamp .timbrarV2 (xml , settings .getCorreo (), null , false , false );
173+ String customId = UUID .randomUUID ().toString ();
174+ StampResponseV2 response = stamp .timbrarV2 (xml , null , customId , false , false );
180175 Assertions .assertNotNull (response );
181176 Assertions .assertNotNull (response .getData ());
182177 Assertions .assertNotNull (response .getStatus ());
@@ -186,17 +181,16 @@ public void testStampV2() {
186181 Assertions .assertNotNull (ex );
187182 }
188183 }
189-
190- /**
191- * Método de UT timbrado versión 2 con envio de parametro CustomId.
184+ /**
185+ * Método de UT timbrado versión 3 con envio de parametro CustomId.
192186 */
193187 @ Test
194- public void testStampV2_customId () {
188+ public void testStampV3_customId () {
195189 try {
196190 StampV4 stamp = new StampV4 (settings .getUrlSW (), settings .getUserSW (), settings .getPasswordSW (), null , 0 );
197191 String xml = settings .getCFDI (true );
198192 String customId = UUID .randomUUID ().toString ();
199- StampResponseV2 response = stamp .timbrarV2 (xml , null , customId , false , false );
193+ StampResponseV3 response = stamp .timbrarV3 (xml , null , customId , false , false );
200194 Assertions .assertNotNull (response );
201195 Assertions .assertNotNull (response .getData ());
202196 Assertions .assertNotNull (response .getStatus ());
@@ -206,8 +200,68 @@ public void testStampV2_customId() {
206200 Assertions .assertNotNull (ex );
207201 }
208202 }
203+ /**
204+ * Método de UT timbrado versión 3 con envio de parametro CustomId.
205+ */
206+ @ Test
207+ public void testStampV4_customId () {
208+ try {
209+ StampV4 stamp = new StampV4 (settings .getUrlSW (), settings .getUserSW (), settings .getPasswordSW (), null , 0 );
210+ String xml = settings .getCFDI (true );
211+ String customId = UUID .randomUUID ().toString ();
212+ StampResponseV4 response = stamp .timbrarV4 (xml , null , customId , false , false );
213+ Assertions .assertNotNull (response );
214+ Assertions .assertNotNull (response .getData ());
215+ Assertions .assertNotNull (response .getStatus ());
216+ Assertions .assertNotNull (response .getData ().getCFDI ());
217+ Assertions .assertTrue ("success" .equalsIgnoreCase (response .getStatus ()));
218+ } catch (ServicesException ex ) {
219+ Assertions .assertNotNull (ex );
220+ }
221+ }
222+
223+
224+ /**
225+ * Método de UT timbrado versión 1 con envio de parametro customId duplicado.
226+ */
227+ @ Test
228+ public void testStampV1_duplicateCustomId () {
229+ try {
230+ String customId = UUID .randomUUID ().toString ();
231+ StampV4 stamp = new StampV4 (settings .getUrlSW (), settings .getUserSW (), settings .getPasswordSW (), null , 0 );
232+ String xml = settings .getCFDI (true );
233+ StampResponseV1 response = stamp .timbrarV1 (xml , null , customId , false , false );
234+ Assertions .assertNotNull (response );
235+ Assertions .assertTrue ("success" .equalsIgnoreCase (response .getStatus ()));
236+ xml = settings .getCFDI (true );
237+ response = stamp .timbrarV1 (xml , null , customId , false , false );
238+ Assertions .assertTrue ("error" .equalsIgnoreCase (response .getStatus ()));
239+ Assertions .assertTrue ("CFDI3307 - Timbre duplicado. El customId proporcionado está duplicado." .equalsIgnoreCase (response .getMessage ()));
240+ } catch (ServicesException ex ) {
241+ Assertions .assertNotNull (ex );
242+ }
243+ }
209244
210245 /**
246+ * Método de UT timbrado versión 1 con envio de parametro customId inválido.
247+ */
248+ @ Test
249+ public void testStampV1_invalidCustomId () {
250+ try {
251+ StampV4 stamp = new StampV4 (settings .getUrlSW (), settings .getUserSW (), settings .getPasswordSW (), null , 0 );
252+ String xml = settings .getCFDI (true );
253+ String customId = UUID .randomUUID ().toString ();
254+ customId = Collections .nCopies (10 , customId ).stream ().collect (Collectors .joining ());
255+ StampResponseV1 response = stamp .timbrarV1 (xml , null , customId , false , false );
256+ String messageExpect = "El CustomId no es válido o viene vacío." ;
257+ Assertions .assertNotNull (response );
258+ Assertions .assertTrue ("error" .equalsIgnoreCase (response .getStatus ()));
259+ Assertions .assertTrue (messageExpect .equalsIgnoreCase (response .getMessage ()));
260+ } catch (ServicesException ex ) {
261+ Assertions .assertNotNull (ex );
262+ }
263+ }
264+ /**
211265 * Método de UT timbrado versión 2 con envio de parametro customId duplicado.
212266 */
213267 @ Test
@@ -229,83 +283,73 @@ public void testStampV2_duplicateCustomId() {
229283 }
230284
231285 /**
232- * Método de UT timbrado versión 3 .
286+ * Método de UT timbrado versión 1 con envio de parametro PDF .
233287 */
234288 @ Test
235- public void testStampV3 () {
289+ public void testStampV1_pdf () {
236290 try {
237291 StampV4 stamp = new StampV4 (settings .getUrlSW (), settings .getUserSW (), settings .getPasswordSW (), null , 0 );
238292 String xml = settings .getCFDI (true );
239- StampResponseV3 response = stamp .timbrarV3 (xml , settings . getCorreo (), null , false , false );
293+ StampResponseV1 response = stamp .timbrarV1 (xml , null , null , true , false );
240294 Assertions .assertNotNull (response );
241295 Assertions .assertNotNull (response .getData ());
242296 Assertions .assertNotNull (response .getStatus ());
243- Assertions .assertNotNull (response .getData ().getCFDI ());
244- Assertions .assertTrue ("success" .equalsIgnoreCase (response .getStatus ()));
297+ Assertions .assertNotNull (response .getData ().getTFD ());
245298 } catch (ServicesException ex ) {
246299 Assertions .assertNotNull (ex );
247300 }
248301 }
249-
250- /**
251- * Método de UT timbrado versión 3 con envio de parametro CustomId.
302+ /**
303+ * Método de UT timbrado versión 2 con envio de parametro PDF.
252304 */
253305 @ Test
254- public void testStampV3_customId () {
306+ public void testStampV2_pdf () {
255307 try {
256308 StampV4 stamp = new StampV4 (settings .getUrlSW (), settings .getUserSW (), settings .getPasswordSW (), null , 0 );
257309 String xml = settings .getCFDI (true );
258- String customId = UUID .randomUUID ().toString ();
259- StampResponseV3 response = stamp .timbrarV3 (xml , null , customId , false , false );
310+ StampResponseV2 response = stamp .timbrarV2 (xml , null , null ,true , false );
260311 Assertions .assertNotNull (response );
261312 Assertions .assertNotNull (response .getData ());
262313 Assertions .assertNotNull (response .getStatus ());
263- Assertions .assertNotNull (response .getData ().getCFDI ());
264- Assertions .assertTrue ("success" .equalsIgnoreCase (response .getStatus ()));
314+ Assertions .assertNotNull (response .getData ().getTFD ());
265315 } catch (ServicesException ex ) {
266316 Assertions .assertNotNull (ex );
267317 }
268318 }
269-
270- /**
271- * Método de UT timbrado versión 4.
319+ /**
320+ * Método de UT timbrado versión 3 con envio de parametro PDF.
272321 */
273322 @ Test
274- public void testStampV4 () {
323+ public void testStampV3_pdf () {
275324 try {
276325 StampV4 stamp = new StampV4 (settings .getUrlSW (), settings .getUserSW (), settings .getPasswordSW (), null , 0 );
277326 String xml = settings .getCFDI (true );
278- StampResponseV4 response = stamp .timbrarV4 (xml , settings . getCorreo (), null , false , false );
327+ StampResponseV3 response = stamp .timbrarV3 (xml , null , null , true , false );
279328 Assertions .assertNotNull (response );
280329 Assertions .assertNotNull (response .getData ());
281330 Assertions .assertNotNull (response .getStatus ());
282331 Assertions .assertNotNull (response .getData ().getCFDI ());
283- Assertions .assertTrue ("success" .equalsIgnoreCase (response .getStatus ()));
284332 } catch (ServicesException ex ) {
285333 Assertions .assertNotNull (ex );
286334 }
287335 }
288-
289- /**
290- * Método de UT timbrado versión 4 con envio de parametro CustomId.
336+ /**
337+ * Método de UT timbrado versión 4 con envio de parametro PDF.
291338 */
292339 @ Test
293- public void testStampV4_customId () {
340+ public void testStampV4_pdf () {
294341 try {
295342 StampV4 stamp = new StampV4 (settings .getUrlSW (), settings .getUserSW (), settings .getPasswordSW (), null , 0 );
296343 String xml = settings .getCFDI (true );
297- String customId = UUID .randomUUID ().toString ();
298- StampResponseV4 response = stamp .timbrarV4 (xml , settings .getCorreo (),customId , false , false );
344+ StampResponseV4 response = stamp .timbrarV4 (xml , null , null ,true , false );
299345 Assertions .assertNotNull (response );
300346 Assertions .assertNotNull (response .getData ());
301347 Assertions .assertNotNull (response .getStatus ());
302348 Assertions .assertNotNull (response .getData ().getCFDI ());
303- Assertions .assertTrue ("success" .equalsIgnoreCase (response .getStatus ()));
304349 } catch (ServicesException ex ) {
305350 Assertions .assertNotNull (ex );
306351 }
307- }
308-
352+ }
309353 /**
310354 * Método de UT timbrado versión 1 base64.
311355 */
0 commit comments