edu.rice.cs.drjava.model.compiler
Class CompilerRegistryTest

java.lang.Object
  |
  +--junit.framework.Assert
        |
        +--junit.framework.TestCase
              |
              +--edu.rice.cs.drjava.model.compiler.CompilerRegistryTest
All Implemented Interfaces:
Test

public class CompilerRegistryTest
extends TestCase

Test cases for CompilerRegistry. Here we test that the compiler registry correctly finds available compilers.

Version:
$Id: CompilerRegistryTest.java,v 1.6 2002/02/08 14:22:19 brianstoler Exp $

Field Summary
private static CompilerInterface[] _allAvailableCompilers
           
private static String[] _defaultCompilers
           
private  ClassLoader _oldBaseLoader
          Stores the old state of CompilerRegistry.getBaseClassLoader(), so it can be reset later.
private static CompilerRegistry _registry
           
 
Fields inherited from class junit.framework.TestCase
fName
 
Constructor Summary
CompilerRegistryTest(String name)
          Constructor.
 
Method Summary
private  CompilerInterface[] _getCompilersAfterDisablingOne(int i)
          Returns the list of available compilers after disabling one of them.
private  CompilerInterface[] _getCompilersAfterDisablingSome(int[] indices)
          Returns the list of available compilers after disabling some of them.
 void setUp()
          Test setup method, which saves the old base class loader.
static Test suite()
          Creates a test suite for JUnit to run.
 void tearDown()
          Test teardown method, which restores the old base class loader.
 void testActiveCompilerAllAvailable()
          Tests that CompilerRegistry.setActiveCompiler(edu.rice.cs.drjava.model.compiler.CompilerInterface) and CompilerRegistry.getActiveCompiler() work.
 void testLimitAllAtOnce()
          Tests that list of available compilers effectively is restricted when all default compilers are not available.
 void testLimitOneByOne()
          Tests that list of available compilers effectively is restricted when the class is not available.
 
Methods inherited from class junit.framework.TestCase
countTestCases, createResult, getName, name, run, run, runBare, runTest, setName, toString
 
Methods inherited from class junit.framework.Assert
assert, assert, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertNotNull, assertNotNull, assertNull, assertNull, assertSame, assertSame, assertTrue, assertTrue, fail, fail, failNotEquals, failNotSame
 
Methods inherited from class java.lang.Object
, clone, equals, finalize, getClass, hashCode, notify, notifyAll, registerNatives, wait, wait, wait
 

Field Detail

_registry

private static final CompilerRegistry _registry

_defaultCompilers

private static final String[] _defaultCompilers

_allAvailableCompilers

private static final CompilerInterface[] _allAvailableCompilers

_oldBaseLoader

private ClassLoader _oldBaseLoader
Stores the old state of CompilerRegistry.getBaseClassLoader(), so it can be reset later.
Constructor Detail

CompilerRegistryTest

public CompilerRegistryTest(String name)
Constructor.
Parameters:
String - name
Method Detail

suite

public static Test suite()
Creates a test suite for JUnit to run.
Returns:
a test suite based on the methods in this class

setUp

public void setUp()
Test setup method, which saves the old base class loader.
Overrides:
setUp in class TestCase

tearDown

public void tearDown()
Test teardown method, which restores the old base class loader.
Overrides:
tearDown in class TestCase

testLimitOneByOne

public void testLimitOneByOne()
Tests that list of available compilers effectively is restricted when the class is not available. Here this is done by limiting the available compilers one at a time.

testLimitAllAtOnce

public void testLimitAllAtOnce()
Tests that list of available compilers effectively is restricted when all default compilers are not available.

testActiveCompilerAllAvailable

public void testActiveCompilerAllAvailable()
Tests that CompilerRegistry.setActiveCompiler(edu.rice.cs.drjava.model.compiler.CompilerInterface) and CompilerRegistry.getActiveCompiler() work.

_getCompilersAfterDisablingOne

private CompilerInterface[] _getCompilersAfterDisablingOne(int i)
Returns the list of available compilers after disabling one of them. This method includes checks for the correctness of the list after disabling one.
Parameters:
i - Index of default compiler to disable.

_getCompilersAfterDisablingSome

private CompilerInterface[] _getCompilersAfterDisablingSome(int[] indices)
Returns the list of available compilers after disabling some of them. This method includes checks for the correctness of the list after disabling them.
Parameters:
indices - Array of ints signifying which of the default compilers to disable.