CacheImpl implements Cache { @Override @SuppressWarnings("unchecked") public <T> void set(final String cacheKey, final int expiration, final Object value, final SerializationType serializationType) throws TimeoutException, CacheException { switch (getSerializationType(serializationType)) { case JAVA: set(cacheKey, expiration, (T) value, SerializationType.JAVA, javaTranscoder); break; case JSON: set(cacheKey, expiration, (T) value, SerializationType.JSON, jsonTranscoder); break; case PROVIDER: set(cacheKey, expiration, (T) value, SerializationType.PROVIDER, null); break; case CUSTOM: set(cacheKey, expiration, (T) value, SerializationType.CUSTOM, customTranscoder); break; default: throw new IllegalArgumentException(String.format("Serialization type %s is not supported", serializationType)); } } CacheImpl(final String name, final Collection<String> aliases, final CacheClient cacheClient,
            final SerializationType defaultSerializationType, final JsonTranscoder jsonTranscoder, final JavaTranscoder javaTranscoder,
            final CacheTranscoder customTranscoder, final CacheProperties properties); @Override Collection<SocketAddress> getAvailableServers(); @Override T get(final String cacheKey, final SerializationType serializationType); @Override @SuppressWarnings("unchecked") void set(final String cacheKey, final int expiration, final Object value, final SerializationType serializationType); @Override void setSilently(final String cacheKey, final int expiration, final Object value, final SerializationType serializationType); @Override boolean add(final String cacheKey, final int expiration, final Object value, final SerializationType serializationType); @Override boolean addSilently(final String cacheKey, final int expiration, final Object value, final SerializationType serializationType); @Override Map<String, Object> getBulk(final Collection<String> keys, final SerializationType serializationType); @Override long decr(final String key, final int by); @Override boolean delete(final String key); @Override void delete(final Collection<String> keys); @Override void flush(); @Override long incr(final String key, final int by, final long def); @Override long incr(final String key, final int by, final long def, final int exp); @Override boolean isEnabled(); @Override Long getCounter(final String cacheKey); @Override void setCounter(final String cacheKey, final int expiration, final long value); @Override void shutdown(); @Override Object getNativeClient();  }
@Test public void set() throws TimeoutException, CacheException { String cacheKey = "key1"; int exp = 60000; Object value = new Point(11, 22); cache.set(cacheKey, exp, value, SerializationType.PROVIDER); Mockito.verify(cacheClient).set(getKey(cacheKey), exp, value); cache.set(cacheKey, exp, value, SerializationType.JSON); Mockito.verify(cacheClient).set(getKey(cacheKey), exp, value, jsonTranscoder); }