<commit_before>package isomorphly;

import isomorphly.annotations.Component;
import isomorphly.annotations.Group;

import java.util.List;

import junit.framework.Test;
import junit.framework.TestCase;
import junit.framework.TestSuite;

/**
 * Unit test for IsomorphlyEngine.
 */
public class IsomorphlyEngineTest extends TestCase
{
    /**
     * Create the test case
     *
     * @param testName name of the test case
     */
	private IsomorphlyEngine engine;
	
    public IsomorphlyEngineTest( String testName )
    {
        super( testName );
        String packageNames[] = {"test.isomorphly.dummy.annotations"};
        engine = new IsomorphlyEngine(packageNames);
    }

    /**
     * @return the suite of tests being tested
     */
    public static Test suite()
    {
        return new TestSuite( IsomorphlyEngineTest.class );
    }

    public void testIsomorphlyEngineInstance()
    {
        assertTrue( engine != null );
    }
    
    public void testEngineInit() {
        engine.init();
        assertTrue("engine not properly initialized.", engine.isInitialized());
    }

    public void testGroupScan()
    {
    	engine.init();
    	
    	List<Class<?>> groups = engine.getIsomorphlyGroups();
    	
    	assertNotNull("Groups should not null. Is engine's initialization ok?", groups);

    	assertTrue("Groups should not be empty. Is engine's initialization ok?", groups.size() > 0);
    	
    	for (Class<?> cls : groups) {
    		assertTrue(cls.isAnnotation());
    		assertTrue(cls.isAnnotationPresent(Group.class));
    	}

    	assertTrue(true);
    }
    
    public void testComponentsScan()
    {
    	engine.init();
    	
    	List<Class<?>> components = engine.getIsomorphlyComponents();
    	
    	assertNotNull("Components should not null. Is engine's initialization ok?", components);

    	assertTrue("Components should not be empty. Is engine's initialization ok?", components.size() > 0);
    	
    	for (Class<?> cls : components) {
    		assertTrue(cls.isAnnotation());
    		assertTrue(cls.isAnnotationPresent(Component.class));
    	}

    	assertTrue(true);
    }
    
    public void testMethodsScan()
    {
    	/*
    	engine.init();
    	
    	List<Class<?>> groups = engine.getIsomorphlyGroups();
    	
    	for (Class<?> cls : groups) {
    		assertTrue(cls.isAnnotation());
    		assertTrue(cls.isAnnotationPresent(Group.class));
    	}
*/
    	assertTrue(engine != null);
    }<commit_msg>added tests to validate client components annotations<commit_after>package isomorphly;

import isomorphly.annotations.Component;
import isomorphly.annotations.Group;

import java.lang.annotation.Annotation;
import java.util.List;

import test.isomorphly.dummy.annotations.Plugin;
import junit.framework.Test;
import junit.framework.TestCase;
import junit.framework.TestSuite;

/**
 * Unit test for IsomorphlyEngine.
 */
public class IsomorphlyEngineTest extends TestCase
{
    /**
     * Create the test case
     *
     * @param testName name of the test case
     */
	private IsomorphlyEngine engine;
	
    public IsomorphlyEngineTest( String testName )
    {
        super( testName );
        String packageNames[] = {"test.isomorphly.dummy.annotations", "test.isomorphly.dummy.implementation"};
        engine = new IsomorphlyEngine(packageNames);
    }

    /**
     * @return the suite of tests being tested
     */
    public static Test suite()
    {
        return new TestSuite( IsomorphlyEngineTest.class );
    }

    public void testIsomorphlyEngineInstance()
    {
        assertTrue( engine != null );
    }
    
    public void testEngineInit() {
        engine.init();
        assertTrue("engine not properly initialized.", engine.isInitialized());
    }

    public void testGroupScan()
    {
    	engine.init();
    	
    	List<Class<?>> groups = engine.getIsomorphlyGroups();
    	
    	assertNotNull("Groups should not null. Is engine's initialization ok?", groups);

    	assertFalse("Groups should not be empty. Is engine's initialization ok?", groups.isEmpty());
    	
    	for (Class<?> cls : groups) {
    		assertTrue(cls.isAnnotation());
    		assertTrue(cls.isAnnotationPresent(Group.class));
    	}

    	assertTrue(true);
    }
    
    public void testComponentsScan()
    {
    	engine.init();
    	
    	List<Class<?>> components = engine.getIsomorphlyComponents();
    	
    	assertNotNull("Components should not null. Is engine's initialization ok?", components);

    	assertTrue("Components should not be empty. Is engine's initialization ok?", components.size() > 0);
    	
    	for (Class<?> cls : components) {
    		assertTrue(cls.isAnnotation());
    		assertTrue(cls.isAnnotationPresent(Component.class));
    	}

    	assertTrue(true);
    }
    
    public void testPluginsScan()
    {
    	engine.init();
    	
    	List<Class<?>> annotatedClientGroups = engine.getIsomorphlyClientGroups();

    	assertFalse("AnnotatedClientGroups should not be empty. Is engine's initialization ok?", annotatedClientGroups.isEmpty());
    
    	for (Class<?> cls : annotatedClientGroups) {
    		assertFalse("AnnotatedClient classes cannot be Interfaces", cls.isInterface());
    		assertFalse("AnnotatedClient classes cannot be Annotations", cls.isAnnotation());
    		
    		boolean foundValidParentGroupAnnotation = false;
    		
    		for (Annotation a : cls.getAnnotations()) {
    			foundValidParentGroupAnnotation |= a.annotationType().isAnnotationPresent(Group.class);
    		} 
    		
    		assertTrue("Unable to find a valid @Group Annotation in " + cls.getName(), foundValidParentGroupAnnotation);
    		
    	}

    	assertTrue(engine != null);
    }
{'fraction_non_alphanumeric': 0.10967169476486247, 'fraction_numerical': 0.0005323868677905945, 'mean_word_length': 2.9495444989488435, 'pattern_counts': {'":': 0, '<': 21, '<?xml version=': 0, '>': 24, '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': '366216', 'n_tokens_mistral': 1612, 'n_tokens_neox': 1595, 'n_words': 375}