@@ -0,0 +1,2735 @@
+/*%0A * Copyright (c) 2008-2017, Hazelcast, Inc. All Rights Reserved.%0A *%0A * Licensed under the Apache License, Version 2.0 (the %22License%22);%0A * you may not use this file except in compliance with the License.%0A * You may obtain a copy of the License at%0A *%0A * http://www.apache.org/licenses/LICENSE-2.0%0A *%0A * Unless required by applicable law or agreed to in writing, software%0A * distributed under the License is distributed on an %22AS IS%22 BASIS,%0A * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.%0A * See the License for the specific language governing permissions and%0A * limitations under the License.%0A */%0A%0Apackage com.hazelcast.jet.impl.execution;%0A%0Aimport org.junit.Before;%0Aimport org.junit.Rule;%0Aimport org.junit.Test;%0Aimport org.junit.rules.ExpectedException;%0A%0Aimport java.util.ArrayList;%0A%0Aimport static com.hazelcast.jet.impl.util.DoneItem.DONE_ITEM;%0Aimport static org.junit.Assert.assertEquals;%0Aimport static org.junit.Assert.assertFalse;%0Aimport static org.junit.Assert.assertTrue;%0A%0Apublic class CollectionWithDoneDetectorTest %7B%0A%0A    @Rule%0A    public ExpectedException exception = ExpectedException.none();%0A%0A    private CollectionWithDoneDetector coll = new CollectionWithDoneDetector();%0A%0A    @Before%0A    public void setUp() %7B%0A        coll.wrapped = new ArrayList%3C%3E();%0A    %7D%0A%0A    @Test%0A    public void when_addNormalItem_then_acceptIt() %7B%0A        assertFalse(coll.done);%0A%0A        assertTrue(coll.add(%22a%22));%0A        assertFalse(coll.done);%0A        assertEquals(coll.size(), 1);%0A%0A        assertTrue(coll.add(%22b%22));%0A        assertFalse(coll.done);%0A        assertEquals(coll.size(), 2);%0A    %7D%0A%0A    @Test%0A    public void when_addDoneItem_then_refuseItAndBecomeDone() %7B%0A        assertFalse(coll.done);%0A%0A        assertTrue(coll.add(%22a%22));%0A        assertFalse(coll.done);%0A        assertEquals(coll.size(), 1);%0A%0A        assertFalse(coll.add(DONE_ITEM));%0A        assertTrue(coll.done);%0A        assertEquals(coll.size(), 1);%0A    %7D%0A%0A    @Test%0A    public void when_addAfterDone_then_fail() %7B%0A        assertFalse(coll.done);%0A%0A        assertTrue(coll.add(%22a%22));%0A        assertFalse(coll.done);%0A        assertEquals(coll.size(), 1);%0A%0A        assertFalse(coll.add(DONE_ITEM));%0A        assertTrue(coll.done);%0A        assertEquals(coll.size(), 1);%0A%0A        exception.expect(AssertionError.class);%0A        coll.add(%22c%22);%0A    %7D%0A%0A    @Test%0A    public void when_addMultipleDoneItems_then_fail() %7B%0A        assertFalse(coll.done);%0A%0A        assertTrue(coll.add(%22a%22));%0A        assertFalse(coll.done);%0A        assertEquals(coll.size(), 1);%0A%0A        assertFalse(coll.add(DONE_ITEM));%0A        assertTrue(coll.done);%0A        assertEquals(coll.size(), 1);%0A%0A        exception.expect(AssertionError.class);%0A        coll.add(DONE_ITEM);%0A    %7D%0A%0A%7D

Add test for CollectionWithDoneDetector (#301)