Skip to content

Commit

Permalink
boolean and if() stmt
Browse files Browse the repository at this point in the history
  • Loading branch information
amihaiemil committed Aug 28, 2016
1 parent d018cc0 commit 75e8167
Showing 1 changed file with 24 additions and 8 deletions.
32 changes: 24 additions & 8 deletions src/test/java/com/jcabi/dynamo/AttributeUpdatesTest.java
Expand Up @@ -234,13 +234,17 @@ public void addsMap() {
*/
@Test
public void putThrowsException() {
boolean passed;
try {
new AttributeUpdates().put(
"key9", Mockito.mock(AttributeValueUpdate.class)
);
Assert.fail("#put should not be supported");
passed = false;
} catch (final UnsupportedOperationException ex) {
MatcherAssert.assertThat("passed test", Matchers.notNullValue());
passed = true;
}
if (!passed) {
Assert.fail("#put should not be supported");
}
}

Expand All @@ -249,11 +253,15 @@ public void putThrowsException() {
*/
@Test
public void putAllThrowsException() {
boolean passed;
try {
new AttributeUpdates().putAll(new AttributeUpdates());
Assert.fail("#putAll should not be supported.");
passed = false;
} catch (final UnsupportedOperationException ex) {
MatcherAssert.assertThat("test ok", Matchers.notNullValue());
passed = true;
}
if (!passed) {
Assert.fail("#putAll should not be supported.");
}
}

Expand All @@ -262,11 +270,15 @@ public void putAllThrowsException() {
*/
@Test
public void removeThrowsException() {
boolean passed;
try {
new AttributeUpdates().remove("object to remove");
Assert.fail("#remove should not be supported.");
passed = false;
} catch (final UnsupportedOperationException ex) {
MatcherAssert.assertThat("passed", Matchers.notNullValue());
passed = true;
}
if (!passed) {
Assert.fail("#remove should not be supported.");
}
}

Expand All @@ -275,11 +287,15 @@ public void removeThrowsException() {
*/
@Test
public void clearThrowsException() {
boolean passed;
try {
new AttributeUpdates().clear();
Assert.fail("#clear should not be supported.");
passed = false;
} catch (final UnsupportedOperationException ex) {
MatcherAssert.assertThat("test passed", Matchers.notNullValue());
passed = true;
}
if (!passed) {
Assert.fail("#clear should not be supported.");
}
}
}

0 comments on commit 75e8167

Please sign in to comment.