-
ChatterFeed
-
0Best Answers
-
0Likes Received
-
0Likes Given
-
3Questions
-
6Replies
How to test my XML file for null child nodes?
I've created a test method that checks to see if the XML document is null. However, my test coverage is still not passing even with SeeAllData = true. Here's the test method I'm currently using:
string XMLStr = ''; XMLStr = '<?xml version="1.0" encoding="UTF-8"?><IFX><CreditSvcRs><LoanAppSvcRs><Routing Transaction="LoanAppRs,LoanAppRq"><From><IDs><ID Type="DealerID">40511</ID><ID Type="EvaluatorID">91</ID><ID Type="OrigenateRefNumber">2681674</ID><ID Type="Source">WEBSITE</ID><ID Type="Network">WEBSITE</ID><ID Type="ApplicationNumber">1297043</ID><ID Type="DecisionID">3084818</ID></IDs><HostNameBack>Origenate</HostNameBack><RemoteRefNumber>157277</RemoteRefNumber></From><To><IDs><ID Type="DecisionID">3084818</ID><ID Type="EvaluatorID">0</ID><ID Type="ApplicationNumber" /></IDs><Destination>defined-by-gateway</Destination><LocalRefNumber>157277</LocalRefNumber></To><Processing><Process Type="Trans-type">LOAD</Process></Processing></Routing><LoanAppRs PaymentCall="True"><Decision Category="Analyst" DecisionRefID="3084818" Evaluator="91" IndividualType="Applicant" Status="APPROVE"><Analyst><AnalystName>Tereance Dennis</AnalystName><ContactInfo><Phone><AreaCode>888</AreaCode><Exchange>696</Exchange><LastPart>8461</LastPart><Extension>38581</Extension></Phone></ContactInfo><AnalystID>TDENNIS</AnalystID></Analyst><Comments><Comment>Fin $15200</Comment></Comments><Payment>293.03</Payment><CustomerRate>11.3</CustomerRate><Date><Year>2014</Year><Month>04</Month><Day>18</Day><Hour>11</Hour><Minute>45</Minute><Second>47</Second></Date><Term>72</Term><ApprovedAmount>15200</ApprovedAmount><RepaymentType>Installment</RepaymentType><BuyRate>0</BuyRate><Grade>F1</Grade><BBCLAmortTerm>0</BBCLAmortTerm><DealerIncentive>0</DealerIncentive><PaymentFrequency>Monthly</PaymentFrequency><StandardStips /><OutsideSource /><LTV>999.99</LTV><ApprovedDeposit>0</ApprovedDeposit><Stipulations><Stipulation><CheckListItem>True</CheckListItem><Required>True</Required><Text>PROOF OF INCOME, RESIDENCE, INSURANCE, DRIVERS LICENSE AND 2 PERSONAL REFERENCES</Text><StipulationType>Predefined</StipulationType></Stipulation><Stipulation><CheckListItem>True</CheckListItem><Required>True</Required><Text>WE WILL FINANCE 100% OF RETAIL VALUE + SERVICE CONTRACT UP TO APPROVED AMOUNT FINANCED</Text><StipulationType>Predefined</StipulationType></Stipulation></Stipulations><Finance><Term>0</Term><FinancedFees><FinancedFee Type="35"><Amount>0</Amount></FinancedFee><FinancedFee Type="36"><Amount>0</Amount></FinancedFee><FinancedFee Type="53"><Amount>0</Amount></FinancedFee><FinancedFee Type="54"><Amount>0</Amount></FinancedFee><FinancedFee Type="55"><Amount>0</Amount></FinancedFee><FinancedFee Type="84"><Amount>0</Amount></FinancedFee><FinancedFee Type="99"><Amount>0</Amount></FinancedFee><FinancedFee Type="158"><Amount>0</Amount></FinancedFee></FinancedFees></Finance><DecisionRules><DTIPTILTV><Category>APP</Category><PolicyDecision>P</PolicyDecision><Triggered>False</Triggered><Value>49.91</Value><Type>DTI</Type></DTIPTILTV><DTIPTILTV><Category>APP</Category><Triggered>False</Triggered><Value>999.99</Value><Type>LTV</Type></DTIPTILTV><DTIPTILTV><Category>APP</Category><PolicyDecision>P</PolicyDecision><Triggered>False</Triggered><Value>13.95</Value><Type>PTI</Type></DTIPTILTV></DecisionRules></Decision><Individuals><Individual IndividualType="Applicant"><Score>482</Score></Individual></Individuals></LoanAppRs></LoanAppSvcRs></CreditSvcRs><CreditSvcRq><LoanAppSvcRq><Routing><From><IDs><ID Type="EvaluatorID">91</ID><ID Type="OrigenateRefNumber">2681674</ID><ID Type="Source">WEBSITE</ID></IDs><RemoteRefNumber>157277</RemoteRefNumber></From></Routing><LoanAppRq PaymentCall="True" Personal="True" Type="Finance"><Summary MissingInfo="False" PaperContract=""><ProductType>Direct Auto Retail</ProductType><TaskGroup>CONTRACTADMIN</TaskGroup><InitiationDate><Date><Year>2014</Year><Month>04</Month><Day>18</Day></Date></InitiationDate><LoanPurpose>Purchase Automobile</LoanPurpose><CallBureau>True</CallBureau><ReceiptDate><Date><Year>2014</Year><Month>04</Month><Day>18</Day><Hour>11</Hour><Minute>35</Minute><Second>45</Second></Date></ReceiptDate><MostRecentGrade>F1</MostRecentGrade><BookingStatus>1</BookingStatus><AppStatus>17</AppStatus><LastAccessDate><Date><Year>2014</Year><Month>04</Month><Day>18</Day></Date></LastAccessDate><DecisionStatus>APPROVE</DecisionStatus><TaskDesc>PURCHASE OUTBOUND</TaskDesc></Summary><Collateral Type="Auto"><CollateralInfo Condition="Used" IncludeInLTV="True" New="False" Primary="True"><Specifications><Specification Name="AutomaticTransmission" /><Specification Name="Make">Other</Specification><Specification Name="Diesel" /><Specification Name="ValueGuide">Manual</Specification><Specification Name="TotalRetailValue">0</Specification></Specifications></CollateralInfo></Collateral><Finance><CashPrice>0</CashPrice><SalesTax>0</SalesTax><Requested><Rate>18.95</Rate><Term>0</Term><Payment>0</Payment><PaymentMethod>Installment</PaymentMethod><PaymentFrequency>Monthly</PaymentFrequency><Amount>0</Amount><FixedPaymentMethod>1</FixedPaymentMethod><IndexType>0</IndexType><IndexRate>0</IndexRate><Margin>0</Margin></Requested><TradeInLastFinanced>False</TradeInLastFinanced><NetTradeIn>0</NetTradeIn><TotalFinancedFees>0</TotalFinancedFees><LastFinanced>False</LastFinanced><TotalInterestCost>0</TotalInterestCost><Program>Dealer Purchase</Program><HMDAEligibleProgram>False</HMDAEligibleProgram><TotalPriceAdjustments>0</TotalPriceAdjustments><Closing><FirstPaymentDate><Date><Year>2014</Year><Month>06</Month><Day>02</Day></Date></FirstPaymentDate></Closing><FinancedFees><FinancedFee Type="35"><Amount>0</Amount><FeesDesc>GAP Fee</FeesDesc><FinPoc>Y</FinPoc><Include>True</Include><LenderAmt>0</LenderAmt><BorrowerAmt>0</BorrowerAmt><OtherAmt>0</OtherAmt><PPFC>False</PPFC><FlatFee>False</FlatFee><PaidBy>B</PaidBy><AmtFinFlg>False</AmtFinFlg><ReqAmtFlg>True</ReqAmtFlg></FinancedFee><FinancedFee Type="36"><Amount>0</Amount><FeesDesc>Misc</FeesDesc><FinPoc>Y</FinPoc><Include>True</Include><LenderAmt>0</LenderAmt><BorrowerAmt>0</BorrowerAmt><OtherAmt>0</OtherAmt><PPFC>False</PPFC><FlatFee>False</FlatFee><PaidBy>B</PaidBy><AmtFinFlg>False</AmtFinFlg><ReqAmtFlg>True</ReqAmtFlg></FinancedFee><FinancedFee Type="53"><Amount>0</Amount><FeesDesc>Service Contract</FeesDesc><FinPoc>Y</FinPoc><Include>True</Include><LenderAmt>0</LenderAmt><BorrowerAmt>0</BorrowerAmt><OtherAmt>0</OtherAmt><PPFC>False</PPFC><FlatFee>False</FlatFee><PaidBy>B</PaidBy><AmtFinFlg>False</AmtFinFlg><ReqAmtFlg>True</ReqAmtFlg></FinancedFee><FinancedFee Type="54"><Amount>0</Amount><FeesDesc>Doc Fee</FeesDesc><FinPoc>Y</FinPoc><Include>True</Include><LenderAmt>0</LenderAmt><BorrowerAmt>0</BorrowerAmt><OtherAmt>0</OtherAmt><PPFC>False</PPFC><FlatFee>False</FlatFee><PaidBy>B</PaidBy><AmtFinFlg>False</AmtFinFlg><ReqAmtFlg>True</ReqAmtFlg></FinancedFee><FinancedFee Type="55"><Amount>0</Amount><FeesDesc>Title Fee</FeesDesc><FinPoc>Y</FinPoc><Include>True</Include><LenderAmt>0</LenderAmt><BorrowerAmt>0</BorrowerAmt><OtherAmt>0</OtherAmt><PPFC>False</PPFC><FlatFee>False</FlatFee><PaidBy>B</PaidBy><AmtFinFlg>False</AmtFinFlg><ReqAmtFlg>True</ReqAmtFlg></FinancedFee><FinancedFee Type="84"><Amount>0</Amount><FeesDesc>Dealer Participation</FeesDesc><FinPoc>Y</FinPoc><Include>True</Include><LenderAmt>0</LenderAmt><BorrowerAmt>0</BorrowerAmt><OtherAmt>0</OtherAmt><PPFC>False</PPFC><FlatFee>False</FlatFee><PaidBy>O</PaidBy><AmtFinFlg>False</AmtFinFlg><ReqAmtFlg>True</ReqAmtFlg></FinancedFee><FinancedFee Type="99"><Amount>0</Amount><FeesDesc>Prior Loan Payoff</FeesDesc><FinPoc>Y</FinPoc><Include>True</Include><LenderAmt>0</LenderAmt><BorrowerAmt>0</BorrowerAmt><OtherAmt>0</OtherAmt><PPFC>False</PPFC><FlatFee>False</FlatFee><PaidBy>B</PaidBy><AmtFinFlg>False</AmtFinFlg><ReqAmtFlg>True</ReqAmtFlg></FinancedFee><FinancedFee Type="158"><Amount>0</Amount><FeesDesc>State Tax Stamp</FeesDesc><FinPoc>Y</FinPoc><Include>True</Include><LenderAmt>0</LenderAmt><BorrowerAmt>0</BorrowerAmt><OtherAmt>0</OtherAmt><PPFC>False</PPFC><FlatFee>False</FlatFee><PaidBy>B</PaidBy><AmtFinFlg>False</AmtFinFlg><ReqAmtFlg>True</ReqAmtFlg></FinancedFee><FinancedFeeSum><TotalLenderFee>0</TotalLenderFee><TotalBorrowerFee>0</TotalBorrowerFee><TotalOtherFee>0</TotalOtherFee><TotalFinancedFee>0</TotalFinancedFee><TotalNonFinancedFee>0</TotalNonFinancedFee><TotalPPFCFee>0</TotalPPFCFee><TotalNonPPFCFee>0</TotalNonPPFCFee><TotalPOCFee>0</TotalPOCFee><TotalFee>0</TotalFee><TotalIncAmtFee>0</TotalIncAmtFee><TotalDealerFee>0</TotalDealerFee><LessNonFinPPFC>0</LessNonFinPPFC></FinancedFeeSum></FinancedFees></Finance><ContractFinance><FinancedFees><FinancedFee Type="35"><Amount>0</Amount><FeesDesc>GAP Fee</FeesDesc><FinPoc>Y</FinPoc><Include>True</Include><LenderAmt>0</LenderAmt><BorrowerAmt>0</BorrowerAmt><OtherAmt>0</OtherAmt><PPFC>False</PPFC><FlatFee>False</FlatFee><PaidBy>B</PaidBy><AmtFinFlg>False</AmtFinFlg><ReqAmtFlg>True</ReqAmtFlg></FinancedFee><FinancedFee Type="36"><Amount>0</Amount><FeesDesc>Misc</FeesDesc><FinPoc>Y</FinPoc><Include>True</Include><LenderAmt>0</LenderAmt><BorrowerAmt>0</BorrowerAmt><OtherAmt>0</OtherAmt><PPFC>False</PPFC><FlatFee>False</FlatFee><PaidBy>B</PaidBy><AmtFinFlg>False</AmtFinFlg><ReqAmtFlg>True</ReqAmtFlg></FinancedFee><FinancedFee Type="53"><Amount>0</Amount><FeesDesc>Service Contract</FeesDesc><FinPoc>Y</FinPoc><Include>True</Include><LenderAmt>0</LenderAmt><BorrowerAmt>0</BorrowerAmt><OtherAmt>0</OtherAmt><PPFC>False</PPFC><FlatFee>False</FlatFee><PaidBy>B</PaidBy><AmtFinFlg>False</AmtFinFlg><ReqAmtFlg>True</ReqAmtFlg></FinancedFee><FinancedFee Type="54"><Amount>0</Amount><FeesDesc>Doc Fee</FeesDesc><FinPoc>Y</FinPoc><Include>True</Include><LenderAmt>0</LenderAmt><BorrowerAmt>0</BorrowerAmt><OtherAmt>0</OtherAmt><PPFC>False</PPFC><FlatFee>False</FlatFee><PaidBy>B</PaidBy><AmtFinFlg>False</AmtFinFlg><ReqAmtFlg>True</ReqAmtFlg></FinancedFee><FinancedFee Type="55"><Amount>0</Amount><FeesDesc>Title Fee</FeesDesc><FinPoc>Y</FinPoc><Include>True</Include><LenderAmt>0</LenderAmt><BorrowerAmt>0</BorrowerAmt><OtherAmt>0</OtherAmt><PPFC>False</PPFC><FlatFee>False</FlatFee><PaidBy>B</PaidBy><AmtFinFlg>False</AmtFinFlg><ReqAmtFlg>True</ReqAmtFlg></FinancedFee><FinancedFee Type="84"><Amount>0</Amount><FeesDesc>Dealer Participation</FeesDesc><FinPoc>Y</FinPoc><Include>True</Include><LenderAmt>0</LenderAmt><BorrowerAmt>0</BorrowerAmt><OtherAmt>0</OtherAmt><PPFC>False</PPFC><FlatFee>False</FlatFee><PaidBy>O</PaidBy><AmtFinFlg>False</AmtFinFlg><ReqAmtFlg>True</ReqAmtFlg></FinancedFee><FinancedFee Type="99"><Amount>0</Amount><FeesDesc>Prior Loan Payoff</FeesDesc><FinPoc>Y</FinPoc><Include>True</Include><LenderAmt>0</LenderAmt><BorrowerAmt>0</BorrowerAmt><OtherAmt>0</OtherAmt><PPFC>False</PPFC><FlatFee>False</FlatFee><PaidBy>B</PaidBy><AmtFinFlg>False</AmtFinFlg><ReqAmtFlg>True</ReqAmtFlg></FinancedFee><FinancedFee Type="158"><Amount>0</Amount><FeesDesc>State Tax Stamp</FeesDesc><FinPoc>Y</FinPoc><Include>True</Include><LenderAmt>0</LenderAmt><BorrowerAmt>0</BorrowerAmt><OtherAmt>0</OtherAmt><PPFC>False</PPFC><FlatFee>False</FlatFee><PaidBy>B</PaidBy><AmtFinFlg>False</AmtFinFlg><ReqAmtFlg>True</ReqAmtFlg></FinancedFee><FinancedFeeSum><TotalLenderFee>0</TotalLenderFee><TotalBorrowerFee>0</TotalBorrowerFee><TotalOtherFee>0</TotalOtherFee><TotalFinancedFee>0</TotalFinancedFee><TotalNonFinancedFee>0</TotalNonFinancedFee><TotalPPFCFee>0</TotalPPFCFee><TotalNonPPFCFee>0</TotalNonPPFCFee><TotalPOCFee>0</TotalPOCFee><TotalFee>0</TotalFee><TotalIncAmtFee>0</TotalIncAmtFee><TotalDealerFee>0</TotalDealerFee><LessNonFinPPFC>0</LessNonFinPPFC></FinancedFeeSum></FinancedFees><Disclosure><Rate>11.3</Rate><Term>72</Term><AmountFinanced>15200</AmountFinanced><FinanceCharge>5898.16</FinanceCharge><TotalOfPayments>21098.16</TotalOfPayments><TotalDownPayment>0</TotalDownPayment><TotalSalesPrice>21098.16</TotalSalesPrice><RepaymentMethod>Installment</RepaymentMethod><IndexType>0</IndexType><IndexRate>0</IndexRate><Margin>0</Margin></Disclosure><Itemizations><SalesTax>0</SalesTax><CashPrice>0</CashPrice><NetTradeIn>0</NetTradeIn><TotalDown>0</TotalDown><DealerIncentive>0</DealerIncentive><OtherAmount>0</OtherAmount><DiscountAmount>0</DiscountAmount><DeferredDownPayment>0</DeferredDownPayment><ADandD>0</ADandD><OtherPublicFee>0</OtherPublicFee><OtherInsuranceFee>0</OtherInsuranceFee><Proceeds>0</Proceeds><ProceedsAdjustment>0</ProceedsAdjustment><TotalFundingProceeds>0</TotalFundingProceeds></Itemizations><ContractAmount>15200</ContractAmount><RepaymentMethod>Installment</RepaymentMethod><FirstPaymentDate><Date><Year>2014</Year><Month>06</Month><Day>02</Day></Date></FirstPaymentDate><LineOfCredit>15200</LineOfCredit><ItemizationsLenderGap>0</ItemizationsLenderGap><PrepaymentPenalty /><OverdraftProtection /><AutoPayFlag /></ContractFinance><Applicant><Personal><Individuals><Individual Duplicate="" Entity="A1" Fraud="False" Type="Applicant"><AnalystApproved><Rate>11.3</Rate><Term>72</Term><Amount>15200</Amount><Payment>293.03</Payment><AnalystName>Tereance Dennis</AnalystName><AnalystGrade>F1</AnalystGrade><PreApproveFlg>0</PreApproveFlg><AnalystUserID>TDENNIS</AnalystUserID><BureauScore>678</BureauScore></AnalystApproved><LatestDecision><BureauScore>678</BureauScore><OfficerNumber>C</OfficerNumber></LatestDecision><GivenName><FirstName>BRODERICK</FirstName><LastName>TOWNS</LastName></GivenName><SSN>418926601</SSN><DateOfBirth><Date><Year>1958</Year><Month>10</Month><Day>21</Day></Date></DateOfBirth><Military /><RemoteRefNumber>1351848</RemoteRefNumber><Credit><AddedDebt>600</AddedDebt></Credit><ContactInfo><Phone><AreaCode>256</AreaCode><Exchange>329</Exchange><LastPart>8639</LastPart></Phone><Mobile><AreaCode>000</AreaCode><Exchange>000</Exchange><LastPart>0000</LastPart></Mobile><Address Type="Current"><StreetName>15th Place</StreetName><City>ALEXANDER CITY</City><State>AL</State><Zip>35010</Zip><TimeAtLocation><Year>12</Year><Month>0</Month></TimeAtLocation><StreetNumber>2052</StreetNumber></Address></ContactInfo><Age>55</Age><OptOut /><AutoDecExpt /><CurCustomer /><Signer>True</Signer><Rego>False</Rego><TotalAdjustedIncomeNum>2100</TotalAdjustedIncomeNum><Resident Type="Homeowner"><Payment>500</Payment></Resident><Employment CurrentEmployer="True" Status="Other"><Employer><EmployerName>Social Security</EmployerName><ContactInfo><Phone><AreaCode>000</AreaCode><Exchange>000</Exchange><LastPart>0000</LastPart></Phone></ContactInfo></Employer><Years>0</Years><Months>6</Months><Income Basis="Monthly" Gross="True">1600</Income><GrossMonthlyIncome>1600</GrossMonthlyIncome><SecondCurrentEmployerFlg>False</SecondCurrentEmployerFlg></Employment><Employment CurrentEmployer="False" Status="Other"><Employer><EmployerName>Frontier Yards</EmployerName><ContactInfo><Phone><AreaCode>000</AreaCode><Exchange>000</Exchange><LastPart>0000</LastPart></Phone></ContactInfo></Employer><Years>7</Years><Months>0</Months><Income Gross="" /><SecondCurrentEmployerFlg>False</SecondCurrentEmployerFlg></Employment><Employment CurrentEmployer="True"><Income Basis="Annual" Gross="True">0</Income><GrossMonthlyIncome>0</GrossMonthlyIncome><SecondCurrentEmployerFlg>True</SecondCurrentEmployerFlg></Employment><OtherIncomes><OtherIncome Basis="Monthly" Gross="True"><Source>0.00</Source><Income>500</Income><MonthlyIncome>0</MonthlyIncome></OtherIncome><OtherIncome Basis="Monthly" Gross="True"><Source>Unknown</Source><Income>0</Income></OtherIncome></OtherIncomes><BureauScores><BureauScore><Bureau>XPN</Bureau><ScoreNum>678</ScoreNum><ScoreModel>V</ScoreModel></BureauScore><BureauScore><Bureau>XPN</Bureau><ScoreNum>650</ScoreNum><ScoreModel>AG</ScoreModel></BureauScore></BureauScores><ScoreCards><ApplicationScoreCard><Score>482</Score><ScoreGrade>F1</ScoreGrade></ApplicationScoreCard></ScoreCards></Individual></Individuals></Personal></Applicant><ContractRequest><Documents /></ContractRequest><ContractCollateral Type="Auto" /><ContractSchedules><Schedule><Order>1</Order><NumberOfPayments>72</NumberOfPayments><PaymentAmount>293.03</PaymentAmount><FirstPaymentDue><Date><Year>2014</Year><Month>06</Month><Day>02</Day></Date></FirstPaymentDue><Frequency>Monthly</Frequency></Schedule></ContractSchedules><Originator OID="93945"><Contact>TODD</Contact><Phone><AreaCode>800</AreaCode><Exchange>900</Exchange><LastPart>5150</LastPart></Phone><Priority>True</Priority><OriginatorCode>40511</OriginatorCode><ACH_DFI_ID>11100002</ACH_DFI_ID><Prenotification>1</Prenotification><BuyingCenter>Western</BuyingCenter><PreApproved /><Territory>Direct Lending</Territory><DealerType>Direct - Partner</DealerType><DealerName>USAA - PHONE</DealerName><SalesRepresentative>400001</SalesRepresentative><FundingMethod>Company Check</FundingMethod><AffiliateID>40511</AffiliateID><SalesRepFirstName>Direct</SalesRepFirstName><SalesRepLastName>Lending</SalesRepLastName><BuyingCenterID>1</BuyingCenterID><Eval_Prenotification>0</Eval_Prenotification><Evaluator_Name>CarFinance Capital</Evaluator_Name><Addresses><Address Type="Current"><AddressLine1>7525 irvine center dr</AddressLine1><City>irvine</City><State>CA</State><Zip>92618</Zip></Address><Address Type="Billing"><AddressLine1>7525 irvine center dr</AddressLine1><City>irvine</City><State>CA</State><Zip>92618</Zip></Address><Address Type="Funding"><AddressLine1>7525 irvine center dr</AddressLine1><City>irvine</City><State>CA</State><Zip>92618</Zip></Address><CommunicationType Type="Fax" /><CommunicationType Type="Fax" /><CommunicationType Type="Fax" /><CommunicationType Type="Fax" /><CommunicationType Type="Fax" /><CommunicationType Type="Fax" /></Addresses><MiscItems><MiscItem ID="1" /><MiscItem ID="2" /><MiscItem ID="3" /><MiscItem ID="4" /><MiscItem ID="5" /></MiscItems></Originator></LoanAppRq></LoanAppSvcRq></CreditSvcRq></IFX>'; Dom.Document xmlDoc = new Dom.Document(); xmlDoc.load(xmlStr); IFXLoadXML.IFXLoanAppRq ifxObj = new IFXLoadXML.IFXLoanAppRq(xmlDoc.getRootElement()); System.assertNotEquals(null, xmlDoc);What must be done to test that both the xmlDoc is not null and that the XMLNodes are not null either?
-
- Sid Childers
- August 27, 2014
- Like
- 0
Error Initial Term of Field Expression must be a concrete SObject.List<StaticResource>
I've written the following in a test class attempting to achieve adequate code coverage by parsing XML nodes into various field values. I want to reference the static resource XML file in test classes instead of entering the actual XML and assigning it to a XMLStr. However, I am receiving the error stated above.
What must be fixed in order for the Static Resource to be loaded into the test class, XML nodes evaluated etc.?
List<StaticResource> ifx; ifx = [Select Body from StaticResource where Name = '{Direct8_8_Decision}' LIMIT 1]; string XMLStr = ifx.body.ToString(); Dom.Document xmlDoc = new Dom.Document(); xmlDoc.load(xmlStr); IFXLoadXML.IFXMain ifxObj = new IFXLoadXML.IFXMain(xmlDoc.getRootElement()); System.assertNotEquals(null, xmlDoc);
What must be fixed in order for the Static Resource to be loaded into the test class, XML nodes evaluated etc.?
-
- Sid Childers
- August 27, 2014
- Like
- 0
Achieving Optimal Code Coverage for APEX Class Calling out to RestRequest
Hi,
I'm attempting to attain optimal code coverage on an APEX class which is used to call a RESTful web service, retrieves an XML document, parses it and stores the values from he XML nodes into our various Account, Opportunity and other objects.
Currently, code coverage is at 0% because the test class is still in development. I understand that I can't test the HTTPRequest invocation. However, I am in need of guidance as to best strategy to accomplish optimal code coverage. Should I simply focus on the proper assignment of XML node values to corresponding fields in the Account object? Thanks much for your hlp and guidance.
I'm attempting to attain optimal code coverage on an APEX class which is used to call a RESTful web service, retrieves an XML document, parses it and stores the values from he XML nodes into our various Account, Opportunity and other objects.
Currently, code coverage is at 0% because the test class is still in development. I understand that I can't test the HTTPRequest invocation. However, I am in need of guidance as to best strategy to accomplish optimal code coverage. Should I simply focus on the proper assignment of XML node values to corresponding fields in the Account object? Thanks much for your hlp and guidance.
-
- Sid Childers
- August 21, 2014
- Like
- 0
How to test my XML file for null child nodes?
I've created a test method that checks to see if the XML document is null. However, my test coverage is still not passing even with SeeAllData = true. Here's the test method I'm currently using:
string XMLStr = ''; XMLStr = '<?xml version="1.0" encoding="UTF-8"?><IFX><CreditSvcRs><LoanAppSvcRs><Routing Transaction="LoanAppRs,LoanAppRq"><From><IDs><ID Type="DealerID">40511</ID><ID Type="EvaluatorID">91</ID><ID Type="OrigenateRefNumber">2681674</ID><ID Type="Source">WEBSITE</ID><ID Type="Network">WEBSITE</ID><ID Type="ApplicationNumber">1297043</ID><ID Type="DecisionID">3084818</ID></IDs><HostNameBack>Origenate</HostNameBack><RemoteRefNumber>157277</RemoteRefNumber></From><To><IDs><ID Type="DecisionID">3084818</ID><ID Type="EvaluatorID">0</ID><ID Type="ApplicationNumber" /></IDs><Destination>defined-by-gateway</Destination><LocalRefNumber>157277</LocalRefNumber></To><Processing><Process Type="Trans-type">LOAD</Process></Processing></Routing><LoanAppRs PaymentCall="True"><Decision Category="Analyst" DecisionRefID="3084818" Evaluator="91" IndividualType="Applicant" Status="APPROVE"><Analyst><AnalystName>Tereance Dennis</AnalystName><ContactInfo><Phone><AreaCode>888</AreaCode><Exchange>696</Exchange><LastPart>8461</LastPart><Extension>38581</Extension></Phone></ContactInfo><AnalystID>TDENNIS</AnalystID></Analyst><Comments><Comment>Fin $15200</Comment></Comments><Payment>293.03</Payment><CustomerRate>11.3</CustomerRate><Date><Year>2014</Year><Month>04</Month><Day>18</Day><Hour>11</Hour><Minute>45</Minute><Second>47</Second></Date><Term>72</Term><ApprovedAmount>15200</ApprovedAmount><RepaymentType>Installment</RepaymentType><BuyRate>0</BuyRate><Grade>F1</Grade><BBCLAmortTerm>0</BBCLAmortTerm><DealerIncentive>0</DealerIncentive><PaymentFrequency>Monthly</PaymentFrequency><StandardStips /><OutsideSource /><LTV>999.99</LTV><ApprovedDeposit>0</ApprovedDeposit><Stipulations><Stipulation><CheckListItem>True</CheckListItem><Required>True</Required><Text>PROOF OF INCOME, RESIDENCE, INSURANCE, DRIVERS LICENSE AND 2 PERSONAL REFERENCES</Text><StipulationType>Predefined</StipulationType></Stipulation><Stipulation><CheckListItem>True</CheckListItem><Required>True</Required><Text>WE WILL FINANCE 100% OF RETAIL VALUE + SERVICE CONTRACT UP TO APPROVED AMOUNT FINANCED</Text><StipulationType>Predefined</StipulationType></Stipulation></Stipulations><Finance><Term>0</Term><FinancedFees><FinancedFee Type="35"><Amount>0</Amount></FinancedFee><FinancedFee Type="36"><Amount>0</Amount></FinancedFee><FinancedFee Type="53"><Amount>0</Amount></FinancedFee><FinancedFee Type="54"><Amount>0</Amount></FinancedFee><FinancedFee Type="55"><Amount>0</Amount></FinancedFee><FinancedFee Type="84"><Amount>0</Amount></FinancedFee><FinancedFee Type="99"><Amount>0</Amount></FinancedFee><FinancedFee Type="158"><Amount>0</Amount></FinancedFee></FinancedFees></Finance><DecisionRules><DTIPTILTV><Category>APP</Category><PolicyDecision>P</PolicyDecision><Triggered>False</Triggered><Value>49.91</Value><Type>DTI</Type></DTIPTILTV><DTIPTILTV><Category>APP</Category><Triggered>False</Triggered><Value>999.99</Value><Type>LTV</Type></DTIPTILTV><DTIPTILTV><Category>APP</Category><PolicyDecision>P</PolicyDecision><Triggered>False</Triggered><Value>13.95</Value><Type>PTI</Type></DTIPTILTV></DecisionRules></Decision><Individuals><Individual IndividualType="Applicant"><Score>482</Score></Individual></Individuals></LoanAppRs></LoanAppSvcRs></CreditSvcRs><CreditSvcRq><LoanAppSvcRq><Routing><From><IDs><ID Type="EvaluatorID">91</ID><ID Type="OrigenateRefNumber">2681674</ID><ID Type="Source">WEBSITE</ID></IDs><RemoteRefNumber>157277</RemoteRefNumber></From></Routing><LoanAppRq PaymentCall="True" Personal="True" Type="Finance"><Summary MissingInfo="False" PaperContract=""><ProductType>Direct Auto Retail</ProductType><TaskGroup>CONTRACTADMIN</TaskGroup><InitiationDate><Date><Year>2014</Year><Month>04</Month><Day>18</Day></Date></InitiationDate><LoanPurpose>Purchase Automobile</LoanPurpose><CallBureau>True</CallBureau><ReceiptDate><Date><Year>2014</Year><Month>04</Month><Day>18</Day><Hour>11</Hour><Minute>35</Minute><Second>45</Second></Date></ReceiptDate><MostRecentGrade>F1</MostRecentGrade><BookingStatus>1</BookingStatus><AppStatus>17</AppStatus><LastAccessDate><Date><Year>2014</Year><Month>04</Month><Day>18</Day></Date></LastAccessDate><DecisionStatus>APPROVE</DecisionStatus><TaskDesc>PURCHASE OUTBOUND</TaskDesc></Summary><Collateral Type="Auto"><CollateralInfo Condition="Used" IncludeInLTV="True" New="False" Primary="True"><Specifications><Specification Name="AutomaticTransmission" /><Specification Name="Make">Other</Specification><Specification Name="Diesel" /><Specification Name="ValueGuide">Manual</Specification><Specification Name="TotalRetailValue">0</Specification></Specifications></CollateralInfo></Collateral><Finance><CashPrice>0</CashPrice><SalesTax>0</SalesTax><Requested><Rate>18.95</Rate><Term>0</Term><Payment>0</Payment><PaymentMethod>Installment</PaymentMethod><PaymentFrequency>Monthly</PaymentFrequency><Amount>0</Amount><FixedPaymentMethod>1</FixedPaymentMethod><IndexType>0</IndexType><IndexRate>0</IndexRate><Margin>0</Margin></Requested><TradeInLastFinanced>False</TradeInLastFinanced><NetTradeIn>0</NetTradeIn><TotalFinancedFees>0</TotalFinancedFees><LastFinanced>False</LastFinanced><TotalInterestCost>0</TotalInterestCost><Program>Dealer Purchase</Program><HMDAEligibleProgram>False</HMDAEligibleProgram><TotalPriceAdjustments>0</TotalPriceAdjustments><Closing><FirstPaymentDate><Date><Year>2014</Year><Month>06</Month><Day>02</Day></Date></FirstPaymentDate></Closing><FinancedFees><FinancedFee Type="35"><Amount>0</Amount><FeesDesc>GAP Fee</FeesDesc><FinPoc>Y</FinPoc><Include>True</Include><LenderAmt>0</LenderAmt><BorrowerAmt>0</BorrowerAmt><OtherAmt>0</OtherAmt><PPFC>False</PPFC><FlatFee>False</FlatFee><PaidBy>B</PaidBy><AmtFinFlg>False</AmtFinFlg><ReqAmtFlg>True</ReqAmtFlg></FinancedFee><FinancedFee Type="36"><Amount>0</Amount><FeesDesc>Misc</FeesDesc><FinPoc>Y</FinPoc><Include>True</Include><LenderAmt>0</LenderAmt><BorrowerAmt>0</BorrowerAmt><OtherAmt>0</OtherAmt><PPFC>False</PPFC><FlatFee>False</FlatFee><PaidBy>B</PaidBy><AmtFinFlg>False</AmtFinFlg><ReqAmtFlg>True</ReqAmtFlg></FinancedFee><FinancedFee Type="53"><Amount>0</Amount><FeesDesc>Service Contract</FeesDesc><FinPoc>Y</FinPoc><Include>True</Include><LenderAmt>0</LenderAmt><BorrowerAmt>0</BorrowerAmt><OtherAmt>0</OtherAmt><PPFC>False</PPFC><FlatFee>False</FlatFee><PaidBy>B</PaidBy><AmtFinFlg>False</AmtFinFlg><ReqAmtFlg>True</ReqAmtFlg></FinancedFee><FinancedFee Type="54"><Amount>0</Amount><FeesDesc>Doc Fee</FeesDesc><FinPoc>Y</FinPoc><Include>True</Include><LenderAmt>0</LenderAmt><BorrowerAmt>0</BorrowerAmt><OtherAmt>0</OtherAmt><PPFC>False</PPFC><FlatFee>False</FlatFee><PaidBy>B</PaidBy><AmtFinFlg>False</AmtFinFlg><ReqAmtFlg>True</ReqAmtFlg></FinancedFee><FinancedFee Type="55"><Amount>0</Amount><FeesDesc>Title Fee</FeesDesc><FinPoc>Y</FinPoc><Include>True</Include><LenderAmt>0</LenderAmt><BorrowerAmt>0</BorrowerAmt><OtherAmt>0</OtherAmt><PPFC>False</PPFC><FlatFee>False</FlatFee><PaidBy>B</PaidBy><AmtFinFlg>False</AmtFinFlg><ReqAmtFlg>True</ReqAmtFlg></FinancedFee><FinancedFee Type="84"><Amount>0</Amount><FeesDesc>Dealer Participation</FeesDesc><FinPoc>Y</FinPoc><Include>True</Include><LenderAmt>0</LenderAmt><BorrowerAmt>0</BorrowerAmt><OtherAmt>0</OtherAmt><PPFC>False</PPFC><FlatFee>False</FlatFee><PaidBy>O</PaidBy><AmtFinFlg>False</AmtFinFlg><ReqAmtFlg>True</ReqAmtFlg></FinancedFee><FinancedFee Type="99"><Amount>0</Amount><FeesDesc>Prior Loan Payoff</FeesDesc><FinPoc>Y</FinPoc><Include>True</Include><LenderAmt>0</LenderAmt><BorrowerAmt>0</BorrowerAmt><OtherAmt>0</OtherAmt><PPFC>False</PPFC><FlatFee>False</FlatFee><PaidBy>B</PaidBy><AmtFinFlg>False</AmtFinFlg><ReqAmtFlg>True</ReqAmtFlg></FinancedFee><FinancedFee Type="158"><Amount>0</Amount><FeesDesc>State Tax Stamp</FeesDesc><FinPoc>Y</FinPoc><Include>True</Include><LenderAmt>0</LenderAmt><BorrowerAmt>0</BorrowerAmt><OtherAmt>0</OtherAmt><PPFC>False</PPFC><FlatFee>False</FlatFee><PaidBy>B</PaidBy><AmtFinFlg>False</AmtFinFlg><ReqAmtFlg>True</ReqAmtFlg></FinancedFee><FinancedFeeSum><TotalLenderFee>0</TotalLenderFee><TotalBorrowerFee>0</TotalBorrowerFee><TotalOtherFee>0</TotalOtherFee><TotalFinancedFee>0</TotalFinancedFee><TotalNonFinancedFee>0</TotalNonFinancedFee><TotalPPFCFee>0</TotalPPFCFee><TotalNonPPFCFee>0</TotalNonPPFCFee><TotalPOCFee>0</TotalPOCFee><TotalFee>0</TotalFee><TotalIncAmtFee>0</TotalIncAmtFee><TotalDealerFee>0</TotalDealerFee><LessNonFinPPFC>0</LessNonFinPPFC></FinancedFeeSum></FinancedFees></Finance><ContractFinance><FinancedFees><FinancedFee Type="35"><Amount>0</Amount><FeesDesc>GAP Fee</FeesDesc><FinPoc>Y</FinPoc><Include>True</Include><LenderAmt>0</LenderAmt><BorrowerAmt>0</BorrowerAmt><OtherAmt>0</OtherAmt><PPFC>False</PPFC><FlatFee>False</FlatFee><PaidBy>B</PaidBy><AmtFinFlg>False</AmtFinFlg><ReqAmtFlg>True</ReqAmtFlg></FinancedFee><FinancedFee Type="36"><Amount>0</Amount><FeesDesc>Misc</FeesDesc><FinPoc>Y</FinPoc><Include>True</Include><LenderAmt>0</LenderAmt><BorrowerAmt>0</BorrowerAmt><OtherAmt>0</OtherAmt><PPFC>False</PPFC><FlatFee>False</FlatFee><PaidBy>B</PaidBy><AmtFinFlg>False</AmtFinFlg><ReqAmtFlg>True</ReqAmtFlg></FinancedFee><FinancedFee Type="53"><Amount>0</Amount><FeesDesc>Service Contract</FeesDesc><FinPoc>Y</FinPoc><Include>True</Include><LenderAmt>0</LenderAmt><BorrowerAmt>0</BorrowerAmt><OtherAmt>0</OtherAmt><PPFC>False</PPFC><FlatFee>False</FlatFee><PaidBy>B</PaidBy><AmtFinFlg>False</AmtFinFlg><ReqAmtFlg>True</ReqAmtFlg></FinancedFee><FinancedFee Type="54"><Amount>0</Amount><FeesDesc>Doc Fee</FeesDesc><FinPoc>Y</FinPoc><Include>True</Include><LenderAmt>0</LenderAmt><BorrowerAmt>0</BorrowerAmt><OtherAmt>0</OtherAmt><PPFC>False</PPFC><FlatFee>False</FlatFee><PaidBy>B</PaidBy><AmtFinFlg>False</AmtFinFlg><ReqAmtFlg>True</ReqAmtFlg></FinancedFee><FinancedFee Type="55"><Amount>0</Amount><FeesDesc>Title Fee</FeesDesc><FinPoc>Y</FinPoc><Include>True</Include><LenderAmt>0</LenderAmt><BorrowerAmt>0</BorrowerAmt><OtherAmt>0</OtherAmt><PPFC>False</PPFC><FlatFee>False</FlatFee><PaidBy>B</PaidBy><AmtFinFlg>False</AmtFinFlg><ReqAmtFlg>True</ReqAmtFlg></FinancedFee><FinancedFee Type="84"><Amount>0</Amount><FeesDesc>Dealer Participation</FeesDesc><FinPoc>Y</FinPoc><Include>True</Include><LenderAmt>0</LenderAmt><BorrowerAmt>0</BorrowerAmt><OtherAmt>0</OtherAmt><PPFC>False</PPFC><FlatFee>False</FlatFee><PaidBy>O</PaidBy><AmtFinFlg>False</AmtFinFlg><ReqAmtFlg>True</ReqAmtFlg></FinancedFee><FinancedFee Type="99"><Amount>0</Amount><FeesDesc>Prior Loan Payoff</FeesDesc><FinPoc>Y</FinPoc><Include>True</Include><LenderAmt>0</LenderAmt><BorrowerAmt>0</BorrowerAmt><OtherAmt>0</OtherAmt><PPFC>False</PPFC><FlatFee>False</FlatFee><PaidBy>B</PaidBy><AmtFinFlg>False</AmtFinFlg><ReqAmtFlg>True</ReqAmtFlg></FinancedFee><FinancedFee Type="158"><Amount>0</Amount><FeesDesc>State Tax Stamp</FeesDesc><FinPoc>Y</FinPoc><Include>True</Include><LenderAmt>0</LenderAmt><BorrowerAmt>0</BorrowerAmt><OtherAmt>0</OtherAmt><PPFC>False</PPFC><FlatFee>False</FlatFee><PaidBy>B</PaidBy><AmtFinFlg>False</AmtFinFlg><ReqAmtFlg>True</ReqAmtFlg></FinancedFee><FinancedFeeSum><TotalLenderFee>0</TotalLenderFee><TotalBorrowerFee>0</TotalBorrowerFee><TotalOtherFee>0</TotalOtherFee><TotalFinancedFee>0</TotalFinancedFee><TotalNonFinancedFee>0</TotalNonFinancedFee><TotalPPFCFee>0</TotalPPFCFee><TotalNonPPFCFee>0</TotalNonPPFCFee><TotalPOCFee>0</TotalPOCFee><TotalFee>0</TotalFee><TotalIncAmtFee>0</TotalIncAmtFee><TotalDealerFee>0</TotalDealerFee><LessNonFinPPFC>0</LessNonFinPPFC></FinancedFeeSum></FinancedFees><Disclosure><Rate>11.3</Rate><Term>72</Term><AmountFinanced>15200</AmountFinanced><FinanceCharge>5898.16</FinanceCharge><TotalOfPayments>21098.16</TotalOfPayments><TotalDownPayment>0</TotalDownPayment><TotalSalesPrice>21098.16</TotalSalesPrice><RepaymentMethod>Installment</RepaymentMethod><IndexType>0</IndexType><IndexRate>0</IndexRate><Margin>0</Margin></Disclosure><Itemizations><SalesTax>0</SalesTax><CashPrice>0</CashPrice><NetTradeIn>0</NetTradeIn><TotalDown>0</TotalDown><DealerIncentive>0</DealerIncentive><OtherAmount>0</OtherAmount><DiscountAmount>0</DiscountAmount><DeferredDownPayment>0</DeferredDownPayment><ADandD>0</ADandD><OtherPublicFee>0</OtherPublicFee><OtherInsuranceFee>0</OtherInsuranceFee><Proceeds>0</Proceeds><ProceedsAdjustment>0</ProceedsAdjustment><TotalFundingProceeds>0</TotalFundingProceeds></Itemizations><ContractAmount>15200</ContractAmount><RepaymentMethod>Installment</RepaymentMethod><FirstPaymentDate><Date><Year>2014</Year><Month>06</Month><Day>02</Day></Date></FirstPaymentDate><LineOfCredit>15200</LineOfCredit><ItemizationsLenderGap>0</ItemizationsLenderGap><PrepaymentPenalty /><OverdraftProtection /><AutoPayFlag /></ContractFinance><Applicant><Personal><Individuals><Individual Duplicate="" Entity="A1" Fraud="False" Type="Applicant"><AnalystApproved><Rate>11.3</Rate><Term>72</Term><Amount>15200</Amount><Payment>293.03</Payment><AnalystName>Tereance Dennis</AnalystName><AnalystGrade>F1</AnalystGrade><PreApproveFlg>0</PreApproveFlg><AnalystUserID>TDENNIS</AnalystUserID><BureauScore>678</BureauScore></AnalystApproved><LatestDecision><BureauScore>678</BureauScore><OfficerNumber>C</OfficerNumber></LatestDecision><GivenName><FirstName>BRODERICK</FirstName><LastName>TOWNS</LastName></GivenName><SSN>418926601</SSN><DateOfBirth><Date><Year>1958</Year><Month>10</Month><Day>21</Day></Date></DateOfBirth><Military /><RemoteRefNumber>1351848</RemoteRefNumber><Credit><AddedDebt>600</AddedDebt></Credit><ContactInfo><Phone><AreaCode>256</AreaCode><Exchange>329</Exchange><LastPart>8639</LastPart></Phone><Mobile><AreaCode>000</AreaCode><Exchange>000</Exchange><LastPart>0000</LastPart></Mobile><Address Type="Current"><StreetName>15th Place</StreetName><City>ALEXANDER CITY</City><State>AL</State><Zip>35010</Zip><TimeAtLocation><Year>12</Year><Month>0</Month></TimeAtLocation><StreetNumber>2052</StreetNumber></Address></ContactInfo><Age>55</Age><OptOut /><AutoDecExpt /><CurCustomer /><Signer>True</Signer><Rego>False</Rego><TotalAdjustedIncomeNum>2100</TotalAdjustedIncomeNum><Resident Type="Homeowner"><Payment>500</Payment></Resident><Employment CurrentEmployer="True" Status="Other"><Employer><EmployerName>Social Security</EmployerName><ContactInfo><Phone><AreaCode>000</AreaCode><Exchange>000</Exchange><LastPart>0000</LastPart></Phone></ContactInfo></Employer><Years>0</Years><Months>6</Months><Income Basis="Monthly" Gross="True">1600</Income><GrossMonthlyIncome>1600</GrossMonthlyIncome><SecondCurrentEmployerFlg>False</SecondCurrentEmployerFlg></Employment><Employment CurrentEmployer="False" Status="Other"><Employer><EmployerName>Frontier Yards</EmployerName><ContactInfo><Phone><AreaCode>000</AreaCode><Exchange>000</Exchange><LastPart>0000</LastPart></Phone></ContactInfo></Employer><Years>7</Years><Months>0</Months><Income Gross="" /><SecondCurrentEmployerFlg>False</SecondCurrentEmployerFlg></Employment><Employment CurrentEmployer="True"><Income Basis="Annual" Gross="True">0</Income><GrossMonthlyIncome>0</GrossMonthlyIncome><SecondCurrentEmployerFlg>True</SecondCurrentEmployerFlg></Employment><OtherIncomes><OtherIncome Basis="Monthly" Gross="True"><Source>0.00</Source><Income>500</Income><MonthlyIncome>0</MonthlyIncome></OtherIncome><OtherIncome Basis="Monthly" Gross="True"><Source>Unknown</Source><Income>0</Income></OtherIncome></OtherIncomes><BureauScores><BureauScore><Bureau>XPN</Bureau><ScoreNum>678</ScoreNum><ScoreModel>V</ScoreModel></BureauScore><BureauScore><Bureau>XPN</Bureau><ScoreNum>650</ScoreNum><ScoreModel>AG</ScoreModel></BureauScore></BureauScores><ScoreCards><ApplicationScoreCard><Score>482</Score><ScoreGrade>F1</ScoreGrade></ApplicationScoreCard></ScoreCards></Individual></Individuals></Personal></Applicant><ContractRequest><Documents /></ContractRequest><ContractCollateral Type="Auto" /><ContractSchedules><Schedule><Order>1</Order><NumberOfPayments>72</NumberOfPayments><PaymentAmount>293.03</PaymentAmount><FirstPaymentDue><Date><Year>2014</Year><Month>06</Month><Day>02</Day></Date></FirstPaymentDue><Frequency>Monthly</Frequency></Schedule></ContractSchedules><Originator OID="93945"><Contact>TODD</Contact><Phone><AreaCode>800</AreaCode><Exchange>900</Exchange><LastPart>5150</LastPart></Phone><Priority>True</Priority><OriginatorCode>40511</OriginatorCode><ACH_DFI_ID>11100002</ACH_DFI_ID><Prenotification>1</Prenotification><BuyingCenter>Western</BuyingCenter><PreApproved /><Territory>Direct Lending</Territory><DealerType>Direct - Partner</DealerType><DealerName>USAA - PHONE</DealerName><SalesRepresentative>400001</SalesRepresentative><FundingMethod>Company Check</FundingMethod><AffiliateID>40511</AffiliateID><SalesRepFirstName>Direct</SalesRepFirstName><SalesRepLastName>Lending</SalesRepLastName><BuyingCenterID>1</BuyingCenterID><Eval_Prenotification>0</Eval_Prenotification><Evaluator_Name>CarFinance Capital</Evaluator_Name><Addresses><Address Type="Current"><AddressLine1>7525 irvine center dr</AddressLine1><City>irvine</City><State>CA</State><Zip>92618</Zip></Address><Address Type="Billing"><AddressLine1>7525 irvine center dr</AddressLine1><City>irvine</City><State>CA</State><Zip>92618</Zip></Address><Address Type="Funding"><AddressLine1>7525 irvine center dr</AddressLine1><City>irvine</City><State>CA</State><Zip>92618</Zip></Address><CommunicationType Type="Fax" /><CommunicationType Type="Fax" /><CommunicationType Type="Fax" /><CommunicationType Type="Fax" /><CommunicationType Type="Fax" /><CommunicationType Type="Fax" /></Addresses><MiscItems><MiscItem ID="1" /><MiscItem ID="2" /><MiscItem ID="3" /><MiscItem ID="4" /><MiscItem ID="5" /></MiscItems></Originator></LoanAppRq></LoanAppSvcRq></CreditSvcRq></IFX>'; Dom.Document xmlDoc = new Dom.Document(); xmlDoc.load(xmlStr); IFXLoadXML.IFXLoanAppRq ifxObj = new IFXLoadXML.IFXLoanAppRq(xmlDoc.getRootElement()); System.assertNotEquals(null, xmlDoc);What must be done to test that both the xmlDoc is not null and that the XMLNodes are not null either?
- Sid Childers
- August 27, 2014
- Like
- 0
Error Initial Term of Field Expression must be a concrete SObject.List<StaticResource>
I've written the following in a test class attempting to achieve adequate code coverage by parsing XML nodes into various field values. I want to reference the static resource XML file in test classes instead of entering the actual XML and assigning it to a XMLStr. However, I am receiving the error stated above.
What must be fixed in order for the Static Resource to be loaded into the test class, XML nodes evaluated etc.?
List<StaticResource> ifx; ifx = [Select Body from StaticResource where Name = '{Direct8_8_Decision}' LIMIT 1]; string XMLStr = ifx.body.ToString(); Dom.Document xmlDoc = new Dom.Document(); xmlDoc.load(xmlStr); IFXLoadXML.IFXMain ifxObj = new IFXLoadXML.IFXMain(xmlDoc.getRootElement()); System.assertNotEquals(null, xmlDoc);
What must be fixed in order for the Static Resource to be loaded into the test class, XML nodes evaluated etc.?
- Sid Childers
- August 27, 2014
- Like
- 0
Achieving Optimal Code Coverage for APEX Class Calling out to RestRequest
Hi,
I'm attempting to attain optimal code coverage on an APEX class which is used to call a RESTful web service, retrieves an XML document, parses it and stores the values from he XML nodes into our various Account, Opportunity and other objects.
Currently, code coverage is at 0% because the test class is still in development. I understand that I can't test the HTTPRequest invocation. However, I am in need of guidance as to best strategy to accomplish optimal code coverage. Should I simply focus on the proper assignment of XML node values to corresponding fields in the Account object? Thanks much for your hlp and guidance.
I'm attempting to attain optimal code coverage on an APEX class which is used to call a RESTful web service, retrieves an XML document, parses it and stores the values from he XML nodes into our various Account, Opportunity and other objects.
Currently, code coverage is at 0% because the test class is still in development. I understand that I can't test the HTTPRequest invocation. However, I am in need of guidance as to best strategy to accomplish optimal code coverage. Should I simply focus on the proper assignment of XML node values to corresponding fields in the Account object? Thanks much for your hlp and guidance.
- Sid Childers
- August 21, 2014
- Like
- 0