@isTest private class OrderSearchProductControllerTest { public class productInfo { public Integer idx {get; set;} public Product2 pro { get; set; } public productInfo(Integer i, Product2 pro) { this.idx = i; this.pro = pro; } } static testMethod void testMethod1() { Product2 p2 = new Product2(); p2.Name = 'test01'; p2.ProductCode = 'n011'; p2.Packing_list_manual__c = 5; p2.SFDA_Expiration_Date__c = Date.today().addDays(1); p2.Asset_Model_No__c = 'n01'; p2.Whether_Sample__c = true; p2.SFDA_Status__c = '有効'; insert p2; Apexpages.Standardcontroller scon = new Apexpages.Standardcontroller(p2); OrderSearchProductController controller = new OrderSearchProductController(scon); //OrderSearchProductController controller = new OrderSearchProductController(); controller.getHascl(); String ProModel = '01'; controller.makeSoql(ProModel); controller.searchHospital(); controller.productInfoList = new List(); controller.productInfoList.add(new OrderSearchProductController.productInfo(0,p2)); } }