com.seventytwomiles.architecturerules
Class AbstractArchitectureRulesConfigurationTest

java.lang.Object
  extended by junit.framework.Assert
      extended by junit.framework.TestCase
          extended by com.seventytwomiles.architecturerules.AbstractArchitectureRulesConfigurationTest
All Implemented Interfaces:
Test

public abstract class AbstractArchitectureRulesConfigurationTest
extends TestCase

Abstract class that the users of this library will extend in order to create a unit test that asserts architecture.

Once extended, implement testArchitecture and call doTest(). Also override getConfigurationFileName() if you want to load an XML configuration file.

If you want to define the configuration programmatically in addition to the xml configuration, or want to solely use programmatic configuration, you may call getConfiguration which will return Configuration that you may then add new Rule, or SourceDirectory to.

Author:
mikenereson

Constructor Summary
protected AbstractArchitectureRulesConfigurationTest()
          Upon instantiation, instances a new Configuration by reading the XML configuration file named architecture-rules.xml (by default) or by reading the XMl file name by the getConfigurationFileName method.
 
Method Summary
protected  boolean doTests()
          Runs tests that are configured either programmatically, or by the XML configuration file that is loaded.
protected  Configuration getConfiguration()
          Getter for property configuration.
protected  String getConfigurationFileName()
          Get the name of the xml configuration file that is located in the classpath.
abstract  void testArchitecture()
          Implement this method and call doTests()
 
Methods inherited from class junit.framework.TestCase
countTestCases, createResult, getName, run, run, runBare, runTest, setName, setUp, tearDown, toString
 
Methods inherited from class junit.framework.Assert
assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertFalse, assertFalse, assertNotNull, assertNotNull, assertNotSame, assertNotSame, assertNull, assertNull, assertSame, assertSame, assertTrue, assertTrue, fail, fail
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

AbstractArchitectureRulesConfigurationTest

protected AbstractArchitectureRulesConfigurationTest()
Upon instantiation, instances a new Configuration by reading the XML configuration file named architecture-rules.xml (by default) or by reading the XMl file name by the getConfigurationFileName method.

Method Detail

getConfigurationFileName

protected String getConfigurationFileName()

Get the name of the xml configuration file that is located in the classpath.

Recommend value, and the default value, is architecture-rules.xml

Returns:
String name of the xml file including .xml
See Also:
ConfigurationFactory.DEFAULT_CONFIGURATION_FILE_NAME

getConfiguration

protected Configuration getConfiguration()
Getter for property configuration.

Returns:
Value for property configuration.

doTests

protected final boolean doTests()

Runs tests that are configured either programmatically, or by the XML configuration file that is loaded.

Returns:
boolean true when the tests all pass.

testArchitecture

public abstract void testArchitecture()

Implement this method and call doTests()



Copyright © 2007-2008. All Rights Reserved.