@Test
  public void saveShouldWriteTheTrophyToTheDAO() {
    final Trophy trophy = new Trophy();
    trophy.setId(new BigDecimal(666));

    underTest.save(trophy);

    verify(trophyDAO).save(trophy);
  }
  @Override
  public void save(final Trophy trophy) {
    if (LOG.isDebugEnabled()) {
      LOG.debug(String.format("Entering save for id %s: %s", trophy.getId(), trophy));
    }

    trophiesLock.writeLock().lock();
    try {
      trophyDAO.save(trophy);
      trophies.put(trophy.getId(), trophy);

    } finally {
      trophiesLock.writeLock().unlock();
    }
  }
  @PostConstruct
  public void refreshTrophies() {
    trophiesLock.writeLock().lock();

    try {
      trophies.clear();

      final Collection<Trophy> dbTrophies = trophyDAO.retrieveAll();
      if (dbTrophies != null) {
        for (Trophy dbTrophy : dbTrophies) {
          trophies.put(dbTrophy.getId(), dbTrophy);
        }
      }
    } finally {
      trophiesLock.writeLock().unlock();
    }
  }
  @Override
  public Collection<Trophy> findByName(final String trophyName) {
    notNull(trophyName, "trophyName must not be null");

    final List<Trophy> trophiesForName = new ArrayList<Trophy>();

    trophiesLock.readLock().lock();
    try {
      for (Trophy trophy : trophies.values()) {
        if (trophy.getName().equals(trophyName)) {
          trophiesForName.add(trophy);
        }
      }
    } finally {
      trophiesLock.readLock().unlock();
    }

    return trophiesForName;
  }
  @Override
  public Trophy findByNameAndGameType(final String name, final String gameType) {
    notNull(name, "Trophy name may not be null");

    if (LOG.isDebugEnabled()) {
      LOG.debug("Entering find by name " + name);
    }

    trophiesLock.readLock().lock();
    try {
      for (Trophy trophy : trophies.values()) {
        if (trophy.getGameType().equals(gameType) && trophy.getName().equals(name)) {
          return trophy;
        }
      }
    } finally {
      trophiesLock.readLock().unlock();
    }

    return null;
  }
  @Override
  public Collection<Trophy> findForGameType(final String gameType) {
    notNull(gameType, "Game type  may not be null");

    if (LOG.isDebugEnabled()) {
      LOG.debug("Entering find for game type " + gameType);
    }

    final List<Trophy> trophiesForGameType = new ArrayList<Trophy>();

    trophiesLock.readLock().lock();
    try {
      for (Trophy trophy : trophies.values()) {
        if (trophy.getGameType().equals(gameType)) {
          trophiesForGameType.add(trophy);
        }
      }
    } finally {
      trophiesLock.readLock().unlock();
    }

    return trophiesForGameType;
  }
  @Test
  public void findByIdReturnsMatchingTrophy() {
    final Trophy trophy = underTest.findById(TROPHY1.getId());

    assertThat(trophy, is(equalTo(TROPHY1)));
  }