@isTest private class RainbowConnectorTest { @testSetup static void setupData() { Account acc = new Account(Name = 'Test Account', Phone = '+33123456789', AccountNumber = '0000'); insert acc; Contact con = new Contact( FirstName = 'Test', LastName = 'Contact', Phone = '+33123456789', MobilePhone = '+33123456789', Email = 'test@example.com', AccountId = acc.Id ); insert con; Lead lead = new Lead( FirstName = 'Lead', LastName = 'Test', Company = 'Test Company', Phone = '+33123456789', MobilePhone = '+33123456789' ); insert lead; Case c = new Case( SuppliedName = 'Test Case', SuppliedPhone = '+33123456789', ContactPhone = '+33123456789', ContactEmail = 'test@example.com', Subject = 'Test Subject', ContactId = con.Id, AccountId = acc.Id ); insert c; Task t = new Task( WhatId = acc.Id, Subject = 'Test Task', Status = 'In Progress', CallObject = 'callidTest' ); insert t; } static testMethod void testGetUserEmail() { System.assertNotEquals('', RainbowConnector.getUserEmail()); } static testMethod void testGetMainURL() { Test.startTest(); System.assertNotEquals('', RainbowConnector.getMainURL()); Test.stopTest(); } static testMethod void testPhoneFormatters() { String phone = '+33123456789'; System.assertNotEquals('', RainbowConnector.formatPhoneNumber(phone)); System.assertNotEquals('', RainbowConnector.formatPhoneNumberwithoutspace(phone)); System.assertNotEquals('', RainbowConnector.formatPhoneNumberwithoutplus(phone)); System.assertNotEquals('', RainbowConnector.formatPhoneNumberwithplus('33123456789')); System.assertNotEquals('', RainbowConnector.formatPhoneNumberwithoutplusspace('33123456789')); System.assertNotEquals('', RainbowConnector.afterfirst(phone)); System.assertNotEquals('', RainbowConnector.aftersecond(phone)); System.assertNotEquals('', RainbowConnector.afterthird(phone)); } static testMethod void testGetCases() { System.assertNotEquals('', RainbowConnector.getCasesByPhoneNumber('+33123456789')); System.assertNotEquals('', RainbowConnector.getCasesByContactPhone('+33123456789')); System.assertNotEquals('', RainbowConnector.getCasesByCaseNumber('000')); } static testMethod void testGetContacts() { System.assertNotEquals('', RainbowConnector.getContactByContactNumber([SELECT Id FROM Contact LIMIT 1][0].Id)); System.assertNotEquals('', RainbowConnector.getContactsByPhoneNumber('+33123456789')); System.assertNotEquals('', RainbowConnector.getContactsByFirstLastName('Contact')); System.assertNotEquals('', RainbowConnector.getContactsByEmail('test@example.com')); System.assertNotEquals('', RainbowConnector.getContactByRecordId([SELECT Id FROM Contact LIMIT 1][0].Id)); } static testMethod void testGetAccounts() { System.assertNotEquals('', RainbowConnector.getAccountsByPhoneNumber('+33123456789')); System.assertNotEquals('', RainbowConnector.getAccountsByFirstLastName('Test Account')); System.assertNotEquals('', RainbowConnector.getAccountByAccountNumber('0000')); } static testMethod void testGetLeads() { System.assertNotEquals('', RainbowConnector.getLeadsByPhoneNumber('+33123456789')); System.assertNotEquals('', RainbowConnector.getLeadByLeadNumber([SELECT Id FROM Lead LIMIT 1][0].Id)); } static testMethod void testOtherMethods() { System.assertNotEquals('', RainbowConnector.getAllRecordTypes()); System.assertNotEquals('', RainbowConnector.getProfileRecordTypesCase()); System.assertNotEquals('', RainbowConnector.getProfileRecordTypesContact()); System.assertNotEquals('', RainbowConnector.getProfileRecordTypesAccount()); System.assertNotEquals('', RainbowConnector.getProfileRecordTypesLead()); System.assertNotEquals('', RainbowConnector.getTaskByCallId('callidTest')); System.assertEquals('001', RainbowConnector.addCallRecord('2024-01-01', '+33123456789', '10', 'outgoing', 'callidTest', 'answered', 'note', '001')); } static testMethod void testRainbowConnectorProfile() { Test.startTest(); String profile = RainbowConnector.getRainbowConnectorProfile(); RainbowConnector.setRainbowConnectorProfile('TestProfile'); Test.stopTest(); System.assertNotEquals('', profile); } }