@isTest
private class LastbuyProductHandlerTest {
    @isTest 
	static void TestMethod1() {
        Product2 pro = new Product2();
        pro.Name = 'Testname0215';
        pro.LastbuyProductFLG__c = false;
        insert pro;

        Product2 pro1 = new Product2();
        pro1.Name = 'Testname0216';
        pro1.LastbuyProductFLG__c = false;
        insert pro1;
        
        LastbuyProduct__c lbp = new LastbuyProduct__c();
        lbp.Name = 'Test0215';
        lbp.ProductName__c = pro.Id;
        lbp.effectiveFLG__c = true;
        insert lbp;

        lbp.effectiveFLG__c = false;
        update lbp;

        lbp.effectiveFLG__c = true;
        update lbp;

        LastbuyProduct__c lbp1 = new LastbuyProduct__c();
        lbp1.Name = 'Test0216';
        lbp1.ProductName__c = pro1.Id;
        lbp1.effectiveFLG__c = true;
        insert lbp1;

        LastbuyProduct__c lbp2 = new LastbuyProduct__c();
        lbp2.Name = 'Test0217';
        lbp2.ProductName__c = pro1.Id;
        lbp2.effectiveFLG__c = true;
        insert lbp2;

        lbp1.effectiveFLG__c = false;
        update lbp1;

    }

}