0001: /*
0002: * Copyright 2006-2007 The Kuali Foundation.
0003: *
0004: * Licensed under the Educational Community License, Version 1.0 (the "License");
0005: * you may not use this file except in compliance with the License.
0006: * You may obtain a copy of the License at
0007: *
0008: * http://www.opensource.org/licenses/ecl1.php
0009: *
0010: * Unless required by applicable law or agreed to in writing, software
0011: * distributed under the License is distributed on an "AS IS" BASIS,
0012: * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
0013: * See the License for the specific language governing permissions and
0014: * limitations under the License.
0015: */
0016: package org.kuali.module.financial.rules;
0017:
0018: import static org.kuali.module.financial.rules.IsDebitTestUtils.Amount.NEGATIVE;
0019: import static org.kuali.module.financial.rules.IsDebitTestUtils.Amount.POSITIVE;
0020: import static org.kuali.test.fixtures.UserNameFixture.KHUNTLEY;
0021:
0022: import org.kuali.core.service.DataDictionaryService;
0023: import org.kuali.core.service.DocumentService;
0024: import org.kuali.core.service.DocumentTypeService;
0025: import org.kuali.core.util.KualiDecimal;
0026: import org.kuali.kfs.bo.AccountingLine;
0027: import org.kuali.kfs.bo.SourceAccountingLine;
0028: import org.kuali.kfs.bo.TargetAccountingLine;
0029: import org.kuali.kfs.context.KualiTestBase;
0030: import org.kuali.kfs.context.SpringContext;
0031: import org.kuali.kfs.document.AccountingDocument;
0032: import org.kuali.module.financial.document.PreEncumbranceDocument;
0033: import org.kuali.test.ConfigureContext;
0034:
0035: /**
0036: * This class tests the <code>PreEncumbranceDocumentRule</code>s
0037: */
0038: @ConfigureContext(session=KHUNTLEY)
0039: public class PreEncumbranceDocumentRuleTest extends KualiTestBase {
0040:
0041: /**
0042: * tests an <code>IllegalStateException</code> is thrown for a positive income
0043: *
0044: * @throws Exception
0045: */
0046: public void testIsDebit_source_income_positveAmount()
0047: throws Exception {
0048: AccountingDocument accountingDocument = IsDebitTestUtils
0049: .getDocument(SpringContext
0050: .getBean(DocumentService.class),
0051: PreEncumbranceDocument.class);
0052: AccountingLine accountingLine = IsDebitTestUtils.getIncomeLine(
0053: accountingDocument, SourceAccountingLine.class,
0054: POSITIVE);
0055:
0056: assertTrue(IsDebitTestUtils.isDebitIllegalStateException(
0057: SpringContext.getBean(DocumentTypeService.class),
0058: SpringContext.getBean(DataDictionaryService.class),
0059: accountingDocument, accountingLine));
0060: }
0061:
0062: /**
0063: * tests an <code>IllegalStateException</code> is thrown for a negative income
0064: *
0065: * @throws Exception
0066: */
0067: public void testIsDebit_source_income_negativeAmount()
0068: throws Exception {
0069: AccountingDocument accountingDocument = IsDebitTestUtils
0070: .getDocument(SpringContext
0071: .getBean(DocumentService.class),
0072: PreEncumbranceDocument.class);
0073: AccountingLine accountingLine = IsDebitTestUtils.getIncomeLine(
0074: accountingDocument, SourceAccountingLine.class,
0075: NEGATIVE);
0076:
0077: assertTrue(IsDebitTestUtils.isDebitIllegalStateException(
0078: SpringContext.getBean(DocumentTypeService.class),
0079: SpringContext.getBean(DataDictionaryService.class),
0080: accountingDocument, accountingLine));
0081: }
0082:
0083: /**
0084: * tests an <code>IllegalStateException</code> is thrown for a zero income
0085: *
0086: * @throws Exception
0087: */
0088: public void testIsDebit_source_income_zeroAmount() throws Exception {
0089:
0090: AccountingDocument accountingDocument = IsDebitTestUtils
0091: .getDocument(SpringContext
0092: .getBean(DocumentService.class),
0093: PreEncumbranceDocument.class);
0094: AccountingLine accountingLine = IsDebitTestUtils.getIncomeLine(
0095: accountingDocument, SourceAccountingLine.class,
0096: KualiDecimal.ZERO);
0097:
0098: assertTrue(IsDebitTestUtils.isDebitIllegalStateException(
0099: SpringContext.getBean(DocumentTypeService.class),
0100: SpringContext.getBean(DataDictionaryService.class),
0101: accountingDocument, accountingLine));
0102: }
0103:
0104: /**
0105: * tests true is returned for a positive expense
0106: *
0107: * @throws Exception
0108: */
0109: public void testIsDebit_source_expense_positveAmount()
0110: throws Exception {
0111: AccountingDocument accountingDocument = IsDebitTestUtils
0112: .getDocument(SpringContext
0113: .getBean(DocumentService.class),
0114: PreEncumbranceDocument.class);
0115: AccountingLine accountingLine = IsDebitTestUtils
0116: .getExpenseLine(accountingDocument,
0117: SourceAccountingLine.class, POSITIVE);
0118:
0119: assertTrue(IsDebitTestUtils.isDebit(SpringContext
0120: .getBean(DocumentTypeService.class), SpringContext
0121: .getBean(DataDictionaryService.class),
0122: accountingDocument, accountingLine));
0123: }
0124:
0125: /**
0126: * tests an <code>IllegalStateException</code> is thrown for a zero expense
0127: *
0128: * @throws Exception
0129: */
0130: public void testIsDebit_source_expense_negativeAmount()
0131: throws Exception {
0132: AccountingDocument accountingDocument = IsDebitTestUtils
0133: .getDocument(SpringContext
0134: .getBean(DocumentService.class),
0135: PreEncumbranceDocument.class);
0136: AccountingLine accountingLine = IsDebitTestUtils
0137: .getExpenseLine(accountingDocument,
0138: SourceAccountingLine.class, NEGATIVE);
0139:
0140: assertTrue(IsDebitTestUtils.isDebitIllegalStateException(
0141: SpringContext.getBean(DocumentTypeService.class),
0142: SpringContext.getBean(DataDictionaryService.class),
0143: accountingDocument, accountingLine));
0144: }
0145:
0146: /**
0147: * tests an <code>IllegalStateException</code> is thrown for a zero expense
0148: *
0149: * @throws Exception
0150: */
0151: public void testIsDebit_source_expense_zeroAmount()
0152: throws Exception {
0153: AccountingDocument accountingDocument = IsDebitTestUtils
0154: .getDocument(SpringContext
0155: .getBean(DocumentService.class),
0156: PreEncumbranceDocument.class);
0157: AccountingLine accountingLine = IsDebitTestUtils
0158: .getExpenseLine(accountingDocument,
0159: SourceAccountingLine.class, KualiDecimal.ZERO);
0160:
0161: assertTrue(IsDebitTestUtils.isDebitIllegalStateException(
0162: SpringContext.getBean(DocumentTypeService.class),
0163: SpringContext.getBean(DataDictionaryService.class),
0164: accountingDocument, accountingLine));
0165: }
0166:
0167: /**
0168: * tests an <code>IllegalStateException</code> is thrown for a positive asset
0169: *
0170: * @throws Exception
0171: */
0172: public void testIsDebit_source_asset_positveAmount()
0173: throws Exception {
0174: AccountingDocument accountingDocument = IsDebitTestUtils
0175: .getDocument(SpringContext
0176: .getBean(DocumentService.class),
0177: PreEncumbranceDocument.class);
0178: AccountingLine accountingLine = IsDebitTestUtils.getAssetLine(
0179: accountingDocument, SourceAccountingLine.class,
0180: POSITIVE);
0181:
0182: assertTrue(IsDebitTestUtils.isDebitIllegalStateException(
0183: SpringContext.getBean(DocumentTypeService.class),
0184: SpringContext.getBean(DataDictionaryService.class),
0185: accountingDocument, accountingLine));
0186: }
0187:
0188: /**
0189: * tests an <code>IllegalStateException</code> is thrown for a negative asset
0190: *
0191: * @throws Exception
0192: */
0193: public void testIsDebit_source_asset_negativeAmount()
0194: throws Exception {
0195: AccountingDocument accountingDocument = IsDebitTestUtils
0196: .getDocument(SpringContext
0197: .getBean(DocumentService.class),
0198: PreEncumbranceDocument.class);
0199: AccountingLine accountingLine = IsDebitTestUtils.getAssetLine(
0200: accountingDocument, SourceAccountingLine.class,
0201: NEGATIVE);
0202:
0203: assertTrue(IsDebitTestUtils.isDebitIllegalStateException(
0204: SpringContext.getBean(DocumentTypeService.class),
0205: SpringContext.getBean(DataDictionaryService.class),
0206: accountingDocument, accountingLine));
0207: }
0208:
0209: /**
0210: * tests an <code>IllegalStateException</code> is thrown for a zero asset
0211: *
0212: * @throws Exception
0213: */
0214: public void testIsDebit_source_asset_zeroAmount() throws Exception {
0215: AccountingDocument accountingDocument = IsDebitTestUtils
0216: .getDocument(SpringContext
0217: .getBean(DocumentService.class),
0218: PreEncumbranceDocument.class);
0219: AccountingLine accountingLine = IsDebitTestUtils.getAssetLine(
0220: accountingDocument, SourceAccountingLine.class,
0221: KualiDecimal.ZERO);
0222:
0223: assertTrue(IsDebitTestUtils.isDebitIllegalStateException(
0224: SpringContext.getBean(DocumentTypeService.class),
0225: SpringContext.getBean(DataDictionaryService.class),
0226: accountingDocument, accountingLine));
0227: }
0228:
0229: /**
0230: * tests an <code>IllegalStateException</code> is thrown for a positive liability
0231: *
0232: * @throws Exception
0233: */
0234: public void testIsDebit_source_liability_positveAmount()
0235: throws Exception {
0236: AccountingDocument accountingDocument = IsDebitTestUtils
0237: .getDocument(SpringContext
0238: .getBean(DocumentService.class),
0239: PreEncumbranceDocument.class);
0240: AccountingLine accountingLine = IsDebitTestUtils
0241: .getLiabilityLine(accountingDocument,
0242: SourceAccountingLine.class, POSITIVE);
0243:
0244: assertTrue(IsDebitTestUtils.isDebitIllegalStateException(
0245: SpringContext.getBean(DocumentTypeService.class),
0246: SpringContext.getBean(DataDictionaryService.class),
0247: accountingDocument, accountingLine));
0248: }
0249:
0250: /**
0251: * tests an <code>IllegalStateException</code> is thrown for a negative liability
0252: *
0253: * @throws Exception
0254: */
0255: public void testIsDebit_source_liability_negativeAmount()
0256: throws Exception {
0257: AccountingDocument accountingDocument = IsDebitTestUtils
0258: .getDocument(SpringContext
0259: .getBean(DocumentService.class),
0260: PreEncumbranceDocument.class);
0261: AccountingLine accountingLine = IsDebitTestUtils
0262: .getLiabilityLine(accountingDocument,
0263: SourceAccountingLine.class, NEGATIVE);
0264:
0265: assertTrue(IsDebitTestUtils.isDebitIllegalStateException(
0266: SpringContext.getBean(DocumentTypeService.class),
0267: SpringContext.getBean(DataDictionaryService.class),
0268: accountingDocument, accountingLine));
0269: }
0270:
0271: /**
0272: * tests an <code>IllegalStateException</code> is thrown for a zero liability
0273: *
0274: * @throws Exception
0275: */
0276: public void testIsDebit_source_liability_zeroAmount()
0277: throws Exception {
0278: AccountingDocument accountingDocument = IsDebitTestUtils
0279: .getDocument(SpringContext
0280: .getBean(DocumentService.class),
0281: PreEncumbranceDocument.class);
0282: AccountingLine accountingLine = IsDebitTestUtils
0283: .getLiabilityLine(accountingDocument,
0284: SourceAccountingLine.class, KualiDecimal.ZERO);
0285:
0286: assertTrue(IsDebitTestUtils.isDebitIllegalStateException(
0287: SpringContext.getBean(DocumentTypeService.class),
0288: SpringContext.getBean(DataDictionaryService.class),
0289: accountingDocument, accountingLine));
0290: }
0291:
0292: /**
0293: * tests an <code>IllegalStateException</code> is thrown for a positive income
0294: *
0295: * @throws Exception
0296: */
0297: public void testIsDebit_target_income_positveAmount()
0298: throws Exception {
0299: AccountingDocument accountingDocument = IsDebitTestUtils
0300: .getDocument(SpringContext
0301: .getBean(DocumentService.class),
0302: PreEncumbranceDocument.class);
0303: AccountingLine accountingLine = IsDebitTestUtils.getIncomeLine(
0304: accountingDocument, TargetAccountingLine.class,
0305: POSITIVE);
0306:
0307: assertTrue(IsDebitTestUtils.isDebitIllegalStateException(
0308: SpringContext.getBean(DocumentTypeService.class),
0309: SpringContext.getBean(DataDictionaryService.class),
0310: accountingDocument, accountingLine));
0311: }
0312:
0313: /**
0314: * tests an <code>IllegalStateException</code> is thrown for a negative income
0315: *
0316: * @throws Exception
0317: */
0318: public void testIsDebit_target_income_negativeAmount()
0319: throws Exception {
0320: AccountingDocument accountingDocument = IsDebitTestUtils
0321: .getDocument(SpringContext
0322: .getBean(DocumentService.class),
0323: PreEncumbranceDocument.class);
0324: AccountingLine accountingLine = IsDebitTestUtils.getIncomeLine(
0325: accountingDocument, TargetAccountingLine.class,
0326: NEGATIVE);
0327:
0328: assertTrue(IsDebitTestUtils.isDebitIllegalStateException(
0329: SpringContext.getBean(DocumentTypeService.class),
0330: SpringContext.getBean(DataDictionaryService.class),
0331: accountingDocument, accountingLine));
0332: }
0333:
0334: /**
0335: * tests an <code>IllegalStateException</code> is thrown for a zero income
0336: *
0337: * @throws Exception
0338: */
0339: public void testIsDebit_target_income_zeroAmount() throws Exception {
0340:
0341: AccountingDocument accountingDocument = IsDebitTestUtils
0342: .getDocument(SpringContext
0343: .getBean(DocumentService.class),
0344: PreEncumbranceDocument.class);
0345: AccountingLine accountingLine = IsDebitTestUtils.getIncomeLine(
0346: accountingDocument, TargetAccountingLine.class,
0347: KualiDecimal.ZERO);
0348:
0349: assertTrue(IsDebitTestUtils.isDebitIllegalStateException(
0350: SpringContext.getBean(DocumentTypeService.class),
0351: SpringContext.getBean(DataDictionaryService.class),
0352: accountingDocument, accountingLine));
0353: }
0354:
0355: /**
0356: * tests false is returned for a positive expense
0357: *
0358: * @throws Exception
0359: */
0360: public void testIsDebit_target_expense_positveAmount()
0361: throws Exception {
0362: AccountingDocument accountingDocument = IsDebitTestUtils
0363: .getDocument(SpringContext
0364: .getBean(DocumentService.class),
0365: PreEncumbranceDocument.class);
0366: AccountingLine accountingLine = IsDebitTestUtils
0367: .getExpenseLine(accountingDocument,
0368: TargetAccountingLine.class, POSITIVE);
0369:
0370: assertFalse(IsDebitTestUtils.isDebit(SpringContext
0371: .getBean(DocumentTypeService.class), SpringContext
0372: .getBean(DataDictionaryService.class),
0373: accountingDocument, accountingLine));
0374: }
0375:
0376: /**
0377: * tests an <code>IllegalStateException</code> is thrown for a zero expense
0378: *
0379: * @throws Exception
0380: */
0381: public void testIsDebit_target_expense_negativeAmount()
0382: throws Exception {
0383: AccountingDocument accountingDocument = IsDebitTestUtils
0384: .getDocument(SpringContext
0385: .getBean(DocumentService.class),
0386: PreEncumbranceDocument.class);
0387: AccountingLine accountingLine = IsDebitTestUtils
0388: .getExpenseLine(accountingDocument,
0389: TargetAccountingLine.class, NEGATIVE);
0390:
0391: assertTrue(IsDebitTestUtils.isDebitIllegalStateException(
0392: SpringContext.getBean(DocumentTypeService.class),
0393: SpringContext.getBean(DataDictionaryService.class),
0394: accountingDocument, accountingLine));
0395: }
0396:
0397: /**
0398: * tests an <code>IllegalStateException</code> is thrown for a zero expense
0399: *
0400: * @throws Exception
0401: */
0402: public void testIsDebit_target_expense_zeroAmount()
0403: throws Exception {
0404: AccountingDocument accountingDocument = IsDebitTestUtils
0405: .getDocument(SpringContext
0406: .getBean(DocumentService.class),
0407: PreEncumbranceDocument.class);
0408: AccountingLine accountingLine = IsDebitTestUtils
0409: .getExpenseLine(accountingDocument,
0410: TargetAccountingLine.class, KualiDecimal.ZERO);
0411:
0412: assertTrue(IsDebitTestUtils.isDebitIllegalStateException(
0413: SpringContext.getBean(DocumentTypeService.class),
0414: SpringContext.getBean(DataDictionaryService.class),
0415: accountingDocument, accountingLine));
0416: }
0417:
0418: /**
0419: * tests an <code>IllegalStateException</code> is thrown for a positive asset
0420: *
0421: * @throws Exception
0422: */
0423: public void testIsDebit_target_asset_positveAmount()
0424: throws Exception {
0425: AccountingDocument accountingDocument = IsDebitTestUtils
0426: .getDocument(SpringContext
0427: .getBean(DocumentService.class),
0428: PreEncumbranceDocument.class);
0429: AccountingLine accountingLine = IsDebitTestUtils.getAssetLine(
0430: accountingDocument, TargetAccountingLine.class,
0431: POSITIVE);
0432:
0433: assertTrue(IsDebitTestUtils.isDebitIllegalStateException(
0434: SpringContext.getBean(DocumentTypeService.class),
0435: SpringContext.getBean(DataDictionaryService.class),
0436: accountingDocument, accountingLine));
0437: }
0438:
0439: /**
0440: * tests an <code>IllegalStateException</code> is thrown for a negative asset
0441: *
0442: * @throws Exception
0443: */
0444: public void testIsDebit_target_asset_negativeAmount()
0445: throws Exception {
0446: AccountingDocument accountingDocument = IsDebitTestUtils
0447: .getDocument(SpringContext
0448: .getBean(DocumentService.class),
0449: PreEncumbranceDocument.class);
0450: AccountingLine accountingLine = IsDebitTestUtils.getAssetLine(
0451: accountingDocument, TargetAccountingLine.class,
0452: NEGATIVE);
0453:
0454: assertTrue(IsDebitTestUtils.isDebitIllegalStateException(
0455: SpringContext.getBean(DocumentTypeService.class),
0456: SpringContext.getBean(DataDictionaryService.class),
0457: accountingDocument, accountingLine));
0458: }
0459:
0460: /**
0461: * tests an <code>IllegalStateException</code> is thrown for a zero asset
0462: *
0463: * @throws Exception
0464: */
0465: public void testIsDebit_target_asset_zeroAmount() throws Exception {
0466: AccountingDocument accountingDocument = IsDebitTestUtils
0467: .getDocument(SpringContext
0468: .getBean(DocumentService.class),
0469: PreEncumbranceDocument.class);
0470: AccountingLine accountingLine = IsDebitTestUtils.getAssetLine(
0471: accountingDocument, TargetAccountingLine.class,
0472: KualiDecimal.ZERO);
0473:
0474: assertTrue(IsDebitTestUtils.isDebitIllegalStateException(
0475: SpringContext.getBean(DocumentTypeService.class),
0476: SpringContext.getBean(DataDictionaryService.class),
0477: accountingDocument, accountingLine));
0478: }
0479:
0480: /**
0481: * tests an <code>IllegalStateException</code> is thrown for a positive liability
0482: *
0483: * @throws Exception
0484: */
0485: public void testIsDebit_target_liability_positveAmount()
0486: throws Exception {
0487: AccountingDocument accountingDocument = IsDebitTestUtils
0488: .getDocument(SpringContext
0489: .getBean(DocumentService.class),
0490: PreEncumbranceDocument.class);
0491: AccountingLine accountingLine = IsDebitTestUtils
0492: .getLiabilityLine(accountingDocument,
0493: TargetAccountingLine.class, POSITIVE);
0494:
0495: assertTrue(IsDebitTestUtils.isDebitIllegalStateException(
0496: SpringContext.getBean(DocumentTypeService.class),
0497: SpringContext.getBean(DataDictionaryService.class),
0498: accountingDocument, accountingLine));
0499: }
0500:
0501: /**
0502: * tests an <code>IllegalStateException</code> is thrown for a negative liability
0503: *
0504: * @throws Exception
0505: */
0506: public void testIsDebit_target_liability_negativeAmount()
0507: throws Exception {
0508: AccountingDocument accountingDocument = IsDebitTestUtils
0509: .getDocument(SpringContext
0510: .getBean(DocumentService.class),
0511: PreEncumbranceDocument.class);
0512: AccountingLine accountingLine = IsDebitTestUtils
0513: .getLiabilityLine(accountingDocument,
0514: TargetAccountingLine.class, NEGATIVE);
0515:
0516: assertTrue(IsDebitTestUtils.isDebitIllegalStateException(
0517: SpringContext.getBean(DocumentTypeService.class),
0518: SpringContext.getBean(DataDictionaryService.class),
0519: accountingDocument, accountingLine));
0520: }
0521:
0522: /**
0523: * tests an <code>IllegalStateException</code> is thrown for a zero liability
0524: *
0525: * @throws Exception
0526: */
0527: public void testIsDebit_target_liability_zeroAmount()
0528: throws Exception {
0529: AccountingDocument accountingDocument = IsDebitTestUtils
0530: .getDocument(SpringContext
0531: .getBean(DocumentService.class),
0532: PreEncumbranceDocument.class);
0533: AccountingLine accountingLine = IsDebitTestUtils
0534: .getLiabilityLine(accountingDocument,
0535: TargetAccountingLine.class, KualiDecimal.ZERO);
0536:
0537: assertTrue(IsDebitTestUtils.isDebitIllegalStateException(
0538: SpringContext.getBean(DocumentTypeService.class),
0539: SpringContext.getBean(DataDictionaryService.class),
0540: accountingDocument, accountingLine));
0541: }
0542:
0543: /**
0544: * tests an <code>IllegalStateException</code> is thrown for a positive income
0545: *
0546: * @throws Exception
0547: */
0548: public void testIsDebit_errorCorrection_source_income_positveAmount()
0549: throws Exception {
0550: AccountingDocument accountingDocument = IsDebitTestUtils
0551: .getErrorCorrectionDocument(SpringContext
0552: .getBean(DocumentService.class),
0553: PreEncumbranceDocument.class);
0554: AccountingLine accountingLine = IsDebitTestUtils.getIncomeLine(
0555: accountingDocument, SourceAccountingLine.class,
0556: POSITIVE);
0557:
0558: assertTrue(IsDebitTestUtils.isDebitIllegalStateException(
0559: SpringContext.getBean(DocumentTypeService.class),
0560: SpringContext.getBean(DataDictionaryService.class),
0561: accountingDocument, accountingLine));
0562: }
0563:
0564: /**
0565: * tests an <code>IllegalStateException</code> is thrown for a negative income
0566: *
0567: * @throws Exception
0568: */
0569: public void testIsDebit_errorCorrection_source_income_negativeAmount()
0570: throws Exception {
0571: AccountingDocument accountingDocument = IsDebitTestUtils
0572: .getErrorCorrectionDocument(SpringContext
0573: .getBean(DocumentService.class),
0574: PreEncumbranceDocument.class);
0575: AccountingLine accountingLine = IsDebitTestUtils.getIncomeLine(
0576: accountingDocument, SourceAccountingLine.class,
0577: NEGATIVE);
0578:
0579: assertTrue(IsDebitTestUtils.isDebitIllegalStateException(
0580: SpringContext.getBean(DocumentTypeService.class),
0581: SpringContext.getBean(DataDictionaryService.class),
0582: accountingDocument, accountingLine));
0583: }
0584:
0585: /**
0586: * tests an <code>IllegalStateException</code> is thrown for a zero income
0587: *
0588: * @throws Exception
0589: */
0590: public void testIsDebit_errorCorrection_source_income_zeroAmount()
0591: throws Exception {
0592:
0593: AccountingDocument accountingDocument = IsDebitTestUtils
0594: .getErrorCorrectionDocument(SpringContext
0595: .getBean(DocumentService.class),
0596: PreEncumbranceDocument.class);
0597: AccountingLine accountingLine = IsDebitTestUtils.getIncomeLine(
0598: accountingDocument, SourceAccountingLine.class,
0599: KualiDecimal.ZERO);
0600:
0601: assertTrue(IsDebitTestUtils.isDebitIllegalStateException(
0602: SpringContext.getBean(DocumentTypeService.class),
0603: SpringContext.getBean(DataDictionaryService.class),
0604: accountingDocument, accountingLine));
0605: }
0606:
0607: /**
0608: * tests true is returned for a positive expense
0609: *
0610: * @throws Exception
0611: */
0612: public void testIsDebit_errorCorrection_source_expense_positveAmount()
0613: throws Exception {
0614: AccountingDocument accountingDocument = IsDebitTestUtils
0615: .getErrorCorrectionDocument(SpringContext
0616: .getBean(DocumentService.class),
0617: PreEncumbranceDocument.class);
0618: AccountingLine accountingLine = IsDebitTestUtils
0619: .getExpenseLine(accountingDocument,
0620: SourceAccountingLine.class, POSITIVE);
0621:
0622: assertTrue(IsDebitTestUtils.isDebitIllegalStateException(
0623: SpringContext.getBean(DocumentTypeService.class),
0624: SpringContext.getBean(DataDictionaryService.class),
0625: accountingDocument, accountingLine));
0626: }
0627:
0628: /**
0629: * tests an <code>IllegalStateException</code> is thrown for a zero expense
0630: *
0631: * @throws Exception
0632: */
0633: public void testIsDebit_errorCorrection_source_expense_negativeAmount()
0634: throws Exception {
0635: AccountingDocument accountingDocument = IsDebitTestUtils
0636: .getErrorCorrectionDocument(SpringContext
0637: .getBean(DocumentService.class),
0638: PreEncumbranceDocument.class);
0639: AccountingLine accountingLine = IsDebitTestUtils
0640: .getExpenseLine(accountingDocument,
0641: SourceAccountingLine.class, NEGATIVE);
0642:
0643: assertFalse(IsDebitTestUtils.isDebit(SpringContext
0644: .getBean(DocumentTypeService.class), SpringContext
0645: .getBean(DataDictionaryService.class),
0646: accountingDocument, accountingLine));
0647: }
0648:
0649: /**
0650: * tests an <code>IllegalStateException</code> is thrown for a zero expense
0651: *
0652: * @throws Exception
0653: */
0654: public void testIsDebit_errorCorrection_source_expense_zeroAmount()
0655: throws Exception {
0656: AccountingDocument accountingDocument = IsDebitTestUtils
0657: .getErrorCorrectionDocument(SpringContext
0658: .getBean(DocumentService.class),
0659: PreEncumbranceDocument.class);
0660: AccountingLine accountingLine = IsDebitTestUtils
0661: .getExpenseLine(accountingDocument,
0662: SourceAccountingLine.class, KualiDecimal.ZERO);
0663:
0664: assertTrue(IsDebitTestUtils.isDebitIllegalStateException(
0665: SpringContext.getBean(DocumentTypeService.class),
0666: SpringContext.getBean(DataDictionaryService.class),
0667: accountingDocument, accountingLine));
0668: }
0669:
0670: /**
0671: * tests an <code>IllegalStateException</code> is thrown for a positive asset
0672: *
0673: * @throws Exception
0674: */
0675: public void testIsDebit_errorCorrection_source_asset_positveAmount()
0676: throws Exception {
0677: AccountingDocument accountingDocument = IsDebitTestUtils
0678: .getErrorCorrectionDocument(SpringContext
0679: .getBean(DocumentService.class),
0680: PreEncumbranceDocument.class);
0681: AccountingLine accountingLine = IsDebitTestUtils.getAssetLine(
0682: accountingDocument, SourceAccountingLine.class,
0683: POSITIVE);
0684:
0685: assertTrue(IsDebitTestUtils.isDebitIllegalStateException(
0686: SpringContext.getBean(DocumentTypeService.class),
0687: SpringContext.getBean(DataDictionaryService.class),
0688: accountingDocument, accountingLine));
0689: }
0690:
0691: /**
0692: * tests an <code>IllegalStateException</code> is thrown for a negative asset
0693: *
0694: * @throws Exception
0695: */
0696: public void testIsDebit_errorCorrection_source_asset_negativeAmount()
0697: throws Exception {
0698: AccountingDocument accountingDocument = IsDebitTestUtils
0699: .getErrorCorrectionDocument(SpringContext
0700: .getBean(DocumentService.class),
0701: PreEncumbranceDocument.class);
0702: AccountingLine accountingLine = IsDebitTestUtils.getAssetLine(
0703: accountingDocument, SourceAccountingLine.class,
0704: NEGATIVE);
0705:
0706: assertTrue(IsDebitTestUtils.isDebitIllegalStateException(
0707: SpringContext.getBean(DocumentTypeService.class),
0708: SpringContext.getBean(DataDictionaryService.class),
0709: accountingDocument, accountingLine));
0710: }
0711:
0712: /**
0713: * tests an <code>IllegalStateException</code> is thrown for a zero asset
0714: *
0715: * @throws Exception
0716: */
0717: public void testIsDebit_errorCorrection_source_asset_zeroAmount()
0718: throws Exception {
0719: AccountingDocument accountingDocument = IsDebitTestUtils
0720: .getErrorCorrectionDocument(SpringContext
0721: .getBean(DocumentService.class),
0722: PreEncumbranceDocument.class);
0723: AccountingLine accountingLine = IsDebitTestUtils.getAssetLine(
0724: accountingDocument, SourceAccountingLine.class,
0725: KualiDecimal.ZERO);
0726:
0727: assertTrue(IsDebitTestUtils.isDebitIllegalStateException(
0728: SpringContext.getBean(DocumentTypeService.class),
0729: SpringContext.getBean(DataDictionaryService.class),
0730: accountingDocument, accountingLine));
0731: }
0732:
0733: /**
0734: * tests an <code>IllegalStateException</code> is thrown for a positive liability
0735: *
0736: * @throws Exception
0737: */
0738: public void testIsDebit_errorCorrection_source_liability_positveAmount()
0739: throws Exception {
0740: AccountingDocument accountingDocument = IsDebitTestUtils
0741: .getErrorCorrectionDocument(SpringContext
0742: .getBean(DocumentService.class),
0743: PreEncumbranceDocument.class);
0744: AccountingLine accountingLine = IsDebitTestUtils
0745: .getLiabilityLine(accountingDocument,
0746: SourceAccountingLine.class, POSITIVE);
0747:
0748: assertTrue(IsDebitTestUtils.isDebitIllegalStateException(
0749: SpringContext.getBean(DocumentTypeService.class),
0750: SpringContext.getBean(DataDictionaryService.class),
0751: accountingDocument, accountingLine));
0752: }
0753:
0754: /**
0755: * tests an <code>IllegalStateException</code> is thrown for a negative liability
0756: *
0757: * @throws Exception
0758: */
0759: public void testIsDebit_errorCorrection_source_liability_negativeAmount()
0760: throws Exception {
0761: AccountingDocument accountingDocument = IsDebitTestUtils
0762: .getErrorCorrectionDocument(SpringContext
0763: .getBean(DocumentService.class),
0764: PreEncumbranceDocument.class);
0765: AccountingLine accountingLine = IsDebitTestUtils
0766: .getLiabilityLine(accountingDocument,
0767: SourceAccountingLine.class, NEGATIVE);
0768:
0769: assertTrue(IsDebitTestUtils.isDebitIllegalStateException(
0770: SpringContext.getBean(DocumentTypeService.class),
0771: SpringContext.getBean(DataDictionaryService.class),
0772: accountingDocument, accountingLine));
0773: }
0774:
0775: /**
0776: * tests an <code>IllegalStateException</code> is thrown for a zero liability
0777: *
0778: * @throws Exception
0779: */
0780: public void testIsDebit_errorCorrection_source_liability_zeroAmount()
0781: throws Exception {
0782: AccountingDocument accountingDocument = IsDebitTestUtils
0783: .getErrorCorrectionDocument(SpringContext
0784: .getBean(DocumentService.class),
0785: PreEncumbranceDocument.class);
0786: AccountingLine accountingLine = IsDebitTestUtils
0787: .getLiabilityLine(accountingDocument,
0788: SourceAccountingLine.class, KualiDecimal.ZERO);
0789:
0790: assertTrue(IsDebitTestUtils.isDebitIllegalStateException(
0791: SpringContext.getBean(DocumentTypeService.class),
0792: SpringContext.getBean(DataDictionaryService.class),
0793: accountingDocument, accountingLine));
0794: }
0795:
0796: /**
0797: * tests an <code>IllegalStateException</code> is thrown for a positive income
0798: *
0799: * @throws Exception
0800: */
0801: public void testIsDebit_errorCorrection_target_income_positveAmount()
0802: throws Exception {
0803: AccountingDocument accountingDocument = IsDebitTestUtils
0804: .getErrorCorrectionDocument(SpringContext
0805: .getBean(DocumentService.class),
0806: PreEncumbranceDocument.class);
0807: AccountingLine accountingLine = IsDebitTestUtils.getIncomeLine(
0808: accountingDocument, TargetAccountingLine.class,
0809: POSITIVE);
0810:
0811: assertTrue(IsDebitTestUtils.isDebitIllegalStateException(
0812: SpringContext.getBean(DocumentTypeService.class),
0813: SpringContext.getBean(DataDictionaryService.class),
0814: accountingDocument, accountingLine));
0815: }
0816:
0817: /**
0818: * tests an <code>IllegalStateException</code> is thrown for a negative income
0819: *
0820: * @throws Exception
0821: */
0822: public void testIsDebit_errorCorrection_target_income_negativeAmount()
0823: throws Exception {
0824: AccountingDocument accountingDocument = IsDebitTestUtils
0825: .getErrorCorrectionDocument(SpringContext
0826: .getBean(DocumentService.class),
0827: PreEncumbranceDocument.class);
0828: AccountingLine accountingLine = IsDebitTestUtils.getIncomeLine(
0829: accountingDocument, TargetAccountingLine.class,
0830: NEGATIVE);
0831:
0832: assertTrue(IsDebitTestUtils.isDebitIllegalStateException(
0833: SpringContext.getBean(DocumentTypeService.class),
0834: SpringContext.getBean(DataDictionaryService.class),
0835: accountingDocument, accountingLine));
0836: }
0837:
0838: /**
0839: * tests an <code>IllegalStateException</code> is thrown for a zero income
0840: *
0841: * @throws Exception
0842: */
0843: public void testIsDebit_errorCorrection_target_income_zeroAmount()
0844: throws Exception {
0845:
0846: AccountingDocument accountingDocument = IsDebitTestUtils
0847: .getErrorCorrectionDocument(SpringContext
0848: .getBean(DocumentService.class),
0849: PreEncumbranceDocument.class);
0850: AccountingLine accountingLine = IsDebitTestUtils.getIncomeLine(
0851: accountingDocument, TargetAccountingLine.class,
0852: KualiDecimal.ZERO);
0853:
0854: assertTrue(IsDebitTestUtils.isDebitIllegalStateException(
0855: SpringContext.getBean(DocumentTypeService.class),
0856: SpringContext.getBean(DataDictionaryService.class),
0857: accountingDocument, accountingLine));
0858: }
0859:
0860: /**
0861: * tests an <code>IllegalStateException</code> is thrown for a zero expense
0862: *
0863: * @throws Exception
0864: */
0865: public void testIsDebit_errorCorrection_target_expense_positveAmount()
0866: throws Exception {
0867: AccountingDocument accountingDocument = IsDebitTestUtils
0868: .getErrorCorrectionDocument(SpringContext
0869: .getBean(DocumentService.class),
0870: PreEncumbranceDocument.class);
0871: AccountingLine accountingLine = IsDebitTestUtils
0872: .getExpenseLine(accountingDocument,
0873: TargetAccountingLine.class, POSITIVE);
0874:
0875: assertTrue(IsDebitTestUtils.isDebitIllegalStateException(
0876: SpringContext.getBean(DocumentTypeService.class),
0877: SpringContext.getBean(DataDictionaryService.class),
0878: accountingDocument, accountingLine));
0879: }
0880:
0881: /**
0882: * tests true is returned for a positive expense
0883: *
0884: * @throws Exception
0885: */
0886: public void testIsDebit_errorCorrection_target_expense_negativeAmount()
0887: throws Exception {
0888: AccountingDocument accountingDocument = IsDebitTestUtils
0889: .getErrorCorrectionDocument(SpringContext
0890: .getBean(DocumentService.class),
0891: PreEncumbranceDocument.class);
0892: AccountingLine accountingLine = IsDebitTestUtils
0893: .getExpenseLine(accountingDocument,
0894: TargetAccountingLine.class, NEGATIVE);
0895:
0896: assertTrue(IsDebitTestUtils.isDebit(SpringContext
0897: .getBean(DocumentTypeService.class), SpringContext
0898: .getBean(DataDictionaryService.class),
0899: accountingDocument, accountingLine));
0900: }
0901:
0902: /**
0903: * tests an <code>IllegalStateException</code> is thrown for a zero expense
0904: *
0905: * @throws Exception
0906: */
0907: public void testIsDebit_errorCorrection_target_expense_zeroAmount()
0908: throws Exception {
0909: AccountingDocument accountingDocument = IsDebitTestUtils
0910: .getErrorCorrectionDocument(SpringContext
0911: .getBean(DocumentService.class),
0912: PreEncumbranceDocument.class);
0913: AccountingLine accountingLine = IsDebitTestUtils
0914: .getExpenseLine(accountingDocument,
0915: TargetAccountingLine.class, KualiDecimal.ZERO);
0916:
0917: assertTrue(IsDebitTestUtils.isDebitIllegalStateException(
0918: SpringContext.getBean(DocumentTypeService.class),
0919: SpringContext.getBean(DataDictionaryService.class),
0920: accountingDocument, accountingLine));
0921: }
0922:
0923: /**
0924: * tests an <code>IllegalStateException</code> is thrown for a positive asset
0925: *
0926: * @throws Exception
0927: */
0928: public void testIsDebit_errorCorrection_target_asset_positveAmount()
0929: throws Exception {
0930: AccountingDocument accountingDocument = IsDebitTestUtils
0931: .getErrorCorrectionDocument(SpringContext
0932: .getBean(DocumentService.class),
0933: PreEncumbranceDocument.class);
0934: AccountingLine accountingLine = IsDebitTestUtils.getAssetLine(
0935: accountingDocument, TargetAccountingLine.class,
0936: POSITIVE);
0937:
0938: assertTrue(IsDebitTestUtils.isDebitIllegalStateException(
0939: SpringContext.getBean(DocumentTypeService.class),
0940: SpringContext.getBean(DataDictionaryService.class),
0941: accountingDocument, accountingLine));
0942: }
0943:
0944: /**
0945: * tests an <code>IllegalStateException</code> is thrown for a negative asset
0946: *
0947: * @throws Exception
0948: */
0949: public void testIsDebit_errorCorrection_target_asset_negativeAmount()
0950: throws Exception {
0951: AccountingDocument accountingDocument = IsDebitTestUtils
0952: .getErrorCorrectionDocument(SpringContext
0953: .getBean(DocumentService.class),
0954: PreEncumbranceDocument.class);
0955: AccountingLine accountingLine = IsDebitTestUtils.getAssetLine(
0956: accountingDocument, TargetAccountingLine.class,
0957: NEGATIVE);
0958:
0959: assertTrue(IsDebitTestUtils.isDebitIllegalStateException(
0960: SpringContext.getBean(DocumentTypeService.class),
0961: SpringContext.getBean(DataDictionaryService.class),
0962: accountingDocument, accountingLine));
0963: }
0964:
0965: /**
0966: * tests an <code>IllegalStateException</code> is thrown for a zero asset
0967: *
0968: * @throws Exception
0969: */
0970: public void testIsDebit_errorCorrection_target_asset_zeroAmount()
0971: throws Exception {
0972: AccountingDocument accountingDocument = IsDebitTestUtils
0973: .getErrorCorrectionDocument(SpringContext
0974: .getBean(DocumentService.class),
0975: PreEncumbranceDocument.class);
0976: AccountingLine accountingLine = IsDebitTestUtils.getAssetLine(
0977: accountingDocument, TargetAccountingLine.class,
0978: KualiDecimal.ZERO);
0979:
0980: assertTrue(IsDebitTestUtils.isDebitIllegalStateException(
0981: SpringContext.getBean(DocumentTypeService.class),
0982: SpringContext.getBean(DataDictionaryService.class),
0983: accountingDocument, accountingLine));
0984: }
0985:
0986: /**
0987: * tests an <code>IllegalStateException</code> is thrown for a positive liability
0988: *
0989: * @throws Exception
0990: */
0991: public void testIsDebit_errorCorrection_target_liability_positveAmount()
0992: throws Exception {
0993: AccountingDocument accountingDocument = IsDebitTestUtils
0994: .getErrorCorrectionDocument(SpringContext
0995: .getBean(DocumentService.class),
0996: PreEncumbranceDocument.class);
0997: AccountingLine accountingLine = IsDebitTestUtils
0998: .getLiabilityLine(accountingDocument,
0999: TargetAccountingLine.class, POSITIVE);
1000:
1001: assertTrue(IsDebitTestUtils.isDebitIllegalStateException(
1002: SpringContext.getBean(DocumentTypeService.class),
1003: SpringContext.getBean(DataDictionaryService.class),
1004: accountingDocument, accountingLine));
1005: }
1006:
1007: /**
1008: * tests an <code>IllegalStateException</code> is thrown for a negative liability
1009: *
1010: * @throws Exception
1011: */
1012: public void testIsDebit_errorCorrection_target_liability_negativeAmount()
1013: throws Exception {
1014: AccountingDocument accountingDocument = IsDebitTestUtils
1015: .getErrorCorrectionDocument(SpringContext
1016: .getBean(DocumentService.class),
1017: PreEncumbranceDocument.class);
1018: AccountingLine accountingLine = IsDebitTestUtils
1019: .getLiabilityLine(accountingDocument,
1020: TargetAccountingLine.class, NEGATIVE);
1021:
1022: assertTrue(IsDebitTestUtils.isDebitIllegalStateException(
1023: SpringContext.getBean(DocumentTypeService.class),
1024: SpringContext.getBean(DataDictionaryService.class),
1025: accountingDocument, accountingLine));
1026: }
1027:
1028: /**
1029: * tests an <code>IllegalStateException</code> is thrown for a zero liability
1030: *
1031: * @throws Exception
1032: */
1033: public void testIsDebit_errorCorrection_target_liability_zeroAmount()
1034: throws Exception {
1035: AccountingDocument accountingDocument = IsDebitTestUtils
1036: .getErrorCorrectionDocument(SpringContext
1037: .getBean(DocumentService.class),
1038: PreEncumbranceDocument.class);
1039: AccountingLine accountingLine = IsDebitTestUtils
1040: .getLiabilityLine(accountingDocument,
1041: TargetAccountingLine.class, KualiDecimal.ZERO);
1042:
1043: assertTrue(IsDebitTestUtils.isDebitIllegalStateException(
1044: SpringContext.getBean(DocumentTypeService.class),
1045: SpringContext.getBean(DataDictionaryService.class),
1046: accountingDocument, accountingLine));
1047: }
1048:
1049: }
|