function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion

Pls provide unit test for class

public with sharing class AccountFinal
public account acc{get;set;}
public List<selectoption> so{get;set;}
public String city{get;set;}

public AccountFinal(Apexpages.standardcontroller controller)
id id1 = ApexPages.currentPage().getParameters().get('recordtype');
string s = ApexPages.currentPage().getParameters().get('recordTypeName');

id id2 = Apexpages.currentpage().getparameters().get('id');
so = new list<selectoption>();
acc = (account)controller.getRecord();

if(id2 != null){

acc = [select name,fax,type,billingcity from account where id=:id2];

city= acc.billingcity;


acc.recordtypeid = id1;
else acc.type='Customer';

so.add(new selectoption('--None--','--None--'));


public pagereference save()

acc.billingcity = city;

if(acc.billingcity == null || acc.billingcity ==''){
acc.addError('city is a required field');
return null;

upsert acc;
return (new Apexpages.standardcontroller(acc).view());
catch(exception e){
return null;}

public void pocode(){
postal_code__c pc= [select name,city__c from postal_code__c where id=:acc.Postal_Code_Number__c];