Skip to main content
added 133 characters in body
Source Link
Adrian Larson
  • 151.4k
  • 38
  • 247
  • 431

It seems you wish to asset agains the size of your cont property.

system.assertEquals(1, myController.cont.size(), 'Add an assertion message here');

It would be wise to first assert the property is not null. Otherwise, your test might at some point fail with a null pointer exception, rather than an assertion message. The latter tends to be much more informative.

system.assertNotEquals(null, myController.cont, 'The property should contain query results');
system.assertEquals(1, myController.cont.size(), 'Message...');

At this point you may catch that you haven't yet called myController.search(), which appears to be what you are trying to test.

It seems you wish to asset agains the size of your cont property.

system.assertEquals(1, myController.cont.size(), 'Add an assertion message here');

It would be wise to first assert the property is not null. Otherwise, your test might at some point fail with a null pointer exception, rather than an assertion message. The latter tends to be much more informative.

system.assertNotEquals(null, myController.cont, 'The property should contain query results');
system.assertEquals(1, myController.cont.size(), 'Message...');

It seems you wish to asset agains the size of your cont property.

system.assertEquals(1, myController.cont.size(), 'Add an assertion message here');

It would be wise to first assert the property is not null. Otherwise, your test might at some point fail with a null pointer exception, rather than an assertion message. The latter tends to be much more informative.

system.assertNotEquals(null, myController.cont, 'The property should contain query results');
system.assertEquals(1, myController.cont.size(), 'Message...');

At this point you may catch that you haven't yet called myController.search(), which appears to be what you are trying to test.

Source Link
Adrian Larson
  • 151.4k
  • 38
  • 247
  • 431

It seems you wish to asset agains the size of your cont property.

system.assertEquals(1, myController.cont.size(), 'Add an assertion message here');

It would be wise to first assert the property is not null. Otherwise, your test might at some point fail with a null pointer exception, rather than an assertion message. The latter tends to be much more informative.

system.assertNotEquals(null, myController.cont, 'The property should contain query results');
system.assertEquals(1, myController.cont.size(), 'Message...');