TesteCadastrarChamado.java
From Grupo6 Especoo
(Difference between revisions)
(One intermediate revision not shown) | |||
Line 6: | Line 6: | ||
public class TesteCadastrarChamado extends TestCase | public class TesteCadastrarChamado extends TestCase | ||
{ | { | ||
- | public | + | public void testCadastrarChamadoOK() |
{ | { | ||
+ | System.out.println("testCadastrarChamadoOK()"); | ||
+ | |||
Integer idFunc = new Integer("492563"); | Integer idFunc = new Integer("492563"); | ||
String departamento = "RH"; | String departamento = "RH"; | ||
String descricao = "Problema na impressora"; | String descricao = "Problema na impressora"; | ||
- | TelaCadastraChamado telaCadastroChamado = new TelaCadastraChamado(); | + | |
+ | TMsgErro tMsgErro = new TMsgErro(); | ||
+ | |||
+ | CtrlCadastraChamado ctrlCadastraChamado = new CtrlCadastraChamado(); | ||
+ | |||
+ | ctrlCadastraChamado.addPropertyChangeListener(tMsgErro); | ||
+ | |||
+ | CtrlConfirmaCadastroChamado ctrlConfirmaCadastroChamado = new CtrlConfirmaCadastroChamado(); | ||
+ | |||
+ | ctrlConfirmaCadastroChamado.addPropertyChangeListener(tMsgErro); | ||
+ | |||
+ | TelaCadastraChamado telaCadastroChamado = new TelaCadastraChamado(ctrlCadastraChamado); | ||
telaCadastroChamado.entrarDadosChamado(idFunc, departamento, descricao); | telaCadastroChamado.entrarDadosChamado(idFunc, departamento, descricao); | ||
- | + | assertNull(tMsgErro.getMsgErro()); | |
- | + | ||
+ | assertTrue("Tela de confirmacao de cadastro exibida".equals(tMsgErro.getMsgTela())); | ||
+ | } | ||
+ | |||
+ | public void testCadastrarChamadoNOK() | ||
+ | { | ||
+ | System.out.println("testCadastrarChamadoNOK()"); | ||
+ | |||
+ | Integer idFunc = null; | ||
+ | String departamento = null; | ||
+ | String descricao = null; | ||
+ | |||
+ | TMsgErro tMsgErro = new TMsgErro(); | ||
+ | |||
+ | CtrlCadastraChamado ctrlCadastraChamado = new CtrlCadastraChamado(); | ||
+ | |||
+ | ctrlCadastraChamado.addPropertyChangeListener(tMsgErro); | ||
+ | |||
+ | CtrlConfirmaCadastroChamado ctrlConfirmaCadastroChamado = new CtrlConfirmaCadastroChamado(); | ||
+ | |||
+ | ctrlConfirmaCadastroChamado.addPropertyChangeListener(tMsgErro); | ||
+ | |||
+ | TelaCadastraChamado telaCadastroChamado = new TelaCadastraChamado(ctrlCadastraChamado); | ||
+ | telaCadastroChamado.entrarDadosChamado(idFunc, departamento, descricao); | ||
+ | |||
+ | assertTrue("Erro na insercao do chamado, dados incompletos".equals(tMsgErro.getMsgErro())); | ||
+ | |||
+ | assertNull(tMsgErro.getMsgTela()); | ||
} | } | ||
} | } | ||
</pre> | </pre> |
Current revision as of 20:39, 23 May 2007
package sistemaordemservico; import junit.framework.TestCase; public class TesteCadastrarChamado extends TestCase { public void testCadastrarChamadoOK() { System.out.println("testCadastrarChamadoOK()"); Integer idFunc = new Integer("492563"); String departamento = "RH"; String descricao = "Problema na impressora"; TMsgErro tMsgErro = new TMsgErro(); CtrlCadastraChamado ctrlCadastraChamado = new CtrlCadastraChamado(); ctrlCadastraChamado.addPropertyChangeListener(tMsgErro); CtrlConfirmaCadastroChamado ctrlConfirmaCadastroChamado = new CtrlConfirmaCadastroChamado(); ctrlConfirmaCadastroChamado.addPropertyChangeListener(tMsgErro); TelaCadastraChamado telaCadastroChamado = new TelaCadastraChamado(ctrlCadastraChamado); telaCadastroChamado.entrarDadosChamado(idFunc, departamento, descricao); assertNull(tMsgErro.getMsgErro()); assertTrue("Tela de confirmacao de cadastro exibida".equals(tMsgErro.getMsgTela())); } public void testCadastrarChamadoNOK() { System.out.println("testCadastrarChamadoNOK()"); Integer idFunc = null; String departamento = null; String descricao = null; TMsgErro tMsgErro = new TMsgErro(); CtrlCadastraChamado ctrlCadastraChamado = new CtrlCadastraChamado(); ctrlCadastraChamado.addPropertyChangeListener(tMsgErro); CtrlConfirmaCadastroChamado ctrlConfirmaCadastroChamado = new CtrlConfirmaCadastroChamado(); ctrlConfirmaCadastroChamado.addPropertyChangeListener(tMsgErro); TelaCadastraChamado telaCadastroChamado = new TelaCadastraChamado(ctrlCadastraChamado); telaCadastroChamado.entrarDadosChamado(idFunc, departamento, descricao); assertTrue("Erro na insercao do chamado, dados incompletos".equals(tMsgErro.getMsgErro())); assertNull(tMsgErro.getMsgTela()); } }