> 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

![](/files/-Lc1WvbAKCX_p9BOp2rM)

**Nombre: myjenkins**

![](/files/-Lc1WvbCmPXDjefeZ6-a)

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

![](/files/-LfLgOYsg2ZWaEq7HGD9)

Seleccionamos la clase a crear los test

![](/files/-LfLgawZGra5t6GWNedo)

Se genera la clase CalculadoraTest.java

![](/files/-LfLgrEoPZe-oGP7k8a6)

```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

![](/files/-LfLh8mJ_vz3PqH7OEts)

## ejecución

La primera vez los test deben fallar

![](/files/-LfLhOJZEbsgdhur1BZY)

##
