Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /*
- * To change this license header, choose License Headers in Project Properties.
- * To change this template file, choose Tools | Templates
- * and open the template in the editor.
- */
- package Utils;
- import core.domain.RiskFactors.Metric;
- import core.domain.RiskFactors.RiskFactor;
- import core.domain.RiskFactors.STName;
- import core.domain.RiskFactors.SurroundingType;
- import core.domain.RiskMatrixs.Line;
- import core.domain.RiskMatrixs.MatrixBuilder;
- import core.persistence.CoverageRepository;
- import core.persistence.PersistenceContext;
- import core.persistence.RiskFactorRepository;
- import core.persistence.SurroundingTypeRepository;
- import domain.Coverages.Coverage;
- import java.io.IOException;
- import java.util.ArrayList;
- import java.util.List;
- import org.junit.After;
- import org.junit.AfterClass;
- import org.junit.Before;
- import org.junit.BeforeClass;
- import org.junit.Test;
- import static org.junit.Assert.*;
- /**
- *
- * @author morei
- */
- public class FactorImportTest {
- SurroundingType s1 = new SurroundingType(new STName("Bombeiros"));
- Metric m1 = new Metric("Distancia");
- RiskFactor rf1 = new RiskFactor(m1, s1.obtainSTName());
- Metric m2 = new Metric("Tempo");
- RiskFactor rf2 = new RiskFactor(m2, s1.obtainSTName());
- SurroundingType s2 = new SurroundingType(new STName("Floresta"));
- Metric m3 = new Metric("Area");
- RiskFactor rf3 = new RiskFactor(m3, s2.obtainSTName());
- SurroundingType s3 = new SurroundingType(new STName("Vias Acesso"));
- Metric m4 = new Metric("Quantidade");
- RiskFactor rf4 = new RiskFactor(m4, s3.obtainSTName());
- CoverageRepository coverageRepository = PersistenceContext.repositories().coverageRepository();
- RiskFactorRepository riskFactorRepository = PersistenceContext.repositories().riskRepository();
- SurroundingTypeRepository surroundingTypeRepository = PersistenceContext.repositories().surroundingRepository();
- public FactorImportTest() {
- }
- @BeforeClass
- public static void setUpClass() {
- }
- @AfterClass
- public static void tearDownClass() {
- }
- @Before
- public void setUp() {
- surroundingTypeRepository.save(s1);
- surroundingTypeRepository.save(s2);
- surroundingTypeRepository.save(s3);
- }
- @After
- public void tearDown() {
- }
- //
- /**
- * Test of listRiskFactor method, of class FactorImport.
- */
- @Test
- public void testListRiskFactor() throws IOException {
- System.out.println("listRiskFactor");
- String[] f1 = {"", "Bombeiros", "", "Floresta", "Vias Acesso"};
- String[] f2 = {"", "Distancia", "Tempo", "Area", "Quantidade"};
- FactorImport instance = new FactorImport();
- List<RiskFactor> expResult = new ArrayList<>();
- expResult.add(rf1);
- expResult.add(rf2);
- expResult.add(rf3);
- expResult.add(rf4);
- List<RiskFactor> result = instance.getListRiskFactor(f1, f2);
- assertArrayEquals(expResult.toArray(), result.toArray());
- }
- /**
- * Test of importFactorValues method, of class FactorImport.
- */
- // @Test
- // public void testImportFactorValues() throws Exception {
- // System.out.println("importFactorValues");
- // String fileName = "";
- // MatrixBuilder mb = new MatrixBuilder(MatrixBuilder.State.BASE);
- // FactorImport instance = new FactorImport();
- // List<Line> expResult = new ArrayList<>();
- // List<Line> result = instance.importFactorValues(fileName, mb);
- // assertEquals(expResult, result);
- // }
- //
- // /**
- // * Test of getRiskFactorList method, of class FactorImport.
- // */
- // @Test
- // public void testGetRiskFactorList() {
- // System.out.println("getRiskFactorList");
- // String[] f1 = null;
- // String[] f2 = null;
- // FactorImport instance = new FactorImport();
- // List<RiskFactor> expResult = null;
- // List<RiskFactor> result = instance.getRiskFactorList(f1, f2);
- // assertEquals(expResult, result);
- // // TODO review the generated test code and remove the default call to fail.
- // fail("The test case is a prototype.");
- // }
- //
- // /**
- // * Test of getLine method, of class FactorImport.
- // */
- // @Test
- // public void testGetLine() {
- // System.out.println("getLine");
- // Coverage c = null;
- // List<RiskFactor> listRisk = null;
- // String[] line = null;
- // String tipo = "";
- // MatrixBuilder mb = null;
- // FactorImport instance = new FactorImport();
- // Line expResult = null;
- // Line result = instance.getLine(c, listRisk, line, tipo, mb);
- // assertEquals(expResult, result);
- // // TODO review the generated test code and remove the default call to fail.
- // fail("The test case is a prototype.");
- // }
- //
- // /**
- // * Test of importMeaningfulFactors method, of class FactorImport.
- // */
- // @Test
- // public void testImportMeaningfulFactors() throws Exception {
- // System.out.println("importMeaningfulFactors");
- // String fileName = "";
- // MatrixBuilder mb = null;
- // FactorImport instance = new FactorImport();
- // boolean expResult = false;
- // boolean result = instance.importMeaningfulFactors(fileName, mb);
- // assertEquals(expResult, result);
- // // TODO review the generated test code and remove the default call to fail.
- // fail("The test case is a prototype.");
- // }
- //
- // /**
- // * Test of imporBaseRiskMatrix method, of class FactorImport.
- // */
- // @Test
- // public void testImporBaseRiskMatrix() throws Exception {
- // System.out.println("imporBaseRiskMatrix");
- // String fileName = "";
- // MatrixBuilder matrixBuilder = null;
- // FactorImport instance = new FactorImport();
- // boolean expResult = false;
- // boolean result = instance.imporBaseRiskMatrix(fileName, matrixBuilder);
- // assertEquals(expResult, result);
- // // TODO review the generated test code and remove the default call to fail.
- // fail("The test case is a prototype.");
- // }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement