Skip to content

Commit

Permalink
#28 bug reproduced
Browse files Browse the repository at this point in the history
  • Loading branch information
yegor256 committed Jan 7, 2017
1 parent 123c931 commit 0a60fbe
Show file tree
Hide file tree
Showing 2 changed files with 38 additions and 4 deletions.
34 changes: 31 additions & 3 deletions src/test/java/io/jare/dynamo/DyBaseITCase.java
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
package io.jare.dynamo;

import io.jare.model.Base;
import io.jare.model.Domain;
import io.jare.model.User;
import org.hamcrest.MatcherAssert;
import org.hamcrest.Matchers;
Expand All @@ -44,14 +45,41 @@ public final class DyBaseITCase {
@Test
public void listsAllDomains() throws Exception {
final Base base = new DyBase(new Dynamo());
final String john = "erik";
final User user = base.user(john);
final String erik = "erik";
final User user = base.user(erik);
final String name = "www.example.com";
user.add(name);
final Iterable<Domain> list = base.all();
MatcherAssert.assertThat(
base.all(),
list,
Matchers.iterableWithSize(Matchers.greaterThan(0))
);
MatcherAssert.assertThat(
list,
Matchers.iterableWithSize(Matchers.greaterThan(0))
);
}

/**
* DyBase can list domain by name.
* @throws Exception If some problem inside
*/
@Test
public void listsDomainByName() throws Exception {
final Base base = new DyBase(new Dynamo());
final String john = "johnny";
final User user = base.user(john);
final String name = "www-1.example.com";
user.add(name);
final Iterable<Domain> list = base.domain(name);
MatcherAssert.assertThat(
list,
Matchers.iterableWithSize(1)
);
MatcherAssert.assertThat(
list,
Matchers.iterableWithSize(1)
);
}

}
8 changes: 7 additions & 1 deletion src/test/java/io/jare/dynamo/DyUserITCase.java
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
import io.jare.model.Domain;
import io.jare.model.User;
import java.io.IOException;
import java.util.Iterator;
import org.hamcrest.MatcherAssert;
import org.hamcrest.Matchers;
import org.junit.Test;
Expand Down Expand Up @@ -73,8 +74,13 @@ public void listsMineDomains() throws Exception {
for (int idx = 0; idx < Tv.TEN; ++idx) {
user.add(String.format("facebook-%d.com", idx));
}
final Iterable<Domain> list = user.mine();
MatcherAssert.assertThat(
user.mine(),
list,
Matchers.iterableWithSize(Tv.TEN)
);
MatcherAssert.assertThat(
list,
Matchers.iterableWithSize(Tv.TEN)
);
}
Expand Down

0 comments on commit 0a60fbe

Please sign in to comment.