<commit_before>package org.flymine.sql.query;

import junit.framework.*;

public class PostgresExplainResultTest extends TestCase
{
    private PostgresExplainResult er;
    
    public PostgresExplainResultTest(String arg1) {
        super(arg1);
    }
    
    public void setUp() {
        er = new PostgresExplainResult();
    }

    public void testParseWarningString() throws Exception {
        er.parseWarningString("Seq Scan on flibble  (cost=0.00..3.15 rows=2 width=4)\n"
                + "  SubPlan\n    ->  Seq Scan on flibble t  (cost=0.00..1.05 rows=1 width=4)\n");
        assertEquals(2, er.getRows());
        assertEquals(0, er.getStart());
        assertEquals(315, er.getComplete());
        assertEquals(4, er.getWidth());
        assertEquals(2, er.getEstimatedRows());
    }

    public void testParseNullString() throws Exception {
        try {
            er.parseWarningString(null);
            fail("Expected: NullPointerException");
        }
        catch (NullPointerException e) {
        }
    }

    public void testParseEmptyString() throws Exception {
        try {
            er.parseWarningString("");
            fail("Expected: IllegalArgumentException");
        }
        catch (IllegalArgumentException e) {
        }
    }

    public void testParseRubbishString() throws Exception {
        try {
            er.parseWarningString("ljkhafjhaiue,mnz fgsdfes) haskfjsdf");
            fail("Expected: IllegalArgumentException");
        }
        catch (IllegalArgumentException e) {
        }
    }

    public void testParseCraftedString() throws Exception {
        try {
            er.parseWarningString("Flibble Wotsit (cost=76222.25..3241.13 rows2kj"
                    + "hdaslkjasdf) alkjhfasfjasdfkjh");
            fail("Expected: IllegalArgumentException");
        }
        catch (IllegalArgumentException e) {
        }
    }
}
<commit_msg>Added tests for the constructor<commit_after>package org.flymine.sql.query;

import junit.framework.*;

import org.flymine.sql.ConnectionFactory;

public class PostgresExplainResultTest extends TestCase
{
    private PostgresExplainResult er;

    public PostgresExplainResultTest(String arg1) {
        super(arg1);
    }

    public void setUp() {
        er = new PostgresExplainResult();
    }

    public void testParseWarningString() throws Exception {
        er.parseWarningString("Seq Scan on flibble  (cost=0.00..3.15 rows=2 width=4)\n"
                + "  SubPlan\n    ->  Seq Scan on flibble t  (cost=0.00..1.05 rows=1 width=4)\n");
        assertEquals(2, er.getRows());
        assertEquals(0, er.getStart());
        assertEquals(315, er.getComplete());
        assertEquals(4, er.getWidth());
        assertEquals(2, er.getEstimatedRows());
    }

    public void testConstructNullQuery() throws Exception {
        try {
            er = new PostgresExplainResult(null, ConnectionFactory.getConnection("db.unittest"));
            fail("Expected: NullPointerException");
        }
        catch (NullPointerException e) {
        }
    }

    public void testConstructNullConnection() throws Exception {
        try {
            er = new PostgresExplainResult(new Query(), null);
            fail("Expected: NullPointerException");
        }
        catch (NullPointerException e) {
        }
    }

    public void testParseNullString() throws Exception {
        try {
            er.parseWarningString(null);
            fail("Expected: NullPointerException");
        }
        catch (NullPointerException e) {
        }
    }

    public void testParseEmptyString() throws Exception {
        try {
            er.parseWarningString("");
            fail("Expected: IllegalArgumentException");
        }
        catch (IllegalArgumentException e) {
        }
    }

    public void testParseRubbishString() throws Exception {
        try {
            er.parseWarningString("ljkhafjhaiue,mnz fgsdfes) haskfjsdf");
            fail("Expected: IllegalArgumentException");
        }
        catch (IllegalArgumentException e) {
        }
    }

    public void testParseCraftedString() throws Exception {
        try {
            er.parseWarningString("Flibble Wotsit (cost=76222.25..3241.13 rows2kj"
                    + "hdaslkjasdf) alkjhfasfjasdfkjh");
            fail("Expected: IllegalArgumentException");
        }
        catch (IllegalArgumentException e) {
        }
    }
}

{'fraction_non_alphanumeric': 0.1020176830650646, 'fraction_numerical': 0.0176830650646112, 'mean_word_length': 2.2729970326409497, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3230146', 'n_tokens_mistral': 1266, 'n_tokens_neox': 1201, 'n_words': 253}