### Question:
SystemPropertyAccessor implements PropertyAccessor { public <T> T getProperty(String key, T defaultValue, Class<T> expected) { T value = null; if (null != key && ((null != expected && expected.isAssignableFrom(String.class)) || defaultValue instanceof String)) { value = (T) System.getProperty(key, (String) defaultValue); } return null != value ? value : (null != delegate) ? delegate.getProperty(key, defaultValue, expected) : null; } SystemPropertyAccessor(final PropertyAccessor delegate); T getProperty(String key, T defaultValue, Class<T> expected);  }### Answer:
@Test public void testGetProperty() throws Exception { PropertyAccessor delegate = mock(PropertyAccessor.class); PropertyAccessor testable = new SystemPropertyAccessor(delegate); System.setProperty("testable", "testvalue"); assertEquals(testable.getProperty("testable", null, String.class), "testvalue"); assertEquals(testable.getProperty("testable", "defaultValue", String.class), "testvalue"); assertEquals(testable.getProperty("pirospaprika", "voroshagyma", null), "voroshagyma"); assertEquals(testable.getProperty("pirospaprika", "voroshagyma", Object.class), "voroshagyma"); verifyZeroInteractions(delegate); assertNull(testable.getProperty(null, null, null)); verify(delegate, times(1)).getProperty(null, null, null); assertNull(testable.getProperty("testable", 1, null)); verify(delegate, times(1)).getProperty("testable", 1, null); assertNull(testable.getProperty("testable", null, Integer.class)); verify(delegate, times(1)).getProperty("testable", null, Integer.class); }