<commit_before>package org.drools.eclipse.editors;

import junit.framework.TestCase;

/**
 * 
 * @author <NAME>
 */
public class DSLAdapterTest extends TestCase {
    
    public void testFindExpander() {
        if ( true ) {
            fail( "fail on purpose" );
        }
        
        StringBuffer buf = largeString();
        
        String pat = "\nexpander  \t abc.dsl";
        
        DSLAdapter ad = new DSLAdapter();
        assertEquals("abc.dsl", DSLAdapter.findDSLConfigName( pat ));
        
        
        assertEquals("abc.dsl", DSLAdapter.findDSLConfigName( buf.toString() ));
        
        assertEquals(null, DSLAdapter.findDSLConfigName( "abc /n/n" ));
        
        ad = new DSLAdapter("fdfds", null);
        assertEquals(null, ad.getDSLConfigName());
        
    }
    
    public void testLoadGrammar() throws Exception {
        DSLAdapter ad = new DSLAdapter();
        
        ad.readConfig( this.getClass().getResourceAsStream( "test.dsl" ) );
        assertNotNull(ad.listConditionItems());
        assertNotNull(ad.listConsequenceItems());
    }

    private StringBuffer largeString() {<commit_msg>-no longer fail on purpose<commit_after>package org.drools.eclipse.editors;

import junit.framework.TestCase;

/**
 * 
 * @author <NAME>
 */
public class DSLAdapterTest extends TestCase {
    
    public void testFindExpander() {
        StringBuffer buf = largeString();
        
        String pat = "\nexpander  \t abc.dsl";
        
        DSLAdapter ad = new DSLAdapter();
        assertEquals("abc.dsl", DSLAdapter.findDSLConfigName( pat ));
        
        
        assertEquals("abc.dsl", DSLAdapter.findDSLConfigName( buf.toString() ));
        
        assertEquals(null, DSLAdapter.findDSLConfigName( "abc /n/n" ));
        
        ad = new DSLAdapter("fdfds", null);
        assertEquals(null, ad.getDSLConfigName());
        
    }
    
    public void testLoadGrammar() throws Exception {
        DSLAdapter ad = new DSLAdapter();
        
        ad.readConfig( this.getClass().getResourceAsStream( "test.dsl" ) );
        assertNotNull(ad.listConditionItems());
        assertNotNull(ad.listConsequenceItems());
    }

    private StringBuffer largeString() {
{'fraction_non_alphanumeric': 0.11605937921727395, 'fraction_numerical': 0.0, 'mean_word_length': 2.3095238095238093, 'pattern_counts': {'":': 0, '<': 5, '<?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': '3321451', 'n_tokens_mistral': 652, 'n_tokens_neox': 636, 'n_words': 128}