You need to sign in to do that
Don't have an account?
Sonam Patil
Assertion failed error
Hi,
Here is my testClass code.
I am getting error as Assertion failed.
Please Can anyone help me to solve this'
@isTest public class BookTest {
public static @isTest void btest(){
Book__c b = new Book__c(Name='Kcloud', price__c=100);
System.debug('The price of a book before insert is:'+b.Price__c);
insert b;
b=[Select id,Name,price__c from Book__c where id=:b.id];
System.debug('The price of the book after thr trigger is fired:'+b.Price__c); System.assertEquals(90,b.price__c);
}
}
Here is my testClass code.
I am getting error as Assertion failed.
Please Can anyone help me to solve this'
@isTest public class BookTest {
public static @isTest void btest(){
Book__c b = new Book__c(Name='Kcloud', price__c=100);
System.debug('The price of a book before insert is:'+b.Price__c);
insert b;
b=[Select id,Name,price__c from Book__c where id=:b.id];
System.debug('The price of the book after thr trigger is fired:'+b.Price__c); System.assertEquals(90,b.price__c);
}
}
Is the trigger deducting the price? If not, it shold be 100, instead of 90.
Thanks,
Sumit Kumar Singh.