You need to sign in to do that
Don't have an account?
How to write test class to cover the date fucntion tostartofweek()?
Hi,
Am in need of test class coverage for the date function. Am getting struggled at the point of tostartofweek() function. Now am getting 66% code coverage only.
Am copying my class here. Please find help me to cover this more than 75%.
Public class BusinessDay{
public date getStartWeekData(date thisdate ){
date startDate = thisdate.toStartofWeek();
startDate = startDate+ 1;
return startDate;
}
public string getMonthStart(date thisdate ){
String month;
Integer dt = thisdate.day();
Integer dtMonth = thisdate.month();
if(dtMonth == 1){
month = 'Jan'+' '+ string.ValueOf(dt);
}
if(dtMonth == 2){
month = 'Feb'+' '+ string.ValueOf(dt);
}
if(dtMonth == 3){
month = 'Mar'+' '+ string.ValueOf(dt);
}
if(dtMonth == 4){
month = 'Apr'+' '+ string.ValueOf(dt);
}
if(dtMonth == 5){
month = 'May'+' '+ string.ValueOf(dt);
}
if(dtMonth == 6){
month = 'Jun'+' '+ string.ValueOf(dt);
}
if(dtMonth == 7){
month = 'Jul'+' '+ string.ValueOf(dt);
}
if(dtMonth == 8){
month = 'Aug'+' '+ string.ValueOf(dt);
}
if(dtMonth == 9){
month = 'Sep'+' '+ string.ValueOf(dt);
}
........ and so on.
return month;
}
}
Thanks in advance.