Untitled
unknown
plain_text
4 years ago
30 kB
5
Indexable
@isTest
public with sharing class CEP_UTL_EbdmCalloutTst {
@TestSetup
static void setup(){
wrts_prcgvr.InstallIntegration.install();
insert TestDataCustomer.createPhaseManagerSettingIntegrationCase();
insert TestDataCustomer.createPhaseManagerSettingOpportunity();
insert TestDataCustomer.createPhaseManagerSettingFileMetadata();
//Account acc = TestDataCustomer.account().businessAccount().build();
List<Account> listAccount = new list<Account>();
Account acc = TestDataCustomer.account().physicalPersonAccount().build();
listAccount.add(acc);
Account endResellerAcc = TestDataCustomer.account().build();
endResellerAcc.Type = 'Persona Fisica';
endResellerAcc.Name = 'Finale Reseller';
endResellerAcc.Segment__c = 'Reseller';
endResellerAcc.FiscalCode__c = '12yyyyyaa';
endResellerAcc.RecordTypeId = Schema.SObjectType.Account.getRecordTypeInfosByDeveloperName().get('CEP_RT_ResellerEndCustomer').getRecordTypeId();
listAccount.add(endResellerAcc);
insert listAccount;
Contact cnt = TestDataCustomer.contact().createContact().setAccount(acc.Id).build();
cnt.MobilePhone = '+13344234';
insert cnt;
Pricebook2 standardPricebook = new Pricebook2(
Id = Test.getStandardPricebookId()
);
Product2 pIdPrezzo = new Product2();
pIdPrezzo.Name = 'IdPrezzo';
pIdPrezzo.VisibilityGroup__c = 'Mass Market - Small Business';
pIdPrezzo.IsActive = true;
pIdPrezzo.MarketSegment__c = 'Mass Market';
pIdPrezzo.Commodity__c = 'Elettrico';
pIdPrezzo.SAPCode__c = 'P_CO2';
pIdPrezzo.SBQQ__Component__c = false;
pIdPrezzo.RecordTypeId = Schema.SObjectType.Product2.getRecordTypeInfosByDeveloperName().get('CEP_RT_IdPrezzo').getRecordTypeId();
insert pIdPrezzo;
List<Opportunity> opps = new List<Opportunity>();
Opportunity opty = TestDataCustomer.opportunity().createOpportunity().build();
opty.CloseDate = Date.Today();
opty.Name = 'Test';
opty.StageName = 'Bozza';
opty.Commodity__c = 'Gas';
opty.RequestType__c = 'A Listino';
opty.RecordTypeId = Schema.SObjectType.Opportunity.getRecordTypeInfosByDeveloperName().get('CEP_RT_MassMarket').getRecordTypeId();
//opty.RecordTypeId = Schema.SObjectType.Opportunity.getRecordTypeInfosByDeveloperName().get('CEP_RT_Small_Business').getRecordTypeId();
opps.add(opty);
Opportunity optyBusiness = TestDataCustomer.opportunity().createOpportunity().build();
optyBusiness.Name = 'Test';
optyBusiness.Segment__c = 'Small Business';
optyBusiness.StageName = 'Bozza';
optyBusiness.Commodity__c = 'Gas';
optyBusiness.RequestType__c = 'A Listino';
optyBusiness.RecordTypeId = Schema.SObjectType.Opportunity.getRecordTypeInfosByDeveloperName().get('CEP_RT_Small_Business').getRecordTypeId();
opps.add(optyBusiness);
insert opps;
DirectRemi__c catalogRemiDirette = TestDataCustomer.directRemi().createDirectRemi().build();
insert catalogRemiDirette;
Remi__c remiDirette = TestDataCustomer.remi().createRemi().setRemiDirette(catalogRemiDirette.id).build();
remiDirette.Opportunity__c = optyBusiness.Id;
insert remiDirette;
List<OpportunityServiceItem__c> osiToInsert = new List<OpportunityServiceItem__c>();
OpportunityServiceItem__c osi = new OpportunityServiceItem__c();
osi.Opportunity__c = opty.Id;
osi.Account__c = acc.Id;
osi.PointReferrerPhone__c = '321567890';
osi.ContractType__c = 'Persona fisica';
osiToInsert.add(osi);
OpportunityServiceItem__c osi2 = new OpportunityServiceItem__c();
osi2.Opportunity__c = optyBusiness.Id;
osi2.Account__c = acc.Id;
osi2.PointReferrerPhone__c = '321567890';
osi2.ContractType__c = 'Persona fisica';
osiToInsert.add(osi2);
insert osiToInsert;
SBQQ__Quote__c q = new SBQQ__Quote__c();
q.MarketSegment__c = 'Mass Market';
q.SBQQ__Opportunity2__c = opty.Id;
q.SBQQ__PricebookId__c = standardPricebook.Id;
insert q;
List<SBQQ__QuoteLine__c> qlList = new List<SBQQ__QuoteLine__c>();
qlList.add(new SBQQ__QuoteLine__c(SBQQ__Quote__c = q.Id, SBQQ__Number__c = 1, OpportunityServiceItem__c = osi.Id, SBQQ__Product__c = pIdPrezzo.Id));
insert qlList;
Log__c logSetup = new Log__c();
logSetup.RetryAttempts__c = 1;
insert logSetup;
Case myCaseOrigin = TestDataFactory.caseRecordBuilder().newCase().build();
myCaseOrigin.Subject = 'Attivazione';
insert myCaseOrigin;
Case myCase = TestDataFactory.caseRecordBuilder().newCase().build();
myCase.Subject = 'Attivazione';
myCase.OpportunityServiceItem__c = osi.Id;
myCase.ParentId = myCaseOrigin.Id;
insert myCase;
ServicePoint__c mySP = new ServicePoint__c();
//mySP.RecordTypeId = '0121j000000DDgfAAG';
mySP.Key__c = 'TestIntCase';
insert mySP;
List<IntegrationCase__c> intCases = new List<IntegrationCase__c>();
IntegrationCase__c ic = TestDataCustomer.integrationCase().createIntegrationCase(myCase.Id, acc.Id).build();
ic.RecordTypeId = Schema.SObjectType.IntegrationCase__c.getRecordTypeInfosByDeveloperName().get('CEP_RT_Cancellation').getRecordTypeId();
ic.ServicePoint__c = mySP.Id;
ic.Opportunity__c = opty.Id;
ic.Account__c = acc.Id;
ic.Case__c = myCase.Id;
ic.Flow__c='0050';
ic.EbdmService__c = 'A40 - ATTIVAZIONE SOGGETTA ALLA DELIBERA 40/14';
intCases.add(ic);
IntegrationCase__c ic2 = TestDataCustomer.integrationCase().createIntegrationCase(myCase.Id, acc.Id).build();
ic2.RecordTypeId = Schema.SObjectType.IntegrationCase__c.getRecordTypeInfosByDeveloperName().get('CEP_RT_Cancellation').getRecordTypeId();
ic2.Opportunity__c = optyBusiness.Id;
ic2.Account__c = endResellerAcc.Id;
ic2.OpportunityServiceItem__c = osi2.Id;
ic2.Flow__c='0050';
ic2.EbdmService__c = 'A40 - ATTIVAZIONE SOGGETTA ALLA DELIBERA 40/14';
intCases.add(ic2);
insert intCases;
EbdmConfigurator__c ebdmConf = new EbdmConfigurator__c();
ebdmConf.Process__c = ic.EbdmService__c;
ebdmConf.Commodity__c = ic.Commodity__c ;
ebdmConf.Flow__c = ic.Flow__c;
ebdmConf.Active__c = true;
ebdmConf.RequestFieldName__c= 'TYPE';
ebdmConf.RequestFieldValue__c='Account__r.RecordType.DeveloperName';
ebdmConf.Description__c = 'Tipo persona; organizzazione e gruppo: 1 - persona fisica; 2 - organizzazione (persona giuridica).';
ebdmConf.Function__c='dictionary|CEP_RT_PhysicalPerson=Persona Fisica&CEP_RT_Organization=Organizzazione&CEP_RT_Reseller=Organizzazione&Business=Organizzazione&CEP_RT_ResellerEndCustomer=Cliente Finale Reseller ';
insert ebdmConf;
AtecoTranscode__c ateco = new AtecoTranscode__c();
ateco.AtecoDescriptionClient__c = '65.12';
ateco.Code__c = '65';
insert ateco ;
}
@isTest
static void invokeEbdmAsyncBulk(){
List<IntegrationCase__c> icList = [SELECT Id, RecordType.DeveloperName, Process__c, Commodity__c, Flow__c, EBDMService__c FROM IntegrationCase__c LIMIT 5];
System.debug('>>>>icList: ' + icList);
List<Id> integrationCases = new List<Id>();
Set<String> setOfProcess = new Set<String>();
Set<String> setOfCommodity = new Set<String>();
Set<String> setOfFlow = new Set<String>();
for( IntegrationCase__c i : icList ){
integrationCases.add( i.Id );
setOfProcess.add( i.EBDMService__c );
setOfCommodity.add( i.EBDMService__c.contains( 'AE1' ) ? 'Electric' : 'Gas');
setOfFlow.add( i.Flow__c );
}
List<EbdmConfigurator__c> ebdmList = [SELECT Active__c, Commodity__c, Flow__c, Process__c, RequestFieldName__c, RequestFieldValue__c, Function__c, StaticValue__c, Mandatory__c, Description__c, ExternalCode__c, Direction__c FROM ebdmconfigurator__c LIMIT 5];
System.debug('>>>>ebdmList: ' + ebdmList);
Test.startTest();
CEP_UTL_EbdmCallout.invokeEbdmAsyncBulk(integrationCases, setOfProcess, setOfCommodity, setOfFlow);
CEP_UTL_EbdmCallout objTest = new CEP_UTL_EbdmCallout();
objTest.invokeEbdmAsyncBulk(icList, ebdmList);
Test.stopTest();
}
@isTest
static void invokeEbdmAsyncTst(){
IntegrationCase__c ic = [SELECT Id ,Process__c,Commodity__c,RecordTypeId,Opportunity__r.RequestType__c,RecordType.DeveloperName,Opportunity__r.RecordTypeDeveloperName__c
FROM IntegrationCase__c LIMIT 1];
Log__c logTest = [SELECT Id FROM Log__c LIMIT 1];
CEP_UTL_EbdmCallout ebdmCallout = new CEP_UTL_EbdmCallout();
Test.startTest();
ebdmCallout.invokeEbdmAsync(ic.Id, logTest);
Test.stopTest();
}
@isTest
static void invokeRetryTst(){
IntegrationCase__c ic = [SELECT Id
FROM IntegrationCase__c
LIMIT 1];
Log__c logTest = [SELECT Id FROM Log__c LIMIT 1];
logTest.RecordId__c = ic.id;
CEP_UTL_EbdmCallout ebdmCallout = new CEP_UTL_EbdmCallout();
Test.startTest();
ebdmCallout.retry( logTest);
Test.stopTest();
}
@isTest
static void invokerCheckFieldsTst(){
IntegrationCase__c ic = [SELECT Id
FROM IntegrationCase__c
LIMIT 1];
CEP_UTL_EbdmCallout ebdmCallout = new CEP_UTL_EbdmCallout();
Test.startTest();
ebdmCallout.checkFields(ic.Id);
Test.stopTest();
}
@isTest
static void invokerReachedMaxAttemptsTst(){
Log__c logTest = [SELECT Id FROM Log__c LIMIT 1];
CEP_UTL_EbdmCallout ebdmCallout = new CEP_UTL_EbdmCallout();
Test.startTest();
ebdmCallout.reachedMaxAttempts( logTest);
Test.stopTest();
}
@isTest
static void invokeEbdmSyncTst(){
IntegrationCase__c ic = [SELECT Id ,RecordTypeId
FROM IntegrationCase__c
LIMIT 1];
Log__c logTest = [SELECT Id FROM Log__c LIMIT 1];
Map<String, String> richiestaDistributoreRemiHeader = new Map<String, String>{
'PIATTA_SORG' => 'SF',
'PIATTA_DEST' => 'EBDM',
'DATA_RICH' => String.valueOf(DateTime.now()),
'DATA_PUBBL' => String.valueOf(DateTime.now()),
'COD_SERVIZIO' => 'ISU30',
'COD_FLUSSO' => '0050'
};
Map<String, String> richiestaDistributoreRemiPosizione = new Map<String, String>{
'COMMODITY' => 'GAS',
'ISTAT_FOR' => '058091'
};
Test.startTest();
CEP_UTL_EbdmCallout ebdmCallout = new CEP_UTL_EbdmCallout();
ebdmCallout.invokeEbdmSync(richiestaDistributoreRemiHeader, richiestaDistributoreRemiPosizione);
Test.stopTest();
}
@isTest
static void invokeSObjectDisctionaryTst(){
IntegrationCase__c ic = [SELECT Id , Account__c,Account__r.RecordTypeId, Account__r.RecordType.DeveloperName
FROM IntegrationCase__c
LIMIT 1];
EbdmConfigurator__c ebdmConf = [ SELECT RequestFieldName__c, RequestFieldValue__c, Description__c, StaticValue__c, Function__c, Mandatory__c
FROM EbdmConfigurator__c
LIMIT 1];
Test.startTest();
CEP_UTL_EbdmCallout ebdmCallout = new CEP_UTL_EbdmCallout();
ebdmCallout.sObjectValue(ebdmConf.RequestFieldValue__c,ic,ebdmConf.Function__c, false);
Test.stopTest();
}
@isTest
static void invokepivaResTst(){
IntegrationCase__c ic = [SELECT Id , Account__c,Account__r.RecordTypeId, Account__r.RecordType.DeveloperName
FROM IntegrationCase__c
LIMIT 1];
Test.startTest();
CEP_UTL_EbdmCallout ebdmCallout = new CEP_UTL_EbdmCallout();
ebdmCallout.pivaRes(ic);
Test.stopTest();
}
@isTest
static void invokegetAtecoTst(){
IntegrationCase__c ic = [SELECT Id , Account__c,Account__r.RecordTypeId, Account__r.RecordType.DeveloperName, Opportunity__r.RecordTypeDeveloperName__c,
OpportunityServiceItem__r.Usage__c, Account__r.RecordTypeDeveloperName__c, Account__r.FiscalCode__c, Account__r.VATNumber__c, Account__r.Type
FROM IntegrationCase__c
LIMIT 1];
Test.startTest();
CEP_UTL_EbdmCallout ebdmCallout = new CEP_UTL_EbdmCallout();
ebdmCallout.getAteco('84139',ic);
Test.stopTest();
}
@isTest
static void invokegetAtecoEmptyTst(){
Account acc = [SELECT Id FROM Account where RecordTypeDeveloperName__c = 'CEP_RT_ResellerEndCustomer' LIMIT 1];
IntegrationCase__c ic = [SELECT Id , Account__c FROM IntegrationCase__c
WHERE OPPortunity__r.RecordTypeDeveloperName__c != 'CEP_RT_MassMarket'
LIMIT 1];
ic.Account__c = acc.Id;
update ic;
ic = [SELECT Id , Account__c,Account__r.RecordTypeId, Account__r.RecordType.DeveloperName, Opportunity__r.RecordTypeDeveloperName__c,
OpportunityServiceItem__r.Usage__c, Account__r.RecordTypeDeveloperName__c, Account__r.FiscalCode__c, Account__r.VATNumber__c, Account__r.Type
FROM IntegrationCase__c
WHERE ID =: ic.Id];
Test.startTest();
CEP_UTL_EbdmCallout ebdmCallout = new CEP_UTL_EbdmCallout();
ebdmCallout.getAteco('84139',ic);
Test.stopTest();
}
@isTest
static void invokegetAtecoDescrTst(){
IntegrationCase__c ic = [SELECT Id , Account__c,Account__r.RecordTypeId, Account__r.RecordType.DeveloperName, Opportunity__r.RecordTypeDeveloperName__c,
OpportunityServiceItem__r.Usage__c, Account__r.RecordTypeDeveloperName__c, Account__r.FiscalCode__c, Account__r.VATNumber__c, Account__r.Type
FROM IntegrationCase__c
LIMIT 1];
Test.startTest();
CEP_UTL_EbdmCallout ebdmCallout = new CEP_UTL_EbdmCallout();
ebdmCallout.getAtecoDescr('',ic);
Test.stopTest();
}
@isTest
static void invokealternativeValueOrBlankTst(){
IntegrationCase__c ic = [SELECT Id , Account__c,Account__r.RecordTypeId, Account__r.RecordType.DeveloperName
FROM IntegrationCase__c
LIMIT 1];
Test.startTest();
CEP_UTL_EbdmCallout ebdmCallout = new CEP_UTL_EbdmCallout();
ebdmCallout.alternativeValueOrBlank('true' ,'Account__r.VATNumber__c',ic);
Test.stopTest();
}
@isTest
static void invokecompareTst(){
IntegrationCase__c ic = [SELECT Id , Account__c,Account__r.RecordTypeId, Account__r.RecordType.DeveloperName
FROM IntegrationCase__c
LIMIT 1];
CEP_UTL_EbdmCallout ebdmCallout = new CEP_UTL_EbdmCallout();
Test.startTest();
ebdmCallout.compare('10','greaterThan&1.1');
/*
ebdmCallout.compare('10','equal&1.1');
ebdmCallout.compare('10','lessThan&1.1');
ebdmCallout.compare('10','notEqual&1.1');*/
Test.stopTest();
}
@isTest
static void invokemanageLogTst(){
IntegrationCase__c ic = [SELECT Id , Account__c,Account__r.RecordTypeId, Account__r.RecordType.DeveloperName
FROM IntegrationCase__c
LIMIT 1];
Log__c logTest = [SELECT Id,RetryAttempts__c FROM Log__c LIMIT 1];
Test.startTest();
CEP_UTL_EbdmCallout ebdmCallout = new CEP_UTL_EbdmCallout();
ebdmCallout.manageLog(logTest, ic.Id, '','','','');
Test.stopTest();
}
@isTest
static void invokecreateIntegrationLogTst(){
IntegrationCase__c ic = [SELECT Id , Account__c,Account__r.RecordTypeId, Account__r.RecordType.DeveloperName
FROM IntegrationCase__c
LIMIT 1];
Log__c logTest = [SELECT Id FROM Log__c LIMIT 1];
Test.startTest();
CEP_UTL_EbdmCallout ebdmCallout = new CEP_UTL_EbdmCallout();
ebdmCallout.createIntegrationLog(ic.Id, '','','','');
Test.stopTest();
}
@isTest
static void invokecreateCustomLogTst(){
IntegrationCase__c ic = [SELECT Id , Account__c,Account__r.RecordTypeId, Account__r.RecordType.DeveloperName
FROM IntegrationCase__c
LIMIT 1];
Log__c logTest = [SELECT Id FROM Log__c LIMIT 1];
Test.startTest();
CEP_UTL_EbdmCallout ebdmCallout = new CEP_UTL_EbdmCallout();
ebdmCallout.createCustomLog('','',ic.Id);
Test.stopTest();
}
@isTest
static void invokeauthGroupForAccountTst(){
IntegrationCase__c ic = [SELECT Id , Account__c,Account__r.RecordTypeId, Account__r.RecordType.DeveloperName
FROM IntegrationCase__c
LIMIT 1];
EbdmConfigurator__c ebdmConf = [ SELECT Id,RequestFieldName__c, RequestFieldValue__c, Description__c, StaticValue__c, Function__c, Mandatory__c
FROM EbdmConfigurator__c
LIMIT 1];
ebdmConf.Function__c = 'authGroup|Back Office=RT14&Call Center Inbound=RT14&Call Center outbound=RT14&Chat=RT14&Sportello=RT14&Shop in Shop=RT14&Fatturazione=RT14&Credito=RT14&Reclami=RT14&Caring=RT14';
update ebdmConf;
Test.startTest();
CEP_UTL_EbdmCallout ebdmCallout = new CEP_UTL_EbdmCallout();
ebdmCallout.sObjectValue(null,ic,ebdmConf.Function__c, false);
Test.stopTest();
}
@isTest
static void invokeauthuserNumberExecTst(){
IntegrationCase__c ic = [SELECT Id , Account__c,Account__r.RecordTypeId, Account__r.RecordType.DeveloperName
FROM IntegrationCase__c
LIMIT 1];
Contact cnt = [SELECT Id FROM Contact];
AccountContactRelation acr = [SELECT Id, Roles FROM AccountContactRelation WHERE AccountId =: ic.Account__c AND ContactId =: cnt.Id];
acr.Roles = 'Customer';
Test.startTest();
Database.update(acr);
CEP_UTL_EbdmCallout ebdmCallout = new CEP_UTL_EbdmCallout();
ebdmCallout.userNumberExec(ic);
Test.stopTest();
}
@isTest
static void invokesetDefaultTst(){
Test.startTest();
CEP_UTL_EbdmCallout ebdmCallout = new CEP_UTL_EbdmCallout();
ebdmCallout.setDefault('','data');
Test.stopTest();
}
@isTest
static void invokeReplaceTst(){
Test.startTest();
CEP_UTL_EbdmCallout ebdmCallout = new CEP_UTL_EbdmCallout();
ebdmCallout.replace('AA','A=A&B=B');
Test.stopTest();
}
@isTest
static void invokevalueGreaterThanTst(){
CEP_UTL_EbdmCallout ebdmCallout = new CEP_UTL_EbdmCallout();
Test.startTest();
//ebdmCallout.valueGreaterThan('10','lessThan&decimal;125.2');
ebdmCallout.valueGreaterThan('10','int;125');
Test.stopTest();
}
@isTest
static void invokecodServizioTst(){
IntegrationCase__c ic = [SELECT Id , Account__c,Account__r.RecordTypeId, Account__r.RecordType.DeveloperName,Commodity__c
FROM IntegrationCase__c
LIMIT 1];
Test.startTest();
CEP_UTL_EbdmCallout ebdmCallout = new CEP_UTL_EbdmCallout();
ebdmCallout.codServizio('',ic);
Test.stopTest();
}
@isTest
static void invoketernaryTst(){
IntegrationCase__c ic = [SELECT Id , Account__c,Account__r.RecordTypeId, Account__r.RecordType.DeveloperName
FROM IntegrationCase__c
LIMIT 1];
Test.startTest();
CEP_UTL_EbdmCallout ebdmCallout = new CEP_UTL_EbdmCallout();
ebdmCallout.ternary('','A&B');
Test.stopTest();
}
@isTest
static void invokegetAlternativeFieldTst(){
IntegrationCase__c ic = [SELECT Id , Account__c,Account__r.RecordTypeId, Account__r.RecordType.DeveloperName
FROM IntegrationCase__c
LIMIT 1];
Test.startTest();
CEP_UTL_EbdmCallout ebdmCallout = new CEP_UTL_EbdmCallout();
ebdmCallout.getAlternativeField('C','A=B',ic);
Test.stopTest();
}
@isTest
static void invokecelNumberTst(){
IntegrationCase__c ic = [SELECT Id , Account__c,Account__r.RecordTypeId,
Account__r.RecordType.DeveloperName,
Case__c,OpportunityServiceItem__r.PointReferrerPhone__c
FROM IntegrationCase__c LIMIT 1];
Test.startTest();
CEP_UTL_EbdmCallout ebdmCallout = new CEP_UTL_EbdmCallout();
ebdmCallout.celNumber(ic);
Test.stopTest();
}
@isTest
static void invokecodFlussoTst(){
IntegrationCase__c ic = [SELECT Id , Account__c,Account__r.RecordTypeId, Account__r.RecordType.DeveloperName,RecordTypeId,RecordType.Name,Commodity__c,Case__c, Case__r.Subject
FROM IntegrationCase__c
LIMIT 1];
Test.startTest();
CEP_UTL_EbdmCallout ebdmCallout = new CEP_UTL_EbdmCallout();
ebdmCallout.codFlusso('',ic);
Test.stopTest();
}
@isTest
static void invokelessthenTst(){
IntegrationCase__c ic = [SELECT Id , Account__c,Account__r.RecordTypeId, Account__r.RecordType.DeveloperName
FROM IntegrationCase__c
LIMIT 1];
CEP_UTL_EbdmCallout ebdmCallout = new CEP_UTL_EbdmCallout();
Test.startTest();
ebdmCallout.valueLessThan('10','decimal;125.2');
Test.stopTest();
}
@isTest
static void invokeselectFieldTst(){
IntegrationCase__c ic = [SELECT Id , Account__c,Account__r.RecordTypeId, Account__r.RecordType.DeveloperName
FROM IntegrationCase__c
LIMIT 1];
Test.startTest();
CEP_UTL_EbdmCallout ebdmCallout = new CEP_UTL_EbdmCallout();
ebdmCallout.selectField('testC','Account__c',ic);
Test.stopTest();
}
@isTest
static void invokestaticTrascodeTst(){
IntegrationCase__c ic = [SELECT Id , Account__c,Account__r.RecordTypeId, Account__r.RecordType.DeveloperName
FROM IntegrationCase__c
LIMIT 1];
Test.startTest();
CEP_UTL_EbdmCallout ebdmCallout = new CEP_UTL_EbdmCallout();
ebdmCallout.staticTrascode('A','A&B&C');
Test.stopTest();
}
@isTest
static void invoketelNumberTst(){
IntegrationCase__c ic = [SELECT Id , Account__c,Account__r.RecordTypeId, Account__r.RecordType.DeveloperName,OpportunityServiceItem__r.PointReferrerPhone__c,Account__r.RecordType.Name
FROM IntegrationCase__c
LIMIT 1];
Test.startTest();
CEP_UTL_EbdmCallout ebdmCallout = new CEP_UTL_EbdmCallout();
ebdmCallout.telNumber(ic);
Test.stopTest();
}
@isTest
static void invokeatecoDescrTst(){
IntegrationCase__c ic = [SELECT Id , Account__c,Account__r.RecordTypeId, Account__r.RecordType.DeveloperName, Opportunity__r.RecordTypeDeveloperName__c,
OpportunityServiceItem__r.Usage__c, Account__r.RecordTypeDeveloperName__c, Account__r.FiscalCode__c, Account__r.VATNumber__c, Account__r.Type
FROM IntegrationCase__c
LIMIT 1];
Test.startTest();
CEP_UTL_EbdmCallout ebdmCallout = new CEP_UTL_EbdmCallout();
ebdmCallout.getAtecoDescr('',ic);
Test.stopTest();
}
@isTest
static void invokegetAtecoANCTst(){
IntegrationCase__c ic = [SELECT Id , Account__c,Account__r.RecordTypeId,
Account__r.RecordType.DeveloperName,Opportunity__r.Account.VATNumber__c,
Account__r.AtecoDescription__c
FROM IntegrationCase__c
LIMIT 1];
Test.startTest();
CEP_UTL_EbdmCallout ebdmCallout = new CEP_UTL_EbdmCallout();
ebdmCallout.getAtecoANC('',ic);
Test.stopTest();
}
@isTest
static void invokegetAtecoDescrANCTst(){
IntegrationCase__c ic = [SELECT Id , Account__c,Account__r.RecordTypeId,
Account__r.RecordType.DeveloperName,Opportunity__r.Account.VATNumber__c,Account__r.AtecoName__c
FROM IntegrationCase__c
LIMIT 1];
Test.startTest();
CEP_UTL_EbdmCallout ebdmCallout = new CEP_UTL_EbdmCallout();
ebdmCallout.getAtecoDescrANC('',ic);
Test.stopTest();
}
@isTest
static void invokeupperCaseTst(){
IntegrationCase__c ic = [SELECT Id , Account__c,Account__r.RecordTypeId, Account__r.RecordType.DeveloperName
FROM IntegrationCase__c
LIMIT 1];
Test.startTest();
CEP_UTL_EbdmCallout ebdmCallout = new CEP_UTL_EbdmCallout();
ebdmCallout.upperCase('TEST');
Test.stopTest();
}
@isTest
static void invokelessthen2Tst(){
IntegrationCase__c ic = [SELECT Id , Account__c,Account__r.RecordTypeId, Account__r.RecordType.DeveloperName
FROM IntegrationCase__c
LIMIT 1];
CEP_UTL_EbdmCallout ebdmCallout = new CEP_UTL_EbdmCallout();
Test.startTest();
ebdmCallout.valueLessThan('10','int;125');
Test.stopTest();
}
@isTest
static void invokevalueGreaterThan2Tst(){
CEP_UTL_EbdmCallout ebdmCallout = new CEP_UTL_EbdmCallout();
Test.startTest();
//ebdmCallout.valueGreaterThan('10','lessThan&decimal;125.2');
ebdmCallout.valueGreaterThan('10','decimal;125.1');
Test.stopTest();
}
@isTest
static void invokecompare2Tst(){
IntegrationCase__c ic = [SELECT Id , Account__c,Account__r.RecordTypeId, Account__r.RecordType.DeveloperName
FROM IntegrationCase__c
LIMIT 1];
CEP_UTL_EbdmCallout ebdmCallout = new CEP_UTL_EbdmCallout();
List<String >arraytest = new List<String>{'equal&10','notEqual&30','lessThan&20'};
Test.startTest();
for(String a: arraytest){
ebdmCallout.compare('40',a);
}
Test.stopTest();
}
@isTest
static void invokesetPIVATst(){
IntegrationCase__c ic = [SELECT Id , Account__c,Account__r.RecordTypeId, Case__c, Account__r.RecordType.DeveloperName,Case__r.OpportunityServiceItem__r.ContractType__c
FROM IntegrationCase__c
LIMIT 1];
CEP_UTL_EbdmCallout ebdmCallout = new CEP_UTL_EbdmCallout();
Test.startTest();
ebdmCallout.setPIVA('test',ic);
Test.stopTest();
}
@isTest
static void invokeidPrezzoSfdcTst(){
IntegrationCase__c ic = [SELECT Id , Account__c,Account__r.RecordTypeId, Account__r.RecordType.DeveloperName,Opportunity__c,OpportunityRecordType__c,Account__r.Segment__c,Opportunity__r.RequestType__c
FROM IntegrationCase__c
LIMIT 1];
CEP_UTL_EbdmCallout ebdmCallout = new CEP_UTL_EbdmCallout();
Test.startTest();
ebdmCallout.idPrezzoSfdc('test',ic);
Test.stopTest();
}
@isTest
static void invokegetIntegrationCaseTst(){
IntegrationCase__c ic = [SELECT Id , Account__c,Account__r.RecordTypeId, Account__r.RecordType.DeveloperName
FROM IntegrationCase__c
LIMIT 1];
EbdmConfigurator__c ebdmConf = [SELECT RequestFieldName__c, RequestFieldValue__c, Description__c, StaticValue__c, Function__c, Mandatory__c
FROM EbdmConfigurator__c
LIMIT 1];
List<EbdmConfigurator__c> listEbdm = new List<EbdmConfigurator__c>();
listEbdm.add(ebdmConf);
CEP_UTL_EbdmCallout ebdmCallout = new CEP_UTL_EbdmCallout();
Test.startTest();
ebdmCallout.getIntegrationCase(ic.Id,listEbdm);
Test.stopTest();
}
@isTest
static void invokeavaluateFunction2Tst(){
IntegrationCase__c ic = [SELECT Id , Account__c,Account__r.RecordTypeId, Account__r.RecordType.DeveloperName
FROM IntegrationCase__c
LIMIT 1];
CEP_UTL_EbdmCallout ebdmCallout = new CEP_UTL_EbdmCallout();
List<String >arraytest = new List<String>{'today','idtimestamp',
'tracodePotImpRich','getAtecoDescr',
'dictionaryBoolean','pivaRes','getAlternativeField|test',
'ternary|test','staticTrascode|test','replace|test',
'setDefault|test','alternativeValueOrBlank|test',
'getAtecoANC','getAtecoDescrANC','dictionaryOption|Dittta Individuale=-',
'dictionaryBoolean|false','pivaRes','contractAccountType','manageDataFineOfferta','signatureDateSegment', 'subServSe1Swg1','capacitaGiornalieraRemiDirette'};
Test.startTest();
for(String a: arraytest){
try {
ebdmCallout.evaluateFunction('test',a,ic);
} catch (Exception e) {
System.debug(e.getMessage());
}
}
Test.stopTest();
}
@isTest
static void isEmptyAtecoTst(){
IntegrationCase__c ic = [SELECT Account__r.RecordTypeDeveloperName__c, Opportunity__r.RecordTypeDeveloperName__c, OpportunityServiceItem__r.Usage__c,
Account__r.Type, Account__r.FiscalCode__c, Account__r.VATNumber__c
FROM IntegrationCase__c where Account__r.RecordTypeDeveloperName__c = 'CEP_RT_ResellerEndCustomer'
LIMIT 1];
CEP_UTL_EbdmCallout ebdmCallout = new CEP_UTL_EbdmCallout();
Test.startTest();
Boolean result = ebdmCallout.isEmptyAteco(ic);
System.assert(!result);
Test.stopTest();
}
@isTest
static void executeTst(){
IntegrationCase__c ic = [SELECT Id FROM IntegrationCase__c LIMIT 1];
Test.startTest();
CEP_UTL_EbdmCallout.InvokeEbdmQueueable objTst = new CEP_UTL_EbdmCallout.InvokeEbdmQueueable(ic.Id);
QueueableContext context;
objTst.execute(context);
Test.stopTest();
}
@isTest
static void getValueByControllingFieldTst(){
IntegrationCase__c ic = [SELECT Id, RecordType.DeveloperName,Opportunity__c, ServicePoint__c FROM IntegrationCase__c LIMIT 1];
Test.startTest();
CEP_UTL_EbdmCallout objTst = new CEP_UTL_EbdmCallout();
objTst.evaluateFunction('', 'getValueByControllingField|RecordType.DeveloperName=CEP_RT_Cancellation&field=Opportunity__c&field=ServicePoint__c', ic);
Test.stopTest();
}
@isTest
static void getValueByControllingFieldTst2(){
IntegrationCase__c ic = [SELECT Id, RecordType.DeveloperName,Opportunity__c, ServicePoint__c,Case__r.Status,Status__c FROM IntegrationCase__c LIMIT 1];
Test.startTest();
CEP_UTL_EbdmCallout objTst = new CEP_UTL_EbdmCallout();
objTst.evaluateFunction('', 'getValueByControllingField|RecordType.DeveloperName=CEP_RT_ActivationEle&field=Opportunity__c&field=Case__r.Status', ic);
Test.stopTest();
}
@isTest
static void getValueByControllingFieldTst3(){
IntegrationCase__c ic = [SELECT Id, RecordType.DeveloperName,Opportunity__c, ServicePoint__c,Case__r.Status,Status__c FROM IntegrationCase__c LIMIT 1];
Test.startTest();
CEP_UTL_EbdmCallout objTst = new CEP_UTL_EbdmCallout();
objTst.evaluateFunction('', 'getValueByControllingField|Status__c=Bozza&static=condizioneVera&static=condizioneFalsa', ic);
Test.stopTest();
}
@isTest
static void getValueByControllingFieldTst4(){
IntegrationCase__c ic = [SELECT Id, RecordType.DeveloperName,Opportunity__c, ServicePoint__c,Case__r.Status,Status__c FROM IntegrationCase__c LIMIT 1];
Test.startTest();
CEP_UTL_EbdmCallout objTst = new CEP_UTL_EbdmCallout();
objTst.evaluateFunction('', 'getValueByControllingField|Status__c=Da Inviare&static=condizioneVera&static=condizioneFalsa', ic);
Test.stopTest();
}
@isTest
static void getValueByControllingFieldTst5(){
IntegrationCase__c ic = [SELECT Id, RecordType.DeveloperName,Opportunity__c, ServicePoint__c,Opportunity__r.StageName FROM IntegrationCase__c LIMIT 1];
Test.startTest();
CEP_UTL_EbdmCallout objTst = new CEP_UTL_EbdmCallout();
objTst.evaluateFunction('', 'getValueByControllingField|RecordType.DeveloperName=CEP_RT_Cancellation&field=Opportunity__r.StageName&field=ServicePoint__c', ic);
Test.stopTest();
}
}Editor is loading...