Sample Apex Class:
public class Sample {
public Sample() {
}
public PageReference goToInfallible() {
PageReference pg = new PageReference(‘https://www.infallibletechie.com’);
pg.setRedirect(true);
return pg;
}
}
Test class:
@isTest
private class SampleTest {
@isTest static void test() {
Sample s = new Sample();
s.goToInfallible();
}
}
Cheers!!!