> For the complete documentation index, see [llms.txt](https://avbravo-2.gitbook.io/developmentcookbook/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://avbravo-2.gitbook.io/developmentcookbook/jenkins/crear-proyecto-maven.md).

# Crear proyecto maven

Crear un proyecto Maven desde NetBeans

![](https://547521780-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-Lc1Wg6HsWAzyOSRs0Cb%2F-Lc1WjBSYUwGT0Xk4hOe%2F-Lc1WvbAKCX_p9BOp2rM%2F2584649a-4e2e-49b2-917b-52a8607ce6d8.png?generation=1554820611217716\&alt=media)

**Nombre: myjenkins**

![](https://547521780-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-Lc1Wg6HsWAzyOSRs0Cb%2F-Lc1WjBSYUwGT0Xk4hOe%2F-Lc1WvbCmPXDjefeZ6-a%2F9e92c00c-6c1e-4a50-844e-85f1a7b20b0e.png?generation=1554820613693760\&alt=media)

Crear una clase Calculadora y los test

```java
public class Calculadora {
    
    public Integer sumar(Integer a, Integer b){
        return a +b;
    }
    
    public Integer restar(Integer a, Integer b){
        return a -b;
    }
    
    public Integer multiplicar(Integer a , Integer b){
        return a *b;
    }
    public Double dividir(Integer a, Integer b){
    
        return a.doubleValue() /b.doubleValue();
    }
    
}
```

### Crear el Test usando JUnit

File--> New -->Unit Test

![](https://547521780-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-Lc1Wg6HsWAzyOSRs0Cb%2F-LfLg2iT-jHe69jF8EFD%2F-LfLgOYsg2ZWaEq7HGD9%2Funittest.png?alt=media\&token=d29083d3-f1c3-46d7-9814-ba7f645efb88)

Seleccionamos la clase a crear los test

![](https://547521780-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-Lc1Wg6HsWAzyOSRs0Cb%2F-LfLg2iT-jHe69jF8EFD%2F-LfLgawZGra5t6GWNedo%2Fexte.png?alt=media\&token=77749164-3682-4db7-b4b6-71cc8dc4d704)

Se genera la clase CalculadoraTest.java

![](https://547521780-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-Lc1Wg6HsWAzyOSRs0Cb%2F-LfLg2iT-jHe69jF8EFD%2F-LfLgrEoPZe-oGP7k8a6%2Fsr.png?alt=media\&token=3a96256e-4fcf-4b7e-96be-ed2edc8f123e)

```java
/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
package com.avbravo.myjenkins;

import org.junit.jupiter.api.AfterEach;
import org.junit.jupiter.api.AfterAll;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.BeforeAll;
import org.junit.jupiter.api.Test;
import static org.junit.jupiter.api.Assertions.*;

/**
 *
 * @author avbravo
 */
public class CalculadoraTest {
    
    public CalculadoraTest() {
    }

    @org.junit.jupiter.api.BeforeAll
    public static void setUpClass() throws Exception {
    }

    @org.junit.jupiter.api.AfterAll
    public static void tearDownClass() throws Exception {
    }

    @org.junit.jupiter.api.BeforeEach
    public void setUp() throws Exception {
    }

    @org.junit.jupiter.api.AfterEach
    public void tearDown() throws Exception {
    }
    
    
    /**
     * Test of sumar method, of class Calculadora.
     */
    @org.junit.jupiter.api.Test
    public void testSumar() {
        System.out.println("sumar");
        Integer a = null;
        Integer b = null;
        Calculadora instance = new Calculadora();
        Integer expResult = null;
        Integer result = instance.sumar(a, b);
        assertEquals(expResult, result);
        // TODO review the generated test code and remove the default call to fail.
        fail("The test case is a prototype.");
    }

    /**
     * Test of restar method, of class Calculadora.
     */
    @org.junit.jupiter.api.Test
    public void testRestar() {
        System.out.println("restar");
        Integer a = null;
        Integer b = null;
        Calculadora instance = new Calculadora();
        Integer expResult = null;
        Integer result = instance.restar(a, b);
        assertEquals(expResult, result);
        // TODO review the generated test code and remove the default call to fail.
        fail("The test case is a prototype.");
    }

    /**
     * Test of multiplicar method, of class Calculadora.
     */
    @org.junit.jupiter.api.Test
    public void testMultiplicar() {
        System.out.println("multiplicar");
        Integer a = null;
        Integer b = null;
        Calculadora instance = new Calculadora();
        Integer expResult = null;
        Integer result = instance.multiplicar(a, b);
        assertEquals(expResult, result);
        // TODO review the generated test code and remove the default call to fail.
        fail("The test case is a prototype.");
    }

    /**
     * Test of dividir method, of class Calculadora.
     */
    @org.junit.jupiter.api.Test
    public void testDividir() {
        System.out.println("dividir");
        Integer a = null;
        Integer b = null;
        Calculadora instance = new Calculadora();
        Double expResult = null;
        Double result = instance.dividir(a, b);
        assertEquals(expResult, result);
        // TODO review the generated test code and remove the default call to fail.
        fail("The test case is a prototype.");
    }
    
}

```

## Ejecutar el Test la primera vez

Clic derecho en CalculadoraTest.java --> Test File

![](https://547521780-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-Lc1Wg6HsWAzyOSRs0Cb%2F-LfLg2iT-jHe69jF8EFD%2F-LfLh8mJ_vz3PqH7OEts%2Ftesfile.png?alt=media\&token=50762207-d209-4c14-bb50-4746dd8c92c6)

## ejecución

La primera vez los test deben fallar

![](https://547521780-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-Lc1Wg6HsWAzyOSRs0Cb%2F-LfLg2iT-jHe69jF8EFD%2F-LfLhOJZEbsgdhur1BZY%2Fresutlado.png?alt=media\&token=27966fc3-4b03-45b2-a491-5419e4b4f6d2)

##
