Skip to content

Commit

Permalink
#14 test
Browse files Browse the repository at this point in the history
  • Loading branch information
Yegor Bugayenko committed Sep 16, 2016
1 parent 7702009 commit d581e31
Show file tree
Hide file tree
Showing 2 changed files with 60 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/main/java/io/jare/dynamo/DyBase.java
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,11 @@
package io.jare.dynamo;

import com.amazonaws.services.dynamodbv2.model.Select;
import com.jcabi.aspects.Tv;
import com.jcabi.dynamo.Conditions;
import com.jcabi.dynamo.QueryValve;
import com.jcabi.dynamo.Region;
import com.jcabi.dynamo.ScanValve;
import com.jcabi.dynamo.Table;
import io.jare.model.Base;
import io.jare.model.Domain;
Expand Down Expand Up @@ -92,6 +94,7 @@ public Iterator<Domain> domain(final String name) {
public Iterable<Domain> all() {
return this.table()
.frame()
.through(new ScanValve().withLimit(Tv.HUNDRED))
.stream()
.map(DyDomain::new)
.collect(Collectors.<Domain>toList());
Expand Down
57 changes: 57 additions & 0 deletions src/test/java/io/jare/dynamo/DyBaseITCase.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
/**
* The MIT License (MIT)
*
* Copyright (c) 2016 jare.io
*
* Permission is hereby granted, free of charge, to any person obtaining
* a copy of this software and associated documentation files (the
* "Software"), to deal in the Software without restriction, including
* without limitation the rights to use, copy, modify, merge, publish,
* distribute, sublicense, and/or sell copies of the Software, and to
* permit persons to whom the Software is furnished to do so, subject to
* the following conditions: the above copyright notice and this
* permission notice shall be included in all copies or substantial
* portions of the Software. The software is provided "as is", without
* warranty of any kind, express or implied, including but not limited to
* the warranties of merchantability, fitness for a particular purpose
* and non-infringement. In no event shall the authors or copyright
* holders be liable for any claim, damages or other liability, whether
* in an action of contract, tort or otherwise, arising from, out of or
* in connection with the software or the use or other dealings in the
* software.
*/
package io.jare.dynamo;

import io.jare.model.Base;
import io.jare.model.User;
import org.hamcrest.MatcherAssert;
import org.hamcrest.Matchers;
import org.junit.Test;

/**
* Integration case for {@link DyBase}.
* @author Yegor Bugayenko (yegor@teamed.io)
* @version $Id$
* @since 1.0
* @checkstyle ClassDataAbstractionCouplingCheck (500 lines)
*/
public final class DyBaseITCase {

/**
* DyBase can list domains.
* @throws Exception If some problem inside
*/
@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 name = "www.example.com";
user.add(name);
MatcherAssert.assertThat(
base.all(),
Matchers.iterableWithSize(Matchers.greaterThan(0))
);
}

}

0 comments on commit d581e31

Please sign in to comment.