### Question:
VaultKvV1Engine extends AbstractVaultEngine<VaultKvV1Engine> { @Override public boolean isExists(String secret) { return Optional.ofNullable(convertToVaultSecret(secret)).map(s -> { VaultResponse response = template.read(s.getPath()); return response != null && response.getData() != null; }).orElse(false); } @Inject  VaultKvV1Engine(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); void cleanup(String path);  }### Answer:
@Test public void testIsExistsNull() { when(template.read(anyString())).thenReturn(null); Assert.assertFalse(underTest.isExists(gson.toJson(secret))); }
@Test public void testIsExistsButNull() { when(vaultResponse.getData()).thenReturn(null); when(template.read(anyString())).thenReturn(vaultResponse); Assert.assertFalse(underTest.isExists(gson.toJson(secret))); }
@Test public void testIsExists() { when(vaultResponse.getData()).thenReturn(Collections.emptyMap()); when(template.read(anyString())).thenReturn(vaultResponse); Assert.assertTrue(underTest.isExists(gson.toJson(secret))); }