@Test
  public void shouldThrowException_WhenOperatingWithNoKey() {
    when(coRepository.lock(noKey)).thenReturn(true);
    when(originalRepository.read(noKey)).thenReturn(Item.withNoValue(noKey));
    sut = new CoRepositoryClient(coRepository, originalRepository);

    try {
      when(coRepository.selectAsInt(noKey)).thenReturn(Item.withNoValue(noKey));
      sut.selectAsInt(noKey);
      fail();
    } catch (NonExistentKeyException e) {
    }

    try {
      sut.update(new Item(noKey, "anyValue"));
      fail();
    } catch (NonExistentKeyException e) {
    }

    try {
      sut.increase(noKey);
      fail();
    } catch (NonExistentKeyException e) {
    }

    try {
      sut.decrease(noKey);
      fail();
    } catch (NonExistentKeyException e) {
    }
  }
  @Test
  public void canSelectIntegerValue() {
    when(originalRepository.read(key)).thenReturn(integerItem);
    when(coRepository.selectAsInt(key)).thenReturn(integerItem);
    sut = new CoRepositoryClient(coRepository, originalRepository);

    Item result = sut.selectAsInt(key);

    assertThat(result, is(integerItem));
  }