View Javadoc

1   package com.atlassian.vcache.internal.core;
2   
3   import org.junit.Test;
4   
5   import static org.hamcrest.Matchers.is;
6   import static org.junit.Assert.assertThat;
7   
8   public class Sha1ExternalCacheKeyGeneratorTest
9   {
10      private final ExternalCacheKeyGenerator generator = new Sha1ExternalCacheKeyGenerator("jcb");
11  
12      @Test
13      public void entryKey() throws Exception
14      {
15          final String result = generator.entryKey("partition", "cacheName", 42L, "key");
16  
17          assertThat(result, is("sp7DIKzkjox3U9IsgAVOsMN0Eas="));
18      }
19  
20      @Test
21      public void cacheVersionKey() throws Exception
22      {
23          final String result = generator.cacheVersionKey("partition", "cacheName");
24  
25          assertThat(result, is("/SI1uTpfZJaEAQc9ousouZNBxH4="));
26      }
27  }