You need to sign in to do that
Don't have an account?
Jose María Nicolás Arfelis
expecting colon, found ERROR MESSAGE after running test class
Hi all,
I am trying to cover some lines in my controller apex class, but since hours dealing with the error message:
I tend to think that it has to do with the "IN" in the SELECT statement in the controller method,
Does anybody know, what I am doing wrong or what is missing in the lines in my test class?. The errors are pointing to the line
and to the line
I am trying to cover some lines in my controller apex class, but since hours dealing with the error message:
Expecting colon, found 'TestPostgrado1'.The method I am trying to cover through my controller test class is this (method in my controller):
public list<Product2> getProgramsFromListId(String listId){ list<Product2> listProgramas = new list<Product2>(); String query = 'Select Id, Name from Product2 where Id In ' + listId ; listProgramas = Database.query(query); return listProgramas; }In order to cover that part I have written these lines in my code on the controller test class:
Product2 postgrado1 = new Product2(Name = 'TestPostgrad1'); insert postgrado1; Product2 postgrado2 = new Product2(Name = 'TestPostgrad2'); insert postgrado2; List<Product2> postgrados = new List<Product2> (); postgrados.add(postgrado1); postgrados.add(postgrado2); //List<Product2> listProgramas = new list<Product2>(); //listProgramas.add(postgrado.Name); controller.getProgramsFromListName(postgrado1.Name);ok, I know postgrado1.Name is not correct, I was trying with several variants, but nothing happens, the errors is still being displayed.
I tend to think that it has to do with the "IN" in the SELECT statement in the controller method,
Does anybody know, what I am doing wrong or what is missing in the lines in my test class?. The errors are pointing to the line
controller.getProgramsFromListName(postgrado1.Name);in my controller test class.
and to the line
listProgramas = Database.query(query);I would appreciate any help.
if you would like to know what the getProgramsFromList Name has:
As addition to the description above, there are the following lines in my controller class:
I am trying to amend the issue while running the test, but still can not solve it.
Regards
Alain