### Question:
KeySequenceConfigRepository { public KeySequenceConfig get(CharSequence key) { return (KeySequenceConfig) map.get(key); } KeySequenceConfigRepository(Map<CharSequence, ItemSource> dataSource);  KeySequenceConfigRepository(Map<CharSequence, ItemSource> dataSource, long expireInMillis); KeySequenceConfig get(CharSequence key); boolean contains(CharSequence keySequenceConfigKey); void persist(KeySequenceConfig config); void purge(KeySequenceConfig config); Collection<KeySequenceConfig> getAll();  }### Answer:
@Test public void getReturnsElementIfPresentInGivenMap() { Map<CharSequence, ItemSource> map = createDefaultTestMap(); KeySequenceConfigRepository repository = new KeySequenceConfigRepository(map, DEFAULT_TEST_KEY_SEQUENCE_EXPIRY); KeySequenceConfig expected = createDefaultTestKeySequenceConfig(); map.put(expected.getKey(), expected); KeySequenceConfig result = repository.get(expected.getKey()); assertEquals(expected, result); }
@Test public void getReturnsNullIfElementNotPresentInGivenMap() { Map<CharSequence, ItemSource> map = createDefaultTestMap(); KeySequenceConfigRepository repository = new KeySequenceConfigRepository(map, DEFAULT_TEST_KEY_SEQUENCE_EXPIRY); KeySequenceConfig result = repository.get(UUID.randomUUID().toString()); assertNull(result); }