Skip to content

Instantly share code, notes, and snippets.

@rodrigoy
Created April 20, 2010 05:05
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save rodrigoy/372053 to your computer and use it in GitHub Desktop.
Save rodrigoy/372053 to your computer and use it in GitHub Desktop.
import junit.framework.Assert;
import org.junit.Test;
/**
* Ora, pois, deve mostrar na tela há quanto tempo o pedido foi emitido...
* @author Joaquim Manoel
*
*/
public class PedidoTest {
final int SEG = 1000;
final int MIN = 60 * SEG;
final int H = 60 * MIN;
final int DIA = 24 * H;
final int MES = 30 * DIA;
@Test
public void deveMostrarXXMinutos () throws Exception {
Pedido pedido = new Pedido();
Thread.sleep(10 * MIN);
Assert.assertEquals("10 minutos", pedido.getEmitidoHa());
}
@Test
public void deveMostrarXXDias () throws Exception {
Pedido pedido = new Pedido();
Thread.sleep(10 * DIA);
Assert.assertEquals("10 dias", pedido.getEmitidoHa());
}
@Test
public void deveMostrarXXMeses () throws Exception {
Pedido pedido = new Pedido();
Thread.sleep(3 * MES);
Assert.assertEquals("3 Meses", pedido.getEmitidoHa());
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment