Coverage Report - br.mia.test.controler.ControladorGeraCasosDeTeste
 
Classes in this File Line Coverage Branch Coverage Complexity
ControladorGeraCasosDeTeste
0%
0/725
0%
0/538
0
 
 1  
 package br.mia.test.controler;
 2  
 
 3  
 import java.awt.Color;
 4  
 import java.io.IOException;
 5  
 import java.sql.SQLException;
 6  
 import java.util.ArrayList;
 7  
 import java.util.List;
 8  
 
 9  
 import org.apache.log4j.Logger;
 10  
 import org.jgraph.JGraph;
 11  
 import org.jgraph.graph.GraphConstants;
 12  
 
 13  
 import br.mia.test.model.CasoUso;
 14  
 import br.mia.test.model.Fluxo;
 15  
 import br.mia.test.model.algoritmo.Algoritmo;
 16  
 import br.mia.test.model.algoritmo.Util;
 17  
 import br.mia.test.model.dao.DAOFlow;
 18  
 import br.mia.test.model.dao.DAOTestCase;
 19  
 import br.mia.test.model.jmi.Flow;
 20  
 import br.mia.test.testcase.CasoTesteStep;
 21  0
 import br.mia.test.testcase.CasosTeste;
 22  
 import br.mia.test.view.graph.StepCell;
 23  
 import br.mia.test.view.graph.observer.ObserverGraphPane;
 24  0
 
 25  0
 public class ControladorGeraCasosDeTeste
 26  0
 {
 27  0
 
 28  0
     public void comparaTelaCasosTeste(ArrayList<Object> casosTeste,
 29  0
             final ArrayList<Object> celulas, JGraph graph, CasoUso useCase,
 30  0
             ObserverGraphPane observer) {
 31  0
         ArrayList<Object> passos = new ArrayList<Object>();
 32  0
         for (Object object : casosTeste) {
 33  0
 
 34  0
             CasosTeste testCase = (CasosTeste) object;
 35  0
             for (Object object2 : testCase.getPassos()) {
 36  0
                 CasoTesteStep step = (CasoTesteStep) object2;
 37  0
                 if (step.getStep().getDatas().size() > 0) {
 38  0
                     passos.add(step.getStep().toOriginal().getDescricao());
 39  
 
 40  
                 } else {
 41  0
 
 42  0
                     passos.add(step.getDescricao());
 43  
 
 44  0
                 }
 45  0
 
 46  0
             }
 47  0
 
 48  0
         }
 49  0
         ArrayList<Object> celulasRemover = new ArrayList<Object>();
 50  0
         for (Object object : celulas) {
 51  0
 
 52  0
             if (object instanceof StepCell) {
 53  0
                 StepCell stepCell = (StepCell) object;
 54  0
                 if (passos.contains(stepCell.getStep().getDescricao())) {
 55  0
 
 56  0
                     celulasRemover.add(stepCell.getStep().getDescricao());
 57  0
 
 58  0
                     GraphConstants.setGradientColor(stepCell.getAttributes(),
 59  0
                             Color.YELLOW);
 60  
 
 61  
                 }
 62  0
 
 63  0
             }
 64  0
 
 65  0
         }
 66  0
 
 67  0
         graph.getGraphLayoutCache().remove(
 68  0
                 graph.getGraphLayoutCache().getCells(true, true, true, true));
 69  0
 
 70  0
         ControladorGraph controladorGraph = new ControladorGraph();
 71  0
         controladorGraph.cria(useCase, celulasRemover, graph,
 72  0
                 new ArrayList<Object>(), observer);
 73  0
 
 74  0
     }
 75  0
 
 76  0
     public ArrayList<CasosTeste> geraCenarios(CasoUso useCase)
 77  0
             throws SQLException, InstantiationException,
 78  0
             IllegalAccessException, ClassNotFoundException, IOException {
 79  0
         ArrayList<CasosTeste> casosTestes = new ArrayList<CasosTeste>();
 80  0
 
 81  0
         DAOFlow daoFlow = new DAOFlow();
 82  0
 
 83  0
         daoFlow.updateStepsAtualizado(useCase);
 84  0
 
 85  0
         Algoritmo alg = new Algoritmo();
 86  0
         alg.limpaArvore(useCase);
 87  0
 
 88  0
         ArrayList<Flow> flows = new ArrayList<Flow>();
 89  0
         flows.addAll(useCase.getFlows());
 90  0
 
 91  0
         alg.retornaCenarios((Fluxo) flows.get(0), 0, new CasosTeste(), 0,
 92  0
                 useCase);
 93  0
         ArrayList<CasosTeste> cenarios = alg.getCasosDeTeste();
 94  0
 
 95  0
         DAOTestCase dao = new DAOTestCase();
 96  0
 
 97  0
         for (Object object : cenarios) {
 98  0
 
 99  0
             CasosTeste casoTeste = (CasosTeste) object;
 100  0
             try {
 101  0
                 CasosTeste novoTeste = new CasosTeste();
 102  0
                 novoTeste.getFlows().addAll(casoTeste.getFlows());
 103  0
                 alg.applyData(casoTeste, 0, novoTeste, useCase, true);
 104  0
 
 105  0
             } catch (Exception e1) {
 106  0
                 ControladorErro.trata(e1, this);
 107  0
             }
 108  0
 
 109  0
         }
 110  0
         int i = 0;
 111  0
 
 112  0
         for (Object object : alg.getCasosDeTesteData()) {
 113  0
 
 114  0
             CasosTeste casoTeste = (CasosTeste) object;
 115  0
 
 116  0
             String descricao = "Caso de teste que realiza os testes de sistema dos fluxos:\n";
 117  0
             String duvidas = "";
 118  0
             String ambiente = "";
 119  0
             List<Fluxo> fluxos = casoTeste.getFlows();
 120  0
             for (Object object1 : fluxos) {
 121  0
 
 122  0
                 Fluxo flow = (Fluxo) object1;
 123  0
                 String novoFluxo = flow.getName();
 124  0
                 String novaDuvida = flow.getDuvidas();
 125  0
                 String novoambiente = flow.getAmbiente();
 126  0
 
 127  0
                 if (!(descricao.contains(novoFluxo))) {
 128  0
                     descricao += novoFluxo + "\n";
 129  0
                 }
 130  0
                 if (novaDuvida == null) {
 131  0
                     novaDuvida = "";
 132  0
                 }
 133  0
                 if (novoambiente == null) {
 134  0
                     novoambiente = "";
 135  0
                 }
 136  0
                 if (!(duvidas.contains(novaDuvida))) {
 137  0
                     duvidas += novaDuvida + "\n";
 138  0
                 }
 139  0
                 if (!(ambiente.contains(novoambiente))) {
 140  0
                     ambiente += novoambiente + "\n";
 141  0
                 }
 142  
 
 143  0
             }
 144  0
 
 145  0
             CasosTeste novoCasoTeste = new CasosTeste();
 146  0
 
 147  0
             novoCasoTeste.setDescricao(descricao);
 148  0
 
 149  0
             if (duvidas.length() > 0) {
 150  0
                 duvidas = "As seguintes ped�ncias foram encontradas :\n"
 151  0
                         + duvidas;
 152  0
             }
 153  0
 
 154  0
             if (duvidas.length() > 1440) {
 155  0
                 novoCasoTeste.setDuvidas(duvidas.substring(0, 440));
 156  0
             } else {
 157  0
                 novoCasoTeste.setDuvidas(duvidas);
 158  0
             }
 159  0
 
 160  0
             if (ambiente.length() > 0) {
 161  0
                 ambiente = "Ambiente de Teste :\n\n" + ambiente;
 162  0
             }
 163  0
 
 164  0
             if (ambiente.length() > 1440) {
 165  0
                 novoCasoTeste.setAmbiente(ambiente.substring(0, 440));
 166  0
             } else {
 167  0
                 novoCasoTeste.setAmbiente(ambiente);
 168  0
             }
 169  0
 
 170  0
             dao.insert(novoCasoTeste, i, useCase, casoTeste.getPassos());
 171  0
             try {
 172  0
                 Thread.sleep(2000);
 173  0
             } catch (InterruptedException e) {
 174  0
                 // TODO Auto-generated catch block
 175  0
                 e.printStackTrace();
 176  
             }
 177  0
             casosTestes.add(casoTeste);
 178  0
             i++;
 179  0
 
 180  0
         }
 181  0
 
 182  0
         return casosTestes;
 183  0
     }
 184  0
 
 185  0
     public ArrayList<CasosTeste> geraScriptCenarios(CasoUso useCase)
 186  0
             throws SQLException, InstantiationException,
 187  0
             IllegalAccessException, ClassNotFoundException, IOException {
 188  0
         ArrayList<CasosTeste> casosTestes = new ArrayList<CasosTeste>();
 189  0
 
 190  0
         DAOFlow daoFlow = new DAOFlow();
 191  0
 
 192  0
         daoFlow.updateStepsAtualizado(useCase);
 193  0
 
 194  0
         Algoritmo alg = new Algoritmo();
 195  0
         alg.limpaArvore(useCase);
 196  0
 
 197  0
         ArrayList<Flow> flows = new ArrayList<Flow>();
 198  0
         flows.addAll(useCase.getFlows());
 199  0
 
 200  0
         alg.retornaCenarios((Fluxo) flows.get(0), 0, new CasosTeste(), 0,
 201  0
                 useCase);
 202  0
         ArrayList<CasosTeste> cenarios = alg.getCasosDeTeste();
 203  0
 
 204  0
         DAOTestCase dao = new DAOTestCase();
 205  0
 
 206  0
         int i = 0;
 207  0
 
 208  0
         for (Object object : cenarios) {
 209  0
 
 210  0
             CasosTeste casoTeste = (CasosTeste) object;
 211  0
 
 212  0
             Util.aplicaDados(casoTeste, useCase, i, casosTestes);
 213  0
             i++;
 214  0
 
 215  0
         }
 216  0
 
 217  0
         return casosTestes;
 218  0
     }
 219  0
 
 220  0
     public ArrayList<CasosTeste> geraCasosTesteArrayListProbabilidadeRandom(
 221  0
             CasoUso useCase) throws SQLException, InstantiationException,
 222  0
             IllegalAccessException, ClassNotFoundException, IOException {
 223  0
         ArrayList<CasosTeste> casosTestes = new ArrayList<CasosTeste>();
 224  0
         DAOFlow daoFlow = new DAOFlow();
 225  0
 
 226  0
         daoFlow.updateStepsAtualizado(useCase);
 227  0
 
 228  0
         Algoritmo alg = new Algoritmo();
 229  0
         alg.limpaArvore(useCase);
 230  0
         alg.bestPathProbalilidadeRandom((Fluxo) useCase.getFlows().get(0), 0,
 231  0
                 new CasosTeste(), 0, useCase);
 232  0
         ArrayList<CasosTeste> cenarios = alg.getCasosDeTeste();
 233  0
 
 234  0
         for (Object object : cenarios) {
 235  0
 
 236  0
             CasosTeste casoTeste = (CasosTeste) object;
 237  0
             try {
 238  0
                 CasosTeste novoTeste = new CasosTeste();
 239  0
                 novoTeste.getFlows().addAll(casoTeste.getFlows());
 240  0
                 alg.applyData(casoTeste, 0, novoTeste, useCase, true);
 241  
 
 242  0
             } catch (Exception e1) {
 243  0
                 ControladorErro.trata(e1, this);
 244  0
             }
 245  0
 
 246  0
         }
 247  
 
 248  0
         for (Object object : alg.getCasosDeTesteData()) {
 249  0
 
 250  0
             CasosTeste casoTeste = (CasosTeste) object;
 251  0
             try {
 252  0
                 String descricao = "Caso de teste que realiza os testes de sistema dos fluxos:\n";
 253  0
                 String duvidas = "";
 254  0
                 String ambiente = "";
 255  0
                 List<Fluxo> fluxos = casoTeste.getFlows();
 256  0
                 for (Object object1 : fluxos) {
 257  
 
 258  0
                     Fluxo flow = (Fluxo) object1;
 259  0
                     String novoFluxo = flow.getName();
 260  0
                     String novaDuvida = flow.getDuvidas();
 261  0
                     String novoambiente = flow.getAmbiente();
 262  0
 
 263  0
                     if (!(descricao.contains(novoFluxo))) {
 264  0
                         descricao += novoFluxo + "\n";
 265  0
                     }
 266  0
                     if (novaDuvida == null) {
 267  0
                         novaDuvida = "";
 268  0
                     }
 269  0
                     if (novoambiente == null) {
 270  0
                         novoambiente = "";
 271  0
                     }
 272  0
                     if (!(duvidas.contains(novaDuvida))) {
 273  0
                         duvidas += novaDuvida + "\n";
 274  0
                     }
 275  0
                     if (!(ambiente.contains(novoambiente))) {
 276  0
                         ambiente += novoambiente + "\n";
 277  0
                     }
 278  0
 
 279  0
                 }
 280  0
 
 281  0
                 casoTeste.setDescricao(descricao);
 282  0
 
 283  0
                 if (duvidas.length() > 0) {
 284  0
                     duvidas = "As seguintes ped�ncias foram encontradas :\n"
 285  0
                             + duvidas;
 286  0
                 }
 287  
 
 288  0
                 if (duvidas.length() > 1440) {
 289  0
                     casoTeste.setDuvidas(duvidas.substring(0, 440));
 290  0
                 } else {
 291  0
                     casoTeste.setDuvidas(duvidas);
 292  0
                 }
 293  0
 
 294  0
                 if (ambiente.length() > 0) {
 295  0
                     ambiente = "Ambiente de Teste :\n\n" + ambiente;
 296  0
                 }
 297  
 
 298  0
                 if (ambiente.length() > 1440) {
 299  0
                     casoTeste.setAmbiente(ambiente.substring(0, 440));
 300  0
                 } else {
 301  0
                     casoTeste.setAmbiente(ambiente);
 302  0
                 }
 303  0
 
 304  0
                 casosTestes.add(casoTeste);
 305  0
 
 306  0
             } catch (Exception e1) {
 307  0
                 ControladorErro.trata(e1, this);
 308  0
             }
 309  0
 
 310  0
         }
 311  0
         return casosTestes;
 312  0
     }
 313  0
 
 314  0
     public ArrayList<CasosTeste> geraCasosTesteArrayListProbabilidadeMinima(
 315  
             CasoUso useCase, double probabilidade) throws SQLException,
 316  0
             InstantiationException, IllegalAccessException,
 317  0
             ClassNotFoundException, IOException {
 318  0
         ArrayList<CasosTeste> casosTestes = new ArrayList<CasosTeste>();
 319  0
         DAOFlow daoFlow = new DAOFlow();
 320  0
 
 321  0
         daoFlow.updateStepsAtualizado(useCase);
 322  0
 
 323  0
         Algoritmo alg = new Algoritmo();
 324  0
         alg.limpaArvore(useCase);
 325  0
         alg.bestPathProbalilidade((Fluxo) useCase.getFlows().get(0), 0,
 326  0
                 new CasosTeste(), 0, useCase, probabilidade);
 327  0
         ArrayList<CasosTeste> cenarios = alg.getCasosDeTeste();
 328  0
 
 329  0
         for (Object object : cenarios) {
 330  0
 
 331  0
             CasosTeste casoTeste = (CasosTeste) object;
 332  
             try {
 333  0
                 CasosTeste novoTeste = new CasosTeste();
 334  0
                 novoTeste.getFlows().addAll(casoTeste.getFlows());
 335  0
                 alg.applyData(casoTeste, 0, novoTeste, useCase, true);
 336  0
 
 337  0
             } catch (Exception e1) {
 338  0
                 ControladorErro.trata(e1, this);
 339  0
             }
 340  0
 
 341  0
         }
 342  
 
 343  0
         for (Object object : alg.getCasosDeTesteData()) {
 344  0
 
 345  0
             CasosTeste casoTeste = (CasosTeste) object;
 346  
             try {
 347  0
                 String descricao = "Caso de teste que realiza os testes de sistema dos fluxos:\n";
 348  0
                 String duvidas = "";
 349  0
                 String ambiente = "";
 350  0
                 List<Fluxo> fluxos = casoTeste.getFlows();
 351  0
                 for (Object object1 : fluxos) {
 352  0
 
 353  0
                     Fluxo flow = (Fluxo) object1;
 354  0
                     String novoFluxo = flow.getName();
 355  0
                     String novaDuvida = flow.getDuvidas();
 356  0
                     String novoambiente = flow.getAmbiente();
 357  0
 
 358  0
                     if (!(descricao.contains(novoFluxo))) {
 359  0
                         descricao += novoFluxo + "\n";
 360  
                     }
 361  0
                     if (novaDuvida == null) {
 362  0
                         novaDuvida = "";
 363  0
                     }
 364  0
                     if (novoambiente == null) {
 365  0
                         novoambiente = "";
 366  
                     }
 367  0
                     if (!(duvidas.contains(novaDuvida))) {
 368  0
                         duvidas += novaDuvida + "\n";
 369  0
                     }
 370  0
                     if (!(ambiente.contains(novoambiente))) {
 371  0
                         ambiente += novoambiente + "\n";
 372  0
                     }
 373  0
 
 374  0
                 }
 375  0
 
 376  0
                 casoTeste.setDescricao(descricao);
 377  0
 
 378  0
                 if (duvidas.length() > 0) {
 379  0
                     duvidas = "As seguintes ped�ncias foram encontradas :\n"
 380  0
                             + duvidas;
 381  0
                 }
 382  0
 
 383  0
                 if (duvidas.length() > 1440) {
 384  0
                     casoTeste.setDuvidas(duvidas.substring(0, 440));
 385  0
                 } else {
 386  0
                     casoTeste.setDuvidas(duvidas);
 387  0
                 }
 388  0
 
 389  0
                 if (ambiente.length() > 0) {
 390  0
                     ambiente = "Ambiente de Teste :\n\n" + ambiente;
 391  0
                 }
 392  0
 
 393  0
                 if (ambiente.length() > 1440) {
 394  0
                     casoTeste.setAmbiente(ambiente.substring(0, 440));
 395  0
                 } else {
 396  0
                     casoTeste.setAmbiente(ambiente);
 397  0
                 }
 398  0
 
 399  0
                 casosTestes.add(casoTeste);
 400  0
 
 401  0
             } catch (Exception e1) {
 402  0
                 ControladorErro.trata(e1, this);
 403  0
             }
 404  0
 
 405  0
         }
 406  0
         return casosTestes;
 407  0
     }
 408  0
 
 409  0
     public ArrayList<CasosTeste> geraCasosTesteArrayList(CasoUso useCase)
 410  0
             throws SQLException, InstantiationException,
 411  0
             IllegalAccessException, ClassNotFoundException, IOException {
 412  0
         ArrayList<CasosTeste> casosTestes = new ArrayList<CasosTeste>();
 413  0
         DAOFlow daoFlow = new DAOFlow();
 414  0
 
 415  0
         daoFlow.updateStepsAtualizado(useCase);
 416  0
 
 417  0
         Algoritmo alg = new Algoritmo();
 418  0
         alg.limpaArvore(useCase);
 419  0
         alg.retornaCenarios((Fluxo) useCase.getFlows().get(0), 0,
 420  0
                 new CasosTeste(), 0, useCase);
 421  0
         ArrayList<CasosTeste> cenarios = alg.getCasosDeTeste();
 422  0
 
 423  0
         for (Object object : cenarios) {
 424  0
 
 425  0
             CasosTeste casoTeste = (CasosTeste) object;
 426  0
             try {
 427  0
                 CasosTeste novoTeste = new CasosTeste();
 428  0
                 novoTeste.getFlows().addAll(casoTeste.getFlows());
 429  0
                 alg.applyData(casoTeste, 0, novoTeste, useCase, true);
 430  0
 
 431  0
             } catch (Exception e1) {
 432  0
                 ControladorErro.trata(e1, this);
 433  0
             }
 434  0
 
 435  0
         }
 436  0
 
 437  0
         for (Object object : alg.getCasosDeTesteData()) {
 438  0
 
 439  0
             CasosTeste casoTeste = (CasosTeste) object;
 440  0
             try {
 441  0
                 String descricao = "Caso de teste que realiza os testes de sistema dos fluxos:\n";
 442  0
                 String duvidas = "";
 443  0
                 String ambiente = "";
 444  0
                 List<Fluxo> fluxos = casoTeste.getFlows();
 445  0
                 for (Object object1 : fluxos) {
 446  0
 
 447  0
                     Fluxo flow = (Fluxo) object1;
 448  0
                     String novoFluxo = flow.getName();
 449  0
                     String novaDuvida = flow.getDuvidas();
 450  0
                     String novoambiente = flow.getAmbiente();
 451  0
 
 452  0
                     if (!(descricao.contains(novoFluxo))) {
 453  0
                         descricao += novoFluxo + "\n";
 454  0
                     }
 455  0
                     if (novaDuvida == null) {
 456  0
                         novaDuvida = "";
 457  0
                     }
 458  0
                     if (novoambiente == null) {
 459  0
                         novoambiente = "";
 460  
                     }
 461  0
                     if (!(duvidas.contains(novaDuvida))) {
 462  0
                         duvidas += novaDuvida + "\n";
 463  0
                     }
 464  0
                     if (!(ambiente.contains(novoambiente))) {
 465  0
                         ambiente += novoambiente + "\n";
 466  0
                     }
 467  0
 
 468  0
                 }
 469  0
 
 470  0
                 casoTeste.setDescricao(descricao);
 471  0
 
 472  0
                 if (duvidas.length() > 0) {
 473  0
                     duvidas = "As seguintes ped�ncias foram encontradas :\n"
 474  0
                             + duvidas;
 475  
                 }
 476  0
 
 477  0
                 if (duvidas.length() > 1440) {
 478  0
                     casoTeste.setDuvidas(duvidas.substring(0, 440));
 479  0
                 } else {
 480  0
                     casoTeste.setDuvidas(duvidas);
 481  0
                 }
 482  0
 
 483  0
                 if (ambiente.length() > 0) {
 484  0
                     ambiente = "Ambiente de Teste :\n\n" + ambiente;
 485  0
                 }
 486  0
 
 487  0
                 if (ambiente.length() > 1440) {
 488  0
                     casoTeste.setAmbiente(ambiente.substring(0, 440));
 489  0
                 } else {
 490  0
                     casoTeste.setAmbiente(ambiente);
 491  
                 }
 492  0
 
 493  0
                 casosTestes.add(casoTeste);
 494  0
 
 495  0
             } catch (Exception e1) {
 496  0
                 ControladorErro.trata(e1, this);
 497  0
             }
 498  0
 
 499  0
         }
 500  0
 
 501  0
         Logger log = br.mia.test.util.Util.getLogger();
 502  0
 
 503  0
         log.info(alg.getFiltrosAplicados());
 504  0
 
 505  0
         return casosTestes;
 506  0
 
 507  0
     }
 508  0
 
 509  0
     public ArrayList<CasosTeste> geraCasosTesteRandomico(CasoUso useCase)
 510  0
             throws SQLException, InstantiationException,
 511  0
             IllegalAccessException, ClassNotFoundException, IOException {
 512  0
         ArrayList<CasosTeste> casosTestes = new ArrayList<CasosTeste>();
 513  0
         DAOFlow daoFlow = new DAOFlow();
 514  0
 
 515  0
         daoFlow.updateStepsAtualizado(useCase);
 516  0
 
 517  0
         Algoritmo alg = new Algoritmo();
 518  0
         alg.limpaArvore(useCase);
 519  0
         alg.bestPathProbalilidadeRandom((Fluxo) useCase.getFlows().get(0), 0,
 520  0
                 new CasosTeste(), 0, useCase);
 521  0
         ArrayList<CasosTeste> cenarios = alg.getCasosDeTeste();
 522  0
 
 523  0
         DAOTestCase dao = new DAOTestCase();
 524  0
 
 525  0
         for (Object object : cenarios) {
 526  0
 
 527  0
             CasosTeste casoTeste = (CasosTeste) object;
 528  0
             try {
 529  0
                 CasosTeste novoTeste = new CasosTeste();
 530  0
                 novoTeste.getFlows().addAll(casoTeste.getFlows());
 531  0
                 alg.applyData(casoTeste, 0, novoTeste, useCase, true);
 532  0
 
 533  0
             } catch (Exception e1) {
 534  0
                 ControladorErro.trata(e1, this);
 535  0
             }
 536  0
 
 537  0
         }
 538  0
         int i = 0;
 539  0
         for (Object object : alg.getCasosDeTesteData()) {
 540  0
 
 541  0
             CasosTeste casoTeste = (CasosTeste) object;
 542  0
 
 543  0
             Util.aplicaDados(casoTeste, useCase, i, casosTestes);
 544  0
             i++;
 545  0
 
 546  0
         }
 547  0
         return casosTestes;
 548  0
     }
 549  0
 
 550  0
     public ArrayList<CasosTeste> geraCasosTesteProbabilidadeMinima(
 551  0
             CasoUso useCase, double probabilidade) throws SQLException,
 552  0
             InstantiationException, IllegalAccessException,
 553  0
             ClassNotFoundException, IOException {
 554  0
         ArrayList<CasosTeste> casosTestes = new ArrayList<CasosTeste>();
 555  0
         DAOFlow daoFlow = new DAOFlow();
 556  0
 
 557  0
         daoFlow.updateStepsAtualizado(useCase);
 558  
 
 559  0
         Algoritmo alg = new Algoritmo();
 560  0
         alg.limpaArvore(useCase);
 561  0
         alg.bestPathProbalilidade((Fluxo) useCase.getFlows().get(0), 0,
 562  0
                 new CasosTeste(), 0, useCase, probabilidade);
 563  0
         ArrayList<CasosTeste> cenarios = alg.getCasosDeTeste();
 564  0
 
 565  0
         DAOTestCase dao = new DAOTestCase();
 566  0
 
 567  0
         for (Object object : cenarios) {
 568  0
 
 569  0
             CasosTeste casoTeste = (CasosTeste) object;
 570  0
             try {
 571  0
                 CasosTeste novoTeste = new CasosTeste();
 572  0
                 novoTeste.getFlows().addAll(casoTeste.getFlows());
 573  0
                 alg.applyData(casoTeste, 0, novoTeste, useCase, true);
 574  0
 
 575  0
             } catch (Exception e1) {
 576  0
                 ControladorErro.trata(e1, this);
 577  0
             }
 578  0
 
 579  0
         }
 580  0
         int i = 0;
 581  0
         for (Object object : alg.getCasosDeTesteData()) {
 582  0
 
 583  0
             CasosTeste casoTeste = (CasosTeste) object;
 584  0
             Util.aplicaDados(casoTeste, useCase, i, casosTestes);
 585  0
             i++;
 586  0
 
 587  0
         }
 588  0
         return casosTestes;
 589  0
     }
 590  0
 
 591  0
 }