public EditarPedidoInterface(Pedido pedido) { initComponents(); String[] data = pedido.getDatapedido().split("/"); this.nomeprod.setDocument(new LengthRestrictedDocument(50)); this.nomefab.setDocument(new LengthRestrictedDocument(50)); this.model.setDocument(new LengthRestrictedDocument(20)); this.quant.setDocument(new LengthRestrictedDocument(10)); this.valor.setDocument(new LengthRestrictedDocument(10)); this.obs.setDocument(new LengthRestrictedDocument(200)); this.dia.setDocument(new IntegersOnlyDocument(2)); this.mes.setDocument(new IntegersOnlyDocument(2)); this.ano.setDocument(new IntegersOnlyDocument(4)); this.dia.setText(data[0]); this.mes.setText(data[1]); this.ano.setText(data[2]); this.nomeprod.setText(pedido.getNomeproduto()); this.nomefab.setText(pedido.getNomefabricante()); this.model.setText(pedido.getModelo()); this.quant.setText(pedido.getQuantidade()); this.valor.setText(pedido.getValor()); // this.obs.setText(pedido.getObs); this.dia.setEnabled(false); this.mes.setEnabled(false); this.ano.setEnabled(false); this.nomeprod.setEnabled(false); this.nomefab.setEnabled(false); this.model.setEnabled(false); this.quant.setEnabled(false); this.model.setEnabled(false); this.obs.setEditable(false); this.pedidoatual = pedido; }
@Test public void testOK() throws ParseException { Date dataValidade = (Date) formatter.parse("2012-12-25"); Date dataLimite = (Date) formatter.parse("2012-05-15"); Pedido pedido = new Pedido(dataValidade, "12345", 500.0f, dataLimite); assertEquals("12345", pedido.getNumCartao()); assertEquals(500.0f, pedido.getValor(), 0.00001f); assertEquals(dataValidade, pedido.getDataValidade()); assertEquals(dataLimite, pedido.getDataLimite()); }