It can't see my Queue: âExpected: 0, Actual: 1â
Clash Royale CLAN TAG#URR8PPP
.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty margin-bottom:0;
up vote
1
down vote
favorite
System.AssertException: Assertion Failed: Expected: 0, Actual: 1
How can I fix it?
Group testGroup = new Group(Name = 'XXX', Type = 'Queue');
insert testGroup;
List<Obj__c> oList = [SELECT OwnerId FROM Obj__c WHERE OwnerId =: testGroup.Id];
System.assertEquals(oList.size(), 1);
testGroup.Id is not null.
unit-test queue
add a comment |Â
up vote
1
down vote
favorite
System.AssertException: Assertion Failed: Expected: 0, Actual: 1
How can I fix it?
Group testGroup = new Group(Name = 'XXX', Type = 'Queue');
insert testGroup;
List<Obj__c> oList = [SELECT OwnerId FROM Obj__c WHERE OwnerId =: testGroup.Id];
System.assertEquals(oList.size(), 1);
testGroup.Id is not null.
unit-test queue
your Group insertion might have failed, add a assert before query to see if you have a group id.
â Raul
2 hours ago
I have group Id.
â ÃÂþýÃÂõ ÃÂÃÂøÃÂÃÂþ
2 hours ago
You haven't assigned any records to the ownership of the Queue. That query should return no results.
â David Reed
2 hours ago
1
The first parameter inassertEquals
is the expected value. Please stick to that to avoid future debugging headaches.
â Programmatic
1 hour ago
add a comment |Â
up vote
1
down vote
favorite
up vote
1
down vote
favorite
System.AssertException: Assertion Failed: Expected: 0, Actual: 1
How can I fix it?
Group testGroup = new Group(Name = 'XXX', Type = 'Queue');
insert testGroup;
List<Obj__c> oList = [SELECT OwnerId FROM Obj__c WHERE OwnerId =: testGroup.Id];
System.assertEquals(oList.size(), 1);
testGroup.Id is not null.
unit-test queue
System.AssertException: Assertion Failed: Expected: 0, Actual: 1
How can I fix it?
Group testGroup = new Group(Name = 'XXX', Type = 'Queue');
insert testGroup;
List<Obj__c> oList = [SELECT OwnerId FROM Obj__c WHERE OwnerId =: testGroup.Id];
System.assertEquals(oList.size(), 1);
testGroup.Id is not null.
unit-test queue
unit-test queue
edited 2 hours ago
asked 2 hours ago
ÃÂþýÃÂõ ÃÂÃÂøÃÂÃÂþ
184
184
your Group insertion might have failed, add a assert before query to see if you have a group id.
â Raul
2 hours ago
I have group Id.
â ÃÂþýÃÂõ ÃÂÃÂøÃÂÃÂþ
2 hours ago
You haven't assigned any records to the ownership of the Queue. That query should return no results.
â David Reed
2 hours ago
1
The first parameter inassertEquals
is the expected value. Please stick to that to avoid future debugging headaches.
â Programmatic
1 hour ago
add a comment |Â
your Group insertion might have failed, add a assert before query to see if you have a group id.
â Raul
2 hours ago
I have group Id.
â ÃÂþýÃÂõ ÃÂÃÂøÃÂÃÂþ
2 hours ago
You haven't assigned any records to the ownership of the Queue. That query should return no results.
â David Reed
2 hours ago
1
The first parameter inassertEquals
is the expected value. Please stick to that to avoid future debugging headaches.
â Programmatic
1 hour ago
your Group insertion might have failed, add a assert before query to see if you have a group id.
â Raul
2 hours ago
your Group insertion might have failed, add a assert before query to see if you have a group id.
â Raul
2 hours ago
I have group Id.
â ÃÂþýÃÂõ ÃÂÃÂøÃÂÃÂþ
2 hours ago
I have group Id.
â ÃÂþýÃÂõ ÃÂÃÂøÃÂÃÂþ
2 hours ago
You haven't assigned any records to the ownership of the Queue. That query should return no results.
â David Reed
2 hours ago
You haven't assigned any records to the ownership of the Queue. That query should return no results.
â David Reed
2 hours ago
1
1
The first parameter in
assertEquals
is the expected value. Please stick to that to avoid future debugging headaches.â Programmatic
1 hour ago
The first parameter in
assertEquals
is the expected value. Please stick to that to avoid future debugging headaches.â Programmatic
1 hour ago
add a comment |Â
2 Answers
2
active
oldest
votes
up vote
3
down vote
You haven't inserted any records in to the queue yet, so 0 is the expected value. Instead, you need to follow the following steps: insert the Group, insert a QueueSObject, then insert at least one Obj__c
record with that OwnerId. Please note that the the Group and QueueSObject must be created inside a System.runAs block, because they are considered Setup Objects.
Here's a demo from a unit test I wrote recently:
@isTest static void test() {
Group g = new Group(Name='TestQueue',Type='Queue');
System.runas(new User(Id=UserInfo.getUserId()))
insert g;
insert new QueueSobject(QueueId=g.id, SObjectType='Lead');
insert new lead(lastname='test',company='test');
insert new lead(lastname='testqueue',company='testqueue',ownerid=g.Id);
...
add a comment |Â
up vote
0
down vote
Obj__c
insert is missing, no records in it.
Need to insert obj__c with ownerId
set as the testGroup.Id
add a comment |Â
2 Answers
2
active
oldest
votes
2 Answers
2
active
oldest
votes
active
oldest
votes
active
oldest
votes
up vote
3
down vote
You haven't inserted any records in to the queue yet, so 0 is the expected value. Instead, you need to follow the following steps: insert the Group, insert a QueueSObject, then insert at least one Obj__c
record with that OwnerId. Please note that the the Group and QueueSObject must be created inside a System.runAs block, because they are considered Setup Objects.
Here's a demo from a unit test I wrote recently:
@isTest static void test() {
Group g = new Group(Name='TestQueue',Type='Queue');
System.runas(new User(Id=UserInfo.getUserId()))
insert g;
insert new QueueSobject(QueueId=g.id, SObjectType='Lead');
insert new lead(lastname='test',company='test');
insert new lead(lastname='testqueue',company='testqueue',ownerid=g.Id);
...
add a comment |Â
up vote
3
down vote
You haven't inserted any records in to the queue yet, so 0 is the expected value. Instead, you need to follow the following steps: insert the Group, insert a QueueSObject, then insert at least one Obj__c
record with that OwnerId. Please note that the the Group and QueueSObject must be created inside a System.runAs block, because they are considered Setup Objects.
Here's a demo from a unit test I wrote recently:
@isTest static void test() {
Group g = new Group(Name='TestQueue',Type='Queue');
System.runas(new User(Id=UserInfo.getUserId()))
insert g;
insert new QueueSobject(QueueId=g.id, SObjectType='Lead');
insert new lead(lastname='test',company='test');
insert new lead(lastname='testqueue',company='testqueue',ownerid=g.Id);
...
add a comment |Â
up vote
3
down vote
up vote
3
down vote
You haven't inserted any records in to the queue yet, so 0 is the expected value. Instead, you need to follow the following steps: insert the Group, insert a QueueSObject, then insert at least one Obj__c
record with that OwnerId. Please note that the the Group and QueueSObject must be created inside a System.runAs block, because they are considered Setup Objects.
Here's a demo from a unit test I wrote recently:
@isTest static void test() {
Group g = new Group(Name='TestQueue',Type='Queue');
System.runas(new User(Id=UserInfo.getUserId()))
insert g;
insert new QueueSobject(QueueId=g.id, SObjectType='Lead');
insert new lead(lastname='test',company='test');
insert new lead(lastname='testqueue',company='testqueue',ownerid=g.Id);
...
You haven't inserted any records in to the queue yet, so 0 is the expected value. Instead, you need to follow the following steps: insert the Group, insert a QueueSObject, then insert at least one Obj__c
record with that OwnerId. Please note that the the Group and QueueSObject must be created inside a System.runAs block, because they are considered Setup Objects.
Here's a demo from a unit test I wrote recently:
@isTest static void test() {
Group g = new Group(Name='TestQueue',Type='Queue');
System.runas(new User(Id=UserInfo.getUserId()))
insert g;
insert new QueueSobject(QueueId=g.id, SObjectType='Lead');
insert new lead(lastname='test',company='test');
insert new lead(lastname='testqueue',company='testqueue',ownerid=g.Id);
...
answered 2 hours ago
sfdcfox
227k10175389
227k10175389
add a comment |Â
add a comment |Â
up vote
0
down vote
Obj__c
insert is missing, no records in it.
Need to insert obj__c with ownerId
set as the testGroup.Id
add a comment |Â
up vote
0
down vote
Obj__c
insert is missing, no records in it.
Need to insert obj__c with ownerId
set as the testGroup.Id
add a comment |Â
up vote
0
down vote
up vote
0
down vote
Obj__c
insert is missing, no records in it.
Need to insert obj__c with ownerId
set as the testGroup.Id
Obj__c
insert is missing, no records in it.
Need to insert obj__c with ownerId
set as the testGroup.Id
answered 2 hours ago
sfdcFanBoy
2,82932458
2,82932458
add a comment |Â
add a comment |Â
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fsalesforce.stackexchange.com%2fquestions%2f232774%2fit-cant-see-my-queue-expected-0-actual-1%23new-answer', 'question_page');
);
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
your Group insertion might have failed, add a assert before query to see if you have a group id.
â Raul
2 hours ago
I have group Id.
â ÃÂþýÃÂõ ÃÂÃÂøÃÂÃÂþ
2 hours ago
You haven't assigned any records to the ownership of the Queue. That query should return no results.
â David Reed
2 hours ago
1
The first parameter in
assertEquals
is the expected value. Please stick to that to avoid future debugging headaches.â Programmatic
1 hour ago