1 package com.atlassian.sal.core.pluginsettings;
2
3 import org.junit.Test;
4 import org.junit.Before;
5 import static org.junit.Assert.*;
6 import org.mockito.Mock;
7 import org.mockito.MockitoAnnotations;
8 import static org.mockito.Mockito.when;
9 import com.atlassian.sal.api.pluginsettings.PluginSettings;
10
11 public class TestPrefixedPluginSettingsDelegate
12 {
13 @Mock
14 private PluginSettings target;
15 private PluginSettings prefixedPluginSettings;
16
17 private static final Object VALUE = new Object();
18
19 @Before
20 public void initMocks()
21 {
22 MockitoAnnotations.initMocks(this);
23 prefixedPluginSettings = new PrefixedPluginSettingsDelegate("prefix", target);
24 }
25
26 @Test
27 public void testGet()
28 {
29 when(target.get("prefixkey")).thenReturn(VALUE);
30 assertSame(VALUE, prefixedPluginSettings.get("key"));
31 }
32
33 @Test
34 public void testPut()
35 {
36 when(target.put("prefixkey", VALUE)).thenReturn(VALUE);
37 assertSame(VALUE, prefixedPluginSettings.put("key", VALUE));
38 }
39
40 @Test
41 public void testRemove()
42 {
43 when(target.remove("prefixkey")).thenReturn(VALUE);
44 assertSame(VALUE, prefixedPluginSettings.remove("key"));
45 }
46 }