Skip to content

Instantly share code, notes, and snippets.

@edubriguenti
Last active December 26, 2015 22:19
Show Gist options
  • Save edubriguenti/7222185 to your computer and use it in GitHub Desktop.
Save edubriguenti/7222185 to your computer and use it in GitHub Desktop.
Teste de web-service com JUNIT
@RunWith(MockitoJUnitRunner.class)
public class AcessoDadosCadastroSeguradoTest {
protected static URL wsdlURL;
protected static QName serviceName;
protected static QName portName;
static {
serviceName = new QName("XX", "XX");
portName = new QName("XX", "XX");
try {
wsdlURL = new URL("XXXXX");
} catch (MalformedURLException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
@Before
public void setUp() throws Exception {
System.out.println("Setup");
}
@Test
public void testeServicoObter() {
AcessoDadosCadastroSeguradoService acessoDadosCadastroSeguradoService = new AcessoDadosCadastroSeguradoService(wsdlURL,serviceName);
AcessoDadosCadastroSegurado port = acessoDadosCadastroSeguradoService.getAcessoDadosCadastroSeguradoPort();
List<Restricao> listaRestricao = new ArrayList<Restricao>();
Restricao restricao = new Restricao();
restricao.setNomeAtributo("segurado.numeroDigitoSegurado");
restricao.setOperadorRestricao("=");
restricao.setValorRestricao("1");
listaRestricao.add(restricao);
List<String> listaAtributos = new ArrayList<String>();
listaAtributos.add("segurado.nomeSegurado");
List<Segurado> obter = port.obter(listaAtributos, listaRestricao);
assertNotNull(obter);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment