# 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)

##


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://avbravo-2.gitbook.io/developmentcookbook/jenkins/crear-proyecto-maven.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
