-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: discard old items in recent activities list
- Loading branch information
Showing
6 changed files
with
62 additions
and
12 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,3 +5,6 @@ build | |
captures | ||
local.properties | ||
gradle/wrapper/gradle-wrapper.jar | ||
**/.project | ||
**/.settings | ||
**/.classpath |
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
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
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
39 changes: 39 additions & 0 deletions
39
app/src/test/java/by/yauhenl/gardine/DiscardingStackTest.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,39 @@ | ||
package by.yauhenl.gardine; | ||
|
||
import org.junit.Test; | ||
import static org.assertj.core.api.Java6Assertions.*; | ||
|
||
public class RecentActivitiesTest { | ||
|
||
private static final String a = "a", b = "b", c = "c", d = "d"; | ||
|
||
@Test | ||
public void singleElement_noTruncation() { | ||
DiscardingStack<String> ra = new DiscardingStack<>(3); | ||
ra.add(a); | ||
ra.add(a); | ||
ra.add(a); | ||
assertThat(ra.getAll()).containsOnly(a); | ||
} | ||
|
||
@Test | ||
public void twoElements_noTruncation() { | ||
DiscardingStack<String> ra = new DiscardingStack<>(3); | ||
ra.add(a); | ||
ra.add(b); | ||
ra.add(a); | ||
assertThat(ra.getAll()).containsOnly(a, b); | ||
} | ||
|
||
@Test | ||
public void threeElements_withTruncation() { | ||
DiscardingStack<String> ra = new DiscardingStack<>(3); | ||
ra.add(a); | ||
ra.add(b); | ||
ra.add(c); | ||
ra.add(d); | ||
assertThat(ra.getAll()).containsOnly(b, c, d); | ||
} | ||
|
||
|
||
} |