com.ail.insurancetest
Class TestQuotation

java.lang.Object
  extended by junit.framework.Assert
      extended by junit.framework.TestCase
          extended by com.ail.insurancetest.TestQuotation
All Implemented Interfaces:
ConfigurationOwner, CoreUser, java.io.Serializable, junit.framework.Test

public class TestQuotation
extends junit.framework.TestCase
implements CoreUser, ConfigurationOwner

Version:
$Revision: 1.7 $
See Also:
Serialized Form

Constructor Summary
TestQuotation(java.lang.String name)
          Constructs a test case with the given name.
 
Method Summary
 Configuration getConfiguration()
          Method demanded by the ConfigurationOwner interface.
 java.lang.String getConfigurationNamespace()
          Method demanded by the ConfigurationOwner interface.
 java.security.Principal getSecurityPrincipal()
          Method demanded by the CoreUser interface.
 VersionEffectiveDate getVersionEffectiveDate()
          Method demanded by the CoreUser interface.
static void main(java.lang.String[] args)
           
 void resetConfiguration()
          Method demanded by the ConfigurationOwner interface.
 void setConfiguration(Configuration config)
          Method demanded by the ConfigurationOwner interface.
static junit.framework.Test suite()
           
 void testAddPolicyNumber()
          Test that the policy number generator generates unique numbers.
 void testAddQuoteNumber()
          Test that the quote number generator generates unique numbers.
 void testAssessPaymentOptions()
           
 void testAssessRiskStatusCheck()
          A policy's risk can only be assessed if the policy is at Application status.
 void testCalculatePremiumDecline()
          Policy with a decline.
 void testCalculatePremiumDeclineAndRefer()
          Policy with refer and decline.
 void testCalculatePremiumRefer()
          Policy with a refer.
 void testDoubleReferMarkerResolution()
          Single resolution, double refer.
 void testEnforceCompliance()
           
 void testMultipleContributors()
           
 void testOldLineRemoval()
          Make sure assess risk clears up old entries before adding new ones.If assess risk is called twice with the same policy, on the second call it should delete all the assessment sheet entries it created on the first time, then re-assess the risk from scratch.
 void testPriorityAssessmentLine()
           
 void testReferMarkerResolution()
          Single resolution, single refer.
 void testSimpleAssessRisk()
          Simple assess risk.
 void testSimpleAssessRiskCalculatePremium()
          Simple assess risk & calculate premium test.
 void testSimpleAssessRiskCalculatePremiumNoTaxNoCommission()
          This test is identical to testSimpleAssessRiskCalculatePremium, with the exception that no tax is (should!) be added to the quotation.
 
Methods inherited from class junit.framework.TestCase
countTestCases, getName, run, run, runBare, setName, 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
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

TestQuotation

public TestQuotation(java.lang.String name)
Constructs a test case with the given name.

Method Detail

suite

public static junit.framework.Test suite()

main

public static void main(java.lang.String[] args)
                 throws java.lang.Exception
Throws:
java.lang.Exception

getVersionEffectiveDate

public VersionEffectiveDate getVersionEffectiveDate()
Method demanded by the CoreUser interface.

Specified by:
getVersionEffectiveDate in interface CoreUser
Returns:
A date to use to selecte the corrent version of config info.

getSecurityPrincipal

public java.security.Principal getSecurityPrincipal()
Method demanded by the CoreUser interface.

Specified by:
getSecurityPrincipal in interface CoreUser
Returns:
Caller's security principal - may be null.

setConfiguration

public void setConfiguration(Configuration config)
Method demanded by the ConfigurationOwner interface.

Specified by:
setConfiguration in interface ConfigurationOwner
Parameters:
config - Configuration to use from now on.

getConfiguration

public Configuration getConfiguration()
Method demanded by the ConfigurationOwner interface.

Specified by:
getConfiguration in interface ConfigurationOwner
Returns:
The current configuration (at versionEffectiveDate).

