### Question:
SecretClient { public <T extends Secret> T getData(String orgName, String secretName, String password, SecretEntry.TypeEnum expectedType) throws Exception { String path = "/api/v1/org/" + orgName + "/secret/" + secretName + "/data"; ApiResponse<File> r = null; Map<String, Object> params = new HashMap<>(); String pwd = password; if (password == null) { pwd = ""; } params.put("storePassword", pwd); try { r = ClientUtils.withRetry(retryCount, retryInterval, () -> ClientUtils.postData(apiClient, path, params, File.class)); if (r.getData() == null) { throw new IllegalArgumentException("Secret not found: " + orgName + "/" + secretName); } String secretType = ClientUtils.getHeader(Constants.Headers.SECRET_TYPE, r); if (secretType == null) { throw new IllegalStateException("Can't determine the secret's expectedType. Server response: code=" + r.getStatusCode() + ", path=" + path); } SecretEntry.TypeEnum actualSecretType = SecretEntry.TypeEnum.valueOf(secretType); if (expectedType != null && expectedType != actualSecretType) { String msg = "Unexpected type of %s/%s. Expected %s, got %s. " + "Check the secret's expectedType and its usage - some secrets can only be used for specific purposes " + "(e.g. %s is typically used for key-based authentication)."; throw new IllegalArgumentException(String.format(msg, orgName, secretName, expectedType, actualSecretType, SecretEntry.TypeEnum.KEY_PAIR)); } return readSecret(actualSecretType, Files.readAllBytes(r.getData().toPath())); } catch (ApiException e) { if (e.getCode() == 404) { throw new IllegalArgumentException("Secret not found: " + orgName + "/" + secretName); } throw e; } finally { if (r != null && r.getData() != null) { Files.delete(r.getData().toPath()); } } } SecretClient(ApiClient apiClient);  SecretClient(ApiClient apiClient, int retryCount, long retryInterval); T getData(String orgName, String secretName, String password, SecretEntry.TypeEnum expectedType); byte[] decryptString(UUID instanceId, byte[] input); String encryptString(String orgName, String projectName, String input); @Deprecated String encryptString(UUID instanceId, String orgName, String projectName, String input); SecretOperationResponse createSecret(CreateSecretRequest secretRequest);  }### Answer:
@Test public void testInvalidSecretType() throws Exception { String orgName = "org_" + System.currentTimeMillis(); String secretName = "secret_" + System.currentTimeMillis(); wireMock.stubFor(post(urlEqualTo("/api/v1/org/" + orgName + "/secret/" + secretName + "/data")) .willReturn(aResponse() .withStatus(200) .withHeader(Constants.Headers.SECRET_TYPE, SecretEntry.TypeEnum.DATA.name()) .withBody("Hello!"))); ApiClient apiClient = new ConcordApiClient("http: SecretClient secretClient = new SecretClient(apiClient); try { secretClient.getData(orgName, secretName, null, SecretEntry.TypeEnum.KEY_PAIR); } catch (IllegalArgumentException e) { assertTrue(e.getMessage().contains("Unexpected type of " + orgName + "/" + secretName)); } }