Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 33c9ebb4 authored by vagdevi's avatar vagdevi Committed by Vagdevi Kondeti
Browse files

Add test for when a WorkSource removes itself.

Add test to capture logic of current implementation: when WorkSource
adds and removes itself, the WorkSource size is decremented but
uid and name are unaffected.

Bug: 111652977
Test: test added
Change-Id: I0b43548d02c1376468550b7bc5aa98c0ca4b3385
parent 25fd8d68
Loading
Loading
Loading
Loading
+11 −0
Original line number Diff line number Diff line
@@ -378,6 +378,17 @@ public class WorkSourceTest extends TestCase {
        assertEquals(75, ws1.getWorkChains().get(0).getAttributionUid());
    }

    public void testRemove_fromSameWorkSource() {
        WorkSource ws1 = new WorkSource(50, "foo");
        WorkSource ws2 = ws1;
        ws2.add(ws1);
        assertTrue(ws2.remove(ws1));

        assertEquals(0, ws1.size());
        assertEquals(50, ws1.get(0));
        assertEquals("foo", ws1.getName(0));
    }

    public void testTransferWorkChains() {
        WorkSource ws1 = new WorkSource();
        WorkChain wc1 = ws1.createWorkChain().addNode(100, "tag");