getConfigurationNamespace

public java.lang.String getConfigurationNamespace()
Method demanded by the ConfigurationOwner interface.

Specified by:
getConfigurationNamespace in interface CoreUser
Returns:
The configuration namespace we're using

resetConfiguration

public void resetConfiguration()
Method demanded by the ConfigurationOwner interface.

Specified by:
resetConfiguration in interface ConfigurationOwner

testSimpleAssessRisk

public void testSimpleAssessRisk()
                          throws java.lang.Exception
Simple assess risk. Take a simple policy through assess risk.
  1. Create a policy (based on TestPolicy1).
  2. Pass the policy into assess risk.
  3. Fail if the section doesn't have exactly 2 assessment lines
  4. Fail if the policy doesn't have exactly 1 assessment line
  5. Fail if any exceptions are thrown

Throws:
BaseException
java.lang.Exception

testAssessRiskStatusCheck

public void testAssessRiskStatusCheck()
                               throws java.lang.Exception
A policy's risk can only be assessed if the policy is at Application status. This test ensures that this is the case.
  1. Create a policy (based on TestPolicy1).
  2. Set the policy's status to Quotation.
  3. Pass the policy into assess risk.
  4. Fail if a PreconditionException isn't thrown.
  5. Fail if any exception other than Precondition is thrown.

Throws:
java.lang.Exception

testOldLineRemoval

public void testOldLineRemoval()
                        throws java.lang.Exception
Make sure assess risk clears up old entries before adding new ones.If assess risk is called twice with the same policy, on the second call it should delete all the assessment sheet entries it created on the first time, then re-assess the risk from scratch.
  1. Create an instance of the test policy
  2. Pass the policy into assess risk
  3. Check that the policy's assessment sheet has 1 entry
  4. Check that the section's assessment sheet has 2 entries
  5. Add an entry to the policy's assessment sheet, and to the section's sheet.
  6. Pass the policy back into assess risk
  7. Check that the policy's assessment sheet has 1 entry
  8. Check that the section's assessment sheet has 2 entries

Throws:
java.lang.Exception

testSimpleAssessRiskCalculatePremium

public void testSimpleAssessRiskCalculatePremium()
                                          throws java.lang.Exception
Simple assess risk & calculate premium test. Take a simple policy through the assess & calculate services to get a premium. The TestPolicy1 should pass thought the default product and end up with a premium of 250.00.
  1. Create a policy (based on TestPolicy1).
  2. Pass the policy into assess risk.
  3. Fail if the section doesn't have exactly 2 assessment lines
  4. Fail if the policy doesn't have exactly 1 assessment line
  5. Pass the policy into calculate premium
  6. Fail if the section doesn't have exactly 2 assessment lines
  7. Fail if the policy doesn't have exactly 2 assessment lines
  8. Fail if the policy status is not set to Quotation
  9. Fail if the total premium assessment line is not set to 250.00
  10. Fail if any exceptions are thrown

Throws:
BaseException
java.lang.Exception

testSimpleAssessRiskCalculatePremiumNoTaxNoCommission

public void testSimpleAssessRiskCalculatePremiumNoTaxNoCommission()
                                                           throws java.lang.Exception
This test is identical to testSimpleAssessRiskCalculatePremium, with the exception that no tax is (should!) be added to the quotation.

Throws:
java.lang.Exception

testPriorityAssessmentLine

public void testPriorityAssessmentLine()
                                throws java.lang.Exception
Throws:
java.lang.Exception

testCalculatePremiumRefer

public void testCalculatePremiumRefer()
                               throws BaseException
Policy with a refer. If a policy has a refer line, calculate premium should set the policy status to referred, and not process any calculations.
  1. Create a policy (based on TestPolicy1).
  2. Creata a section level assessment sheet
    1. Add a base premium line of £20
    2. Add a refer (Id=ref1)
  3. Create an empty policy level assessment sheet
  4. Pass the policy into calculate premium
  5. Fail if the policy status is not set to Referred
  6. Fail if there are not exactly 2 lines in the section's sheet
  7. Fail if there are any lines in the policy's assessment sheet
  8. Fail if any exceptions are thrown

Throws:
BaseException

testCalculatePremiumDecline

public void testCalculatePremiumDecline()
                                 throws BaseException
Policy with a decline. If a policy has a decline line, calculate premium should set the policy status to declined, and not process any calculations.
  1. Create a policy (based on TestPolicy1).
  2. Creata a section level assessment sheet
    1. Add a base premium line of £20
    2. Add a decline (Id=dec1)
  3. Create an empty policy level assessment sheet
  4. Pass the policy into calculate premium
  5. Fail if the policy status is not set to Declined
  6. Fail if there are not exactly 2 lines in the section's sheet
  7. Fail if there are any lines in the policy's assessment sheet
  8. Fail if any exceptions are thrown

Throws:
BaseException

testCalculatePremiumDeclineAndRefer

public void testCalculatePremiumDeclineAndRefer()
                                         throws BaseException
Policy with refer and decline. If a policy has both refer and decline lines, calculate premium should set its status to declined.
  1. Create a policy (based on TestPolicy1).
  2. Creata a section level assessment sheet
    1. Add a base premium line of £20
    2. Add a referral (Id=ref1)
    3. Add a decline (Id=dec1)
  3. Create an empty policy level assessment sheet
  4. Pass the policy into calculate premium
  5. Fail if the policy status is not set to Declined
  6. Fail if there are not exactly 3 lines in the section's sheet
  7. Fail if there are any lines in the policy's assessment sheet
  8. Fail if any exceptions are thrown

Throws:
BaseException

testReferMarkerResolution

public void testReferMarkerResolution()
                               throws BaseException
Single resolution, single refer. Ensure that a resolved referral is ignored, and the quotataion goes ahead.
  1. Create a policy (based on TestPolicy1).
  2. Creata a section level assessment sheet
    1. Add a base premium line of £20
    2. Add a referral (Id=ref1)
    3. Add a resolution for ref1
  3. Create an empty policy level assessment sheet
  4. Pass the policy into calculate premium
  5. Fail if the policy status is not set to Quotation
  6. Fail if there are not exactly 3 lines in the section's sheet
  7. Fail if there is not exactly 1 line in the policy's assessment sheet
  8. Fail if any exceptions are thrown

Throws:
BaseException

testDoubleReferMarkerResolution

public void testDoubleReferMarkerResolution()
                                     throws BaseException
Single resolution, double refer. Ensure that a policy with two referrals, only one of which is resolved, ends up with a referred status.
  1. Create a policy (based on TestPolicy1).
  2. Creata a section level assessment sheet
    1. Add a base premium line of £20
    2. Add two referrals (Ids=ref1 and ref1)
    3. Add a resolution for ref1
  3. Create an empty policy level assessment sheet
  4. Pass the policy into calculate premium
  5. Fail if the policy status is not set to Referred
  6. Fail if there are not exactly 4 lines in the section's sheet
  7. Fail if there are any entries in the policy's assessment sheet
  8. Fail if any exceptions are thrown

Throws:
BaseException

testMultipleContributors

public void testMultipleContributors()
                              throws java.lang.Exception
Throws:
java.lang.Exception

testAddPolicyNumber

public void testAddPolicyNumber()
                         throws java.lang.Exception
Test that the policy number generator generates unique numbers.

Throws:
java.lang.Exception

testAddQuoteNumber

public void testAddQuoteNumber()
                        throws java.lang.Exception
Test that the quote number generator generates unique numbers.

Throws:
java.lang.Exception

testEnforceCompliance

public void testEnforceCompliance()
                           throws java.lang.Exception
Throws:
java.lang.Exception

testAssessPaymentOptions

public void testAssessPaymentOptions()
                              throws java.lang.Exception
Throws:
java.lang.Exception