### Question:
VaultKvV2Engine extends AbstractVaultEngine<VaultKvV2Engine> { @Override @Cacheable(cacheNames = "vaultCache") public String get(@NotNull String secret) { return Optional.ofNullable(convertToVaultSecret(secret)).map(s -> { Versioned<Map<String, Object>> response = template.opsForVersionedKeyValue(s.getEnginePath()).get(s.getPath()); return response != null && response.getData() != null ? String.valueOf(response.getData().get("secret")) : null; }).orElse(null); } VaultKvV2Engine(VaultTemplate template); @Override String put(String path, String value); @Override boolean isExists(String secret); @Override @Cacheable(cacheNames = "vaultCache") String get(@NotNull String secret); @Override @CacheEvict(cacheNames = "vaultCache", allEntries = true) void delete(String secret); @Override SecretResponse convertToExternal(String secret); List<String> listEntries(String path); @Override @CacheEvict(cacheNames = "vaultCache", allEntries = true) void cleanup(String path);  }### Answer:
@Test public void testGetNotSecret() { Assert.assertNull(underTest.get("secret")); }
@Test public void testGetNull() { when(vaultVersionedKeyValueOperations.get(anyString())).thenReturn(null); Assert.assertNull(underTest.get(gson.toJson(secret))); }
@Test public void testGetButNull() { when(vaultResponse.getData()).thenReturn(null); when(vaultVersionedKeyValueOperations.get(anyString())).thenReturn(vaultResponse); Assert.assertNull(underTest.get(gson.toJson(secret))); }
@Test public void testGetButEmpty() { when(vaultResponse.getData()).thenReturn(Collections.emptyMap()); when(vaultVersionedKeyValueOperations.get(anyString())).thenReturn(vaultResponse); Assert.assertEquals("null", underTest.get(gson.toJson(secret))); }
@Test public void testGetOk() { when(vaultResponse.getData()).thenReturn(Collections.singletonMap("secret", "secret/path")); when(vaultVersionedKeyValueOperations.get(anyString())).thenReturn(vaultResponse); Assert.assertEquals("secret/path", underTest.get(gson.toJson(secret))); }