Skip to content

Commit

Permalink
CR changes
Browse files Browse the repository at this point in the history
  • Loading branch information
amihaiemil committed Aug 28, 2016
1 parent 42ba74e commit d018cc0
Showing 1 changed file with 36 additions and 16 deletions.
52 changes: 36 additions & 16 deletions src/test/java/com/jcabi/dynamo/AttributeUpdatesTest.java
Expand Up @@ -35,6 +35,7 @@
import org.apache.commons.lang3.StringUtils;
import org.hamcrest.MatcherAssert;
import org.hamcrest.Matchers;
import org.junit.Assert;
import org.junit.Test;
import org.mockito.Mockito;

Expand Down Expand Up @@ -120,7 +121,7 @@ public void returnsKeySet() {
}

/**
* AttributesUpdates can return its key Set.
* AttributesUpdates can return its values.
*/
@Test
public void returnsValues() {
Expand Down Expand Up @@ -229,37 +230,56 @@ public void addsMap() {
}

/**
* AttributesUpdates.put(...) throws exception when called.
* AttributesUpdates can throw exception when put is called.
*/
@Test(expected = UnsupportedOperationException.class)
@Test
public void putThrowsException() {
new AttributeUpdates().put(
"key9",
Mockito.mock(AttributeValueUpdate.class)
);
try {
new AttributeUpdates().put(
"key9", Mockito.mock(AttributeValueUpdate.class)
);
Assert.fail("#put should not be supported");
} catch (final UnsupportedOperationException ex) {
MatcherAssert.assertThat("passed test", Matchers.notNullValue());
}
}

/**
* AttributesUpdates.putAll(...) throws exception when called.
* AttributesUpdates can throw exception when putAll is called.
*/
@Test(expected = UnsupportedOperationException.class)
@Test
public void putAllThrowsException() {
new AttributeUpdates().putAll(new AttributeUpdates());
try {
new AttributeUpdates().putAll(new AttributeUpdates());
Assert.fail("#putAll should not be supported.");
} catch (final UnsupportedOperationException ex) {
MatcherAssert.assertThat("test ok", Matchers.notNullValue());
}
}

/**
* AttributesUpdates.remove(...) throws exception when called.
* AttributesUpdates can throw exception when remove is called.
*/
@Test(expected = UnsupportedOperationException.class)
@Test
public void removeThrowsException() {
new AttributeUpdates().remove("object to remove");
try {
new AttributeUpdates().remove("object to remove");
Assert.fail("#remove should not be supported.");
} catch (final UnsupportedOperationException ex) {
MatcherAssert.assertThat("passed", Matchers.notNullValue());
}
}

/**
* AttributesUpdates.clear() throws exception when called.
* AttributesUpdates can throw exception when clear is called.
*/
@Test(expected = UnsupportedOperationException.class)
@Test
public void clearThrowsException() {
new AttributeUpdates().clear();
try {
new AttributeUpdates().clear();
Assert.fail("#clear should not be supported.");
} catch (final UnsupportedOperationException ex) {
MatcherAssert.assertThat("test passed", Matchers.notNullValue());
}
}
}

0 comments on commit d018cc0

Please sign in to comment.