You need to sign in to do that
Don't have an account?

Test Class Error
I have written this piece of code in a class to use it in trigger :
----------------------------------------
public class ConversionHelper
static boolean flagvalue = false;
public static boolean hasAlreadyfired() {
return flagvalue;
}
public static void setAlreadyfired() {
flagvalue = true;
}
}
------------------------------------------
In the test class to cover this part of the code :
--------------------------------------------
@isTest
private class ConversionHelper_TC {
Boolean hasfired = CurrencyConversionHelper.hasAlreadyfired();
CurrencyConversionHelper.setAlreadyfired();
}
--------------------------------------------
Getting the following errors :
For - CurrencyConversionHelper.setAlreadyfired(); - Method must define a body at line 14 column 2
For - Boolean setfired = CurrencyConversionHelper.setAlreadyfired(); - Compile Error: Illegal assignment from void to Boolean at line 14 column 1
This is not getting covered in the class .
Plz help.
You are missing testmethod keyword in your testclass,try below :-
public class ConversionHelper
static boolean flagvalue = false;
public static boolean hasAlreadyfired() {
return flagvalue;
}
public static void setAlreadyfired() {
flagvalue = true;
}
static testmethod void MyUnitTest(){
Boolean hasfired = CurrencyConversionHelper.hasAlreadyfired();
CurrencyConversionHelper.setAlreadyfired();
}