public class TestingVFController_Controller{
public PageReference save(){
PageReference p=null;
if(this.qp==null || !'yy'.equals(this.qp)){
p=Page.pagenotfound;
p.getParameters().put('error','NoParam');
}
else{
p=Page.homepage;
}}
if qp parameter='yy' then this will redirect to /apex/homepage else /apex/pagenotfound.
for this test class would be
static testMethod void ControllerTest() {
// first test without parameter
PageReference p=Page.HomePage;
Test.setCurrentPage(p);
TestingVFController_Controller ctrl=new TestingVFController_Controller();
String nextPage=ctrl.save().getUrl();
System.assertEquals('/apex/pagenotfound?error=NoParam',nextPage);
//then check with parameter case
ApexPages.currentPage().getParameters().put('qp','yyyy');
ctrl=new TestingVFController_Controller();
nextPage=ctrl.save().getUrl();
System.assertEquals('/apex/homepage', nextPage);