src/test/java/org/thegalactic/context/io/ContextSerializerCsvTest.java
@Test
    public void testWithoutIndividualIdentifiers() {
        try {
            File file;
            String filename = "";
            file = File.createTempFile("junit", ".csv");
            filename = file.getPath();
            BufferedWriter writer = new BufferedWriter(new FileWriter(filename));
            writer.write("a,b,c");
            writer.newLine();
            writer.write("1,0,0");
            writer.newLine();
            writer.write("1,1,0");
            writer.close();
            Context context = new Context(filename);
            file.delete();
            assertEquals(context.getExtent("a").toString(), "[1, 2]");
            assertEquals(context.getExtent("b").toString(), "[2]");
            assertEquals(context.getExtent("c").toString(), "[]");
        } catch (Exception e) {
            e.printStackTrace();
        }
    }
/**
     * Test first line without individual identifiers.
     */
Test first line without individual identifiers.
Test first line without individual identifiers .
@Test
    public void testWithoutIndividualIdentifiers() {
        try {
            File file;
            String filename = "";
            file = File.createTempFile("junit", ".csv");
            filename = file.getPath();
            BufferedWriter writer = new BufferedWriter(new FileWriter(filename));
            writer.write("a,b,c");
            writer.newLine();
            writer.write("1,0,0");
            writer.newLine();
            writer.write("1,1,0");
            writer.close();
            Context context = new Context(filename);
            file.delete();
            assertEquals(context.getExtent("a").toString(), "[1, 2]");
            assertEquals(context.getExtent("b").toString(), "[2]");
            assertEquals(context.getExtent("c").toString(), "[]");
        } catch (Exception e) {
            e.printStackTrace();
        }
    }
@ Test public void testWithoutIndividualIdentifiers ( ) { try { File file ; String filename = "" ; file = File . createTempFile ( "junit" , ".csv" ) ; filename = file . getPath ( ) ; BufferedWriter writer = new BufferedWriter ( new FileWriter ( filename ) ) ; writer . write ( "a,b,c" ) ; writer . newLine ( ) ; writer . write ( "1,0,0" ) ; writer . newLine ( ) ; writer . write ( "1,1,0" ) ; writer . close ( ) ; Context context = new Context ( filename ) ; file . delete ( ) ; assertEquals ( context . getExtent ( "a" ) . toString ( ) , "[1, 2]" ) ; assertEquals ( context . getExtent ( "b" ) . toString ( ) , "[2]" ) ; assertEquals ( context . getExtent ( "c" ) . toString ( ) , "[]" ) ; } catch ( Exception e ) { e . printStackTrace ( ) ; } }
Test first line without individual identifiers.
Test first line without individual identifiers .