### Question:
JpaDataStore implements DataStore { @Override public Channel getChannel(final String channelId) throws ChannelNotFoundException { final JpaOperation<ChannelDTO> findChannel = new JpaOperation<ChannelDTO>() { @Override public ChannelDTO perform(EntityManager em) { return em.find(ChannelDTO.class, channelId); } }; final ChannelDTO dto = jpaExecutor.execute(findChannel); if (dto == null) { throw new ChannelNotFoundException("No Channel for [" + channelId + "] was found", channelId); } return new DefaultChannel(dto.getUserAgent().getUaid(), dto.getChannelId(), dto.getVersion(), dto.getEndpointToken()); } JpaDataStore(final String persistenceUnit); @Override void savePrivateKeySalt(final byte[] salt); @Override byte[] getPrivateKeySalt(); @Override boolean saveChannel(final Channel channel); @Override Channel getChannel(final String channelId); @Override void removeChannels(final Set<String> channelIds); @Override Set<String> getChannelIds(final String uaid); @Override void removeChannels(final String uaid); @Override String updateVersion(final String endpointToken, final long version); @Override String saveUnacknowledged(final String channelId, final long version); @Override Set<Ack> getUnacknowledged(final String uaid); @Override Set<Ack> removeAcknowledged(final String uaid, final Set<Ack> acked);  }### Answer:
@Test public void getChannel() throws ChannelNotFoundException { final String uaid = UUIDUtil.newUAID(); final String channelId = UUID.randomUUID().toString(); jpaDataStore.saveChannel(newChannel(uaid, channelId, 10L)); final Channel channel = jpaDataStore.getChannel(channelId); assertThat(channel.getChannelId(), equalTo(channelId)); assertThat(channel.getUAID(), equalTo(uaid)); assertThat(channel.getVersion(), equalTo(10L)); assertThat(channel.getEndpointToken(), equalTo("endpointToken")); }
@Test (expected = ChannelNotFoundException.class) public void shouldThrowIfChannelIdNotFound() throws ChannelNotFoundException { jpaDataStore.getChannel("doesNotExistId"); }