@@ -24,7 +24,7 @@
* @author Usuario
*/
public class VendingTest {
Vending prueba ;
public VendingTest () {
}
@@ -38,6 +38,7 @@ public static void tearDownClass() {
@ Before
public void setUp () {
prueba = new Vending ();
}
@ After
@@ -50,55 +51,79 @@ public void tearDown() {
@ Test
public void testCrearNuevaVenta () {
System .out .println ("crearNuevaVenta" );
Vending instance = new Vending ();
boolean expResult = false ;
boolean result = instance .crearNuevaVenta ();
boolean expResult = true ;
boolean result = prueba .crearNuevaVenta ();
assertEquals (expResult , result );
}
@ Test
public void testNoValidoCrearNuevaVenta () {
System .out .println ("crearNuevaVenta" );
boolean expResult = false ;
boolean result = prueba .crearNuevaVenta ();
assertNotEquals (expResult , result );
}
/**
* Test of monedasExistentes method, of class Vending.
*/
@ Test
public void testMonedasExistentes () {
System .out .println ("monedasExistentes" );
int denominacion = 0 ;
Vending instance = new Vending ();
int expResult = 0 ;
int result = instance .monedasExistentes (denominacion );
int denominacion = 100 ;
int expResult = 20 ;
int result = prueba .monedasExistentes (denominacion );
assertEquals (expResult , result );
// TODO review the generated test code and remove the default call to fail.
fail ("The test case is a prototype." );
}
@ Test
public void testNoValidoMonedasExistentes () {
System .out .println ("monedasExistentes" );
int denominacion = 100 ;
int expResult = 21 ;
int result = prueba .monedasExistentes (denominacion );
assertNotEquals (expResult , result );
}
/**
* Test of buscarMonedaDenominacion method, of class Vending.
*/
@ Test
public void testBuscarMonedaDenominacion () {
System .out .println ("buscarMonedaDenominacion" );
int denominacion = 0 ;
Vending instance = new Vending ();
Moneda expResult = null ;
Moneda result = instance .buscarMonedaDenominacion (denominacion );
assertEquals (expResult , result );
// TODO review the generated test code and remove the default call to fail.
fail ("The test case is a prototype." );
int denominacion = 100 ;
Moneda expResult = prueba .getDineroAcumulado ().get (0 );//la posicion uno son las monedas de 100
Moneda result = prueba .buscarMonedaDenominacion (denominacion );
assertSame (expResult , result );
}
/**
* Test of buscarMonedaDenominacion method, of class Vending.
*/
@ Test
public void testNoValidoBuscarMonedaDenominacion (){
System .out .println ("buscarMonedaDenominacion" );
int denominacion = 100 ;
Moneda expResult = prueba .getDineroAcumulado ().get (1 );
Moneda result = prueba .buscarMonedaDenominacion (denominacion );
assertNotSame (expResult , result );
}
/**
* Test of validarDenominacion method, of class Vending.
*/
@ Test
public void testValidarDenominacion () {
System .out .println ("validarDenominacion" );
int denominacion = 0 ;
Vending instance = new Vending ();
Denominacion expResult = null ;
Denominacion result = instance .validarDenominacion (denominacion );
assertEquals (expResult , result );
// TODO review the generated test code and remove the default call to fail.
fail ("The test case is a prototype." );
int denominacion = 100 ;
Denominacion expResult = prueba .getDineroAcumulado ().get (0 ).getDenominacion ();
Denominacion result = prueba .validarDenominacion (denominacion );
assertSame (expResult , result );
}
@ Test
public void testNoValidoValidarDenominacion () {
System .out .println ("validarDenominacion" );
int denominacion = 700 ;
Denominacion expResult = prueba .getDineroAcumulado ().get (0 ).getDenominacion ();
Denominacion result = prueba .validarDenominacion (denominacion );
assertNotSame (expResult , result );
}
/**
@@ -107,15 +132,35 @@ public void testValidarDenominacion() {
@ Test
public void testVenderProducto () {
System .out .println ("venderProducto" );
String codigo = "" ;
ArrayList <String > adicionales = null ;
ArrayList <Integer > monedas = null ;
Vending instance = new Vending ();
ArrayList <Moneda > expResult = null ;
ArrayList <Moneda > result = instance .venderProducto (codigo , adicionales , monedas );
assertEquals (expResult , result );
// TODO review the generated test code and remove the default call to fail.
fail ("The test case is a prototype." );
String codigo = "1A" ;
ArrayList <String > adicionales =new ArrayList <>();
adicionales .add ("A1" );
adicionales .add ("A1" );
ArrayList <Integer > monedas = new ArrayList <>();
monedas .add (100 );
ArrayList <Moneda > expResult =new ArrayList <>();
expResult .add (new Moneda (1 , Denominacion .CIEN ));
ArrayList <Moneda > result = prueba .venderProducto (codigo , adicionales , monedas );
System .out .println ("venderProducto" +"\n" +result .get (0 ).getDenominacion ().getEnNumeros ()+"\n" +expResult .get (0 ).getDenominacion ().getEnNumeros ());
//no pudimos hacerlo con listas asà que imprimimos la denominacion
//y luego comparamos la cantidad
assertEquals (expResult .get (0 ).getCantidad (), result .get (0 ).getCantidad ());
}
@ Test
public void testNoValidoVenderProducto () {
System .out .println ("venderProducto" );
String codigo = "XA" ;
ArrayList <String > adicionales =new ArrayList <>();
adicionales .add ("A1" );
adicionales .add ("A1" );
ArrayList <Integer > monedas = new ArrayList <>();
monedas .add (100 );
ArrayList <Moneda > expResult =new ArrayList <>();
expResult .add (new Moneda (1 , Denominacion .CIEN ));
ArrayList <Moneda > result = prueba .venderProducto (codigo , adicionales , monedas );
System .out .println ("venderProducto" +"\n" +result .get (0 ).getCantidad ()+"\n" +expResult .get (0 ).getCantidad ());
//no pudimos hacerlo con listas asà que lo imprimimos
assertEquals (expResult .get (0 ).getCantidad (), result .get (0 ).getCantidad ());
}
/**
@@ -124,13 +169,24 @@ public void testVenderProducto() {
@ Test
public void testCastVueltasMoneda () {
System .out .println ("castVueltasMoneda" );
ArrayList <Integer > monedas = null ;
Vending instance = new Vending ();
ArrayList <Moneda > expResult = null ;
ArrayList <Moneda > result = instance .castVueltasMoneda (monedas );
assertEquals (expResult , result );
// TODO review the generated test code and remove the default call to fail.
fail ("The test case is a prototype." );
ArrayList <Integer > monedas = new ArrayList <>();
monedas .add (100 );
ArrayList <Moneda > expResult = new ArrayList <>();
expResult .add (new Moneda (1 , Denominacion .CIEN ));
ArrayList <Moneda > result = prueba .castVueltasMoneda (monedas );
System .out .println ("expResult cantidad: " +expResult .get (0 ).getCantidad ());
System .out .println ("result cantidad: " +result .get (0 ).getCantidad ());
assertSame (expResult .get (0 ).getDenominacion (), result .get (0 ).getDenominacion ());
}
@ Test
public void testNoValidoCastVueltasMoneda () {
System .out .println ("castVueltasMoneda" );
ArrayList <Integer > monedas = new ArrayList <>();
monedas .add (700 );
ArrayList <Moneda > expResult = new ArrayList <>();
expResult .add (new Moneda (1 , Denominacion .CIEN ));
ArrayList <Moneda > result = prueba .castVueltasMoneda (monedas );
assertNull (result .get (0 ).getDenominacion ());
}
/**
@@ -139,27 +195,44 @@ public void testCastVueltasMoneda() {
@ Test
public void testValidarMonedas () {
System .out .println ("validarMonedas" );
Vending instance = new Vending ();
int expResult = 0 ;
int result = instance .validarMonedas ();
assertEquals (expResult , result );
// TODO review the generated test code and remove the default call to fail.
fail ("The test case is a prototype." );
}
String codigo = "1A" ;
ArrayList <String > adicionales =new ArrayList <>();
adicionales .add ("A1" );
adicionales .add ("A1" );
ArrayList <Integer > monedas = new ArrayList <>();
monedas .add (100 );
prueba .venderProducto ("1A" ,adicionales ,monedas );
int result =-500 ;//porque el valor del producto es mayor
int expResult =prueba .validarMonedas ();
assertEquals (result , expResult );
}
@ Test
public void testNoValidoValidarMonedas () {
System .out .println ("validarMonedas" );
String codigo = "1A" ;
ArrayList <String > adicionales =new ArrayList <>();
adicionales .add ("A1" );
adicionales .add ("A1" );
ArrayList <Integer > monedas = new ArrayList <>();
monedas .add (100 );
prueba .venderProducto ("1A" ,adicionales ,monedas );
int result =-400 ;
int expResult =prueba .validarMonedas ();
assertNotEquals (result , expResult );
}
/*
/**
* Test of buscarAdicionales method, of class Vending.
*/
@ Test
public void testBuscarAdicionales () {
System .out .println ("buscarAdicionales" );
ArrayList <String > adiciones = null ;
Vending instance = new Vending ();
HashMap <String , Adicional > expResult = null ;
HashMap <String , Adicional > result = instance .buscarAdicionales (adiciones );
assertEquals (expResult , result );
// TODO review the generated test code and remove the default call to fail.
fail ("The test case is a prototype." );
ArrayList <String > adicionales =new ArrayList <>();
adicionales .add ("X1" );
adicionales .add ("Y1" );
HashMap <String , Adicional > expResult = new HashMap <>();
HashMap <String , Adicional > result = prueba .buscarAdicionales (adicionales );
assertEquals (expResult .isEmpty (), result .isEmpty ());
}
/**
@@ -172,170 +245,5 @@ public void testDevolverRestante() {
ArrayList <Moneda > expResult = null ;
ArrayList <Moneda > result = instance .devolverRestante ();
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 getGestion method, of class Vending.
*/
@ Test
public void testGetGestion () {
System .out .println ("getGestion" );
Vending instance = new Vending ();
GestionProducto expResult = null ;
GestionProducto result = instance .getGestion ();
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 setGestion method, of class Vending.
*/
@ Test
public void testSetGestion () {
System .out .println ("setGestion" );
GestionProducto gestion = null ;
Vending instance = new Vending ();
instance .setGestion (gestion );
// TODO review the generated test code and remove the default call to fail.
fail ("The test case is a prototype." );
}
/**
* Test of getVentaActual method, of class Vending.
*/
@ Test
public void testGetVentaActual () {
System .out .println ("getVentaActual" );
Vending instance = new Vending ();
Venta expResult = null ;
Venta result = instance .getVentaActual ();
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 setVentaActual method, of class Vending.
*/
@ Test
public void testSetVentaActual () {
System .out .println ("setVentaActual" );
Venta ventaActual = null ;
Vending instance = new Vending ();
instance .setVentaActual (ventaActual );
// TODO review the generated test code and remove the default call to fail.
fail ("The test case is a prototype." );
}
/**
* Test of getVentasRealzadas method, of class Vending.
*/
@ Test
public void testGetVentasRealzadas () {
System .out .println ("getVentasRealzadas" );
Vending instance = new Vending ();
ArrayList <Venta > expResult = null ;
ArrayList <Venta > result = instance .getVentasRealzadas ();
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 setVentasRealzadas method, of class Vending.
*/
@ Test
public void testSetVentasRealzadas () {
System .out .println ("setVentasRealzadas" );
ArrayList <Venta > ventasRealzadas = null ;
Vending instance = new Vending ();
instance .setVentasRealzadas (ventasRealzadas );
// TODO review the generated test code and remove the default call to fail.
fail ("The test case is a prototype." );
}
/**
* Test of getDineroAcumulado method, of class Vending.
*/
@ Test
public void testGetDineroAcumulado () {
System .out .println ("getDineroAcumulado" );
Vending instance = new Vending ();
ArrayList <Moneda > expResult = null ;
ArrayList <Moneda > result = instance .getDineroAcumulado ();
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 setDineroAcumulado method, of class Vending.
*/
@ Test
public void testSetDineroAcumulado () {
System .out .println ("setDineroAcumulado" );
ArrayList <Moneda > dineroAcumulado = null ;
Vending instance = new Vending ();
instance .setDineroAcumulado (dineroAcumulado );
// TODO review the generated test code and remove the default call to fail.
fail ("The test case is a prototype." );
}
/**
* Test of getVentasRealizadas method, of class Vending.
*/
@ Test
public void testGetVentasRealizadas () {
System .out .println ("getVentasRealizadas" );
Vending instance = new Vending ();
ArrayList <Venta > expResult = null ;
ArrayList <Venta > result = instance .getVentasRealizadas ();
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 setVentasRealizadas method, of class Vending.
*/
@ Test
public void testSetVentasRealizadas () {
System .out .println ("setVentasRealizadas" );
ArrayList <Venta > ventasRealizadas = null ;
Vending instance = new Vending ();
instance .setVentasRealizadas (ventasRealizadas );
// TODO review the generated test code and remove the default call to fail.
fail ("The test case is a prototype." );
}
/**
* Test of getCatalogo method, of class Vending.
*/
@ Test
public void testGetCatalogo () {
System .out .println ("getCatalogo" );
Vending instance = new Vending ();
HashMap <String , Producto > expResult = null ;
HashMap <String , Producto > result = instance .getCatalogo ();
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 setCatalogo method, of class Vending.
*/
@ Test
public void testSetCatalogo () {
System .out .println ("setCatalogo" );
HashMap <String , Producto > Catalogo = null ;
Vending instance = new Vending ();
instance .setCatalogo (Catalogo );
// TODO review the generated test code and remove the default call to fail.
fail ("The test case is a prototype." );
}
}