-
Notifications
You must be signed in to change notification settings - Fork 11
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #142 from flipkart-incubator/bugFix
bug fix while removing object from queue
- Loading branch information
Showing
2 changed files
with
59 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
43 changes: 43 additions & 0 deletions
43
batching/src/test/java/com/flipkart/batching/tape/InMemoryObjectQueueTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
package com.flipkart.batching.tape; | ||
|
||
import com.flipkart.batching.BuildConfig; | ||
|
||
import org.junit.Test; | ||
import org.junit.runner.RunWith; | ||
import org.robolectric.RobolectricTestRunner; | ||
import org.robolectric.annotation.Config; | ||
|
||
import java.util.ArrayList; | ||
|
||
/** | ||
* Test for {@link InMemoryObjectQueue} | ||
*/ | ||
|
||
@RunWith(RobolectricTestRunner.class) | ||
@Config(constants = BuildConfig.class, sdk = 21) | ||
public class InMemoryObjectQueueTest { | ||
|
||
/** | ||
* Test for {@link InMemoryObjectQueue#remove()} ) | ||
*/ | ||
@Test | ||
public void testRemove() { | ||
InMemoryObjectQueue<String> inMemoryObjectQueue = new InMemoryObjectQueue<>(); | ||
|
||
ArrayList<String> arrayList = new ArrayList<>(4); | ||
arrayList.add("test1"); | ||
arrayList.add("test2"); | ||
arrayList.add("test3"); | ||
arrayList.add("test4"); | ||
|
||
for (String sample : arrayList) { | ||
inMemoryObjectQueue.add(sample); | ||
} | ||
|
||
//remove all the 4 elements added to the queue | ||
inMemoryObjectQueue.remove(arrayList.size()); | ||
|
||
//try removing another element from the queue. | ||
inMemoryObjectQueue.remove(); | ||
} | ||
} |