src/test/java/org/thegalactic/lattice/BijectiveComponentsTest.java
@Test
    public void testsave() {
        try {
            ImplicationalSystem is = new ImplicationalSystem();
            BijectiveComponents bc = new BijectiveComponents(is);
            bc.compute();

            File dir = File.createTempFile("junit", "");
            String directory = dir.getPath();
            dir.delete();
            dir.mkdir();

            bc.save(directory, "");
            File file = new File(directory + File.separator + "BijectiveComponents" + File.separator + "Readme.txt");
            Scanner scanner = new Scanner(file);
            String content = "";
            String newLine = System.getProperty("line.separator");
            while (scanner.hasNextLine()) {
                content += scanner.nextLine() + newLine;
            }
            File[] tabfile = (new File(directory, "BijectiveComponents")).listFiles();
            for (int i = 0; i < tabfile.length; i++) {
                (new File(tabfile[i].getPath())).delete();
            }

            (new File(directory + File.separator + "BijectiveComponents")).delete();
            dir.delete();
            String test = "";
            String safeString = file.getParent() + File.separator;
            test += "-> Initial closure system saved in " + safeString + "InitialClosureSystem.txt: " + newLine;
            test += newLine;
            test += newLine;
            test += "-> Closed set or concept lattice saved in " + safeString + "Lattice.dot" + newLine;
            test += "-> Reduced lattice saved in " + safeString + "ReducedLattice.dot" + newLine;
            test += "-> Table of the reduced lattice saved in " + safeString + "Table.txt" + newLine;
            test += "Observations: " + newLine;
            test += "Attributes: " + newLine;
            test += newLine;
            test += "-> Canonical basis saved in " + safeString + "CanonicalBasis.txt: " + newLine;
            test += newLine;
            test += newLine;
            test += "-> Canonical direct basis of the reduced lattice saved in " + safeString + "CanonicalDirectBasis.txt: " + newLine;
            test += newLine;
            test += newLine;
            test += "-> Dependency Graph  of the reduced lattice saved in " + safeString + "DependencyGraph.dot " + newLine;
            test += "-> Minimal generators  of the reduced lattice are []" + newLine;
            assertEquals(content, test);
        } catch (Exception exception) {
            exception.printStackTrace();
        }
    }
/**
     * Test the save method.
     *
     * TODO make the test Windows compliant
     */
Test the save method.
TODO make the test Windows compliant
Test the save method . TODO make the test Windows compliant
@Test
    public void testsave() {
        try {
            ImplicationalSystem is = new ImplicationalSystem();
            BijectiveComponents bc = new BijectiveComponents(is);
            bc.compute();
            File dir = File.createTempFile("junit", "");
            String directory = dir.getPath();
            dir.delete();
            dir.mkdir();
            bc.save(directory, "");
            File file = new File(directory + File.separator + "BijectiveComponents" + File.separator + "Readme.txt");
            Scanner scanner = new Scanner(file);
            String content = "";
            String newLine = System.getProperty("line.separator");
            while (scanner.hasNextLine()) {
                content += scanner.nextLine() + newLine;
            }
            File[] tabfile = (new File(directory, "BijectiveComponents")).listFiles();
            for (int i = 0; i < tabfile.length; i++) {
                (new File(tabfile[i].getPath())).delete();
            }
            (new File(directory + File.separator + "BijectiveComponents")).delete();
            dir.delete();
            String test = "";
            String safeString = file.getParent() + File.separator;
            test += "-> Initial closure system saved in " + safeString + "InitialClosureSystem.txt: " + newLine;
            test += newLine;
            test += newLine;
            test += "-> Closed set or concept lattice saved in " + safeString + "Lattice.dot" + newLine;
            test += "-> Reduced lattice saved in " + safeString + "ReducedLattice.dot" + newLine;
            test += "-> Table of the reduced lattice saved in " + safeString + "Table.txt" + newLine;
            test += "Observations: " + newLine;
            test += "Attributes: " + newLine;
            test += newLine;
            test += "-> Canonical basis saved in " + safeString + "CanonicalBasis.txt: " + newLine;
            test += newLine;
            test += newLine;
            test += "-> Canonical direct basis of the reduced lattice saved in " + safeString + "CanonicalDirectBasis.txt: " + newLine;
            test += newLine;
            test += newLine;
            test += "-> Dependency Graph  of the reduced lattice saved in " + safeString + "DependencyGraph.dot " + newLine;
            test += "-> Minimal generators  of the reduced lattice are []" + newLine;
            assertEquals(content, test);
        } catch (Exception exception) {
            exception.printStackTrace();
        }
    }
@ Test public void testsave ( ) { try { ImplicationalSystem is = new ImplicationalSystem ( ) ; BijectiveComponents bc = new BijectiveComponents ( is ) ; bc . compute ( ) ; File dir = File . createTempFile ( "junit" , "" ) ; String directory = dir . getPath ( ) ; dir . delete ( ) ; dir . mkdir ( ) ; bc . save ( directory , "" ) ; File file = new File ( directory + File . separator + "BijectiveComponents" + File . separator + "Readme.txt" ) ; Scanner scanner = new Scanner ( file ) ; String content = "" ; String newLine = System . getProperty ( "line.separator" ) ; while ( scanner . hasNextLine ( ) ) { content += scanner . nextLine ( ) + newLine ; } File [ ] tabfile = ( new File ( directory , "BijectiveComponents" ) ) . listFiles ( ) ; for ( int i = 0 ; i < tabfile . length ; i ++ ) { ( new File ( tabfile [ i ] . getPath ( ) ) ) . delete ( ) ; } ( new File ( directory + File . separator + "BijectiveComponents" ) ) . delete ( ) ; dir . delete ( ) ; String test = "" ; String safeString = file . getParent ( ) + File . separator ; test += "-> Initial closure system saved in " + safeString + "InitialClosureSystem.txt: " + newLine ; test += newLine ; test += newLine ; test += "-> Closed set or concept lattice saved in " + safeString + "Lattice.dot" + newLine ; test += "-> Reduced lattice saved in " + safeString + "ReducedLattice.dot" + newLine ; test += "-> Table of the reduced lattice saved in " + safeString + "Table.txt" + newLine ; test += "Observations: " + newLine ; test += "Attributes: " + newLine ; test += newLine ; test += "-> Canonical basis saved in " + safeString + "CanonicalBasis.txt: " + newLine ; test += newLine ; test += newLine ; test += "-> Canonical direct basis of the reduced lattice saved in " + safeString + "CanonicalDirectBasis.txt: " + newLine ; test += newLine ; test += newLine ; test += "-> Dependency Graph  of the reduced lattice saved in " + safeString + "DependencyGraph.dot " + newLine ; test += "-> Minimal generators  of the reduced lattice are []" + newLine ; assertEquals ( content , test ) ; } catch ( Exception exception ) { exception . printStackTrace ( ) ; } }
Test the save method.
Test the save method .