/** * AwsUser can have a name. * * @throws Exception If some problem inside */ @Test public void hasName() throws Exception { final Region region = Mockito.mock(Region.class); final URN urn = new URN("urn:facebook:444"); final User user = new AwsUser(region, Mockito.mock(SQSClient.class), urn); MatcherAssert.assertThat(user.urn(), Matchers.equalTo(urn)); }
/** * AwsUser can work with real data. * * @throws Exception If some problem inside */ @Test public void worksWithRealDynamoDb() throws Exception { final URN urn = new URN("urn:github:66"); final User user = new AwsUser(this.region, Mockito.mock(SQSClient.class), urn); MatcherAssert.assertThat(user.urn(), Matchers.equalTo(urn)); for (Rule rule : user.rules()) { user.rules().remove(rule.name()); } final String name = "simple-rule"; user.rules().create(name); MatcherAssert.assertThat(user.rules(), Matchers.<Rule>iterableWithSize(1)); MatcherAssert.assertThat(user.rules().contains(name), Matchers.is(true)); }