Skip to content

Commit

Permalink
Class parameter omitted during mocking as it is anyway inferred over …
Browse files Browse the repository at this point in the history
…the return type.
  • Loading branch information
cosmolev committed Nov 22, 2023
1 parent 14df9a1 commit 7549748
Show file tree
Hide file tree
Showing 38 changed files with 66 additions and 65 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -41,9 +41,9 @@

public class BehaviorPolicyCreateCommandTest {

private final @NotNull HiveMQRestService hiveMQRestService = mock(HiveMQRestService.class);
private final @NotNull HiveMQRestService hiveMQRestService = mock();
private final @NotNull Gson gson = new Gson();
private final @NotNull OutputFormatter outputFormatter = mock(OutputFormatter.class);
private final @NotNull OutputFormatter outputFormatter = mock();
private final @NotNull DataHubBehaviorPoliciesApi behaviorPoliciesApi = mock(DataHubBehaviorPoliciesApi.class);

private final @NotNull CommandLine commandLine =
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,8 @@

public class BehaviorPolicyDeleteCommandTest {

private final @NotNull HiveMQRestService hiveMQRestService = mock(HiveMQRestService.class);
private final @NotNull OutputFormatter outputFormatter = mock(OutputFormatter.class);
private final @NotNull HiveMQRestService hiveMQRestService = mock();
private final @NotNull OutputFormatter outputFormatter = mock();
private final @NotNull DataHubBehaviorPoliciesApi behaviorPoliciesApi = mock(DataHubBehaviorPoliciesApi.class);

private final @NotNull CommandLine commandLine =
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,8 @@

public class BehaviorPolicyGetCommandTest {

private final @NotNull HiveMQRestService hiveMQRestService = mock(HiveMQRestService.class);
private final @NotNull OutputFormatter outputFormatter = mock(OutputFormatter.class);
private final @NotNull HiveMQRestService hiveMQRestService = mock();
private final @NotNull OutputFormatter outputFormatter = mock();
private final @NotNull DataHubBehaviorPoliciesApi behaviorPoliciesApi = mock(DataHubBehaviorPoliciesApi.class);

private final @NotNull CommandLine commandLine =
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,8 @@

public class BehaviorPolicyListCommandTest {

private final @NotNull HiveMQRestService hiveMQRestService = mock(HiveMQRestService.class);
private final @NotNull OutputFormatter outputFormatter = mock(OutputFormatter.class);
private final @NotNull HiveMQRestService hiveMQRestService = mock();
private final @NotNull OutputFormatter outputFormatter = mock();
private final @NotNull DataHubBehaviorPoliciesApi behaviorPoliciesApi = mock(DataHubBehaviorPoliciesApi.class);

private final @NotNull CommandLine commandLine =
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,9 +41,9 @@

public class BehaviorPolicyUpdateCommandTest {

private final @NotNull HiveMQRestService hiveMQRestService = mock(HiveMQRestService.class);
private final @NotNull HiveMQRestService hiveMQRestService = mock();
private final @NotNull Gson gson = new Gson();
private final @NotNull OutputFormatter outputFormatter = mock(OutputFormatter.class);
private final @NotNull OutputFormatter outputFormatter = mock();
private final @NotNull DataHubBehaviorPoliciesApi behaviorPoliciesApi = mock(DataHubBehaviorPoliciesApi.class);

private final @NotNull CommandLine commandLine =
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,8 @@

public class BehaviorStateGetCommandTest {

private final @NotNull HiveMQRestService hiveMQRestService = mock(HiveMQRestService.class);
private final @NotNull OutputFormatter outputFormatter = mock(OutputFormatter.class);
private final @NotNull HiveMQRestService hiveMQRestService = mock();
private final @NotNull OutputFormatter outputFormatter = mock();
private final @NotNull DataHubStateApi stateApi = mock(DataHubStateApi.class);

private final @NotNull CommandLine commandLine =
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,9 +41,9 @@

public class DataPolicyCreateCommandTest {

private final @NotNull HiveMQRestService hiveMQRestService = mock(HiveMQRestService.class);
private final @NotNull HiveMQRestService hiveMQRestService = mock();
private final @NotNull Gson gson = new Gson();
private final @NotNull OutputFormatter outputFormatter = mock(OutputFormatter.class);
private final @NotNull OutputFormatter outputFormatter = mock();
private final @NotNull DataHubDataPoliciesApi policiesApi = mock(DataHubDataPoliciesApi.class);

private final @NotNull CommandLine commandLine =
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,8 @@

public class DataPolicyDeleteCommandTest {

private final @NotNull HiveMQRestService hiveMQRestService = mock(HiveMQRestService.class);
private final @NotNull OutputFormatter outputFormatter = mock(OutputFormatter.class);
private final @NotNull HiveMQRestService hiveMQRestService = mock();
private final @NotNull OutputFormatter outputFormatter = mock();
private final @NotNull DataHubDataPoliciesApi policiesApi = mock(DataHubDataPoliciesApi.class);

private final @NotNull CommandLine commandLine =
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,8 @@

public class DataPolicyGetCommandTest {

private final @NotNull HiveMQRestService hiveMQRestService = mock(HiveMQRestService.class);
private final @NotNull OutputFormatter outputFormatter = mock(OutputFormatter.class);
private final @NotNull HiveMQRestService hiveMQRestService = mock();
private final @NotNull OutputFormatter outputFormatter = mock();
private final @NotNull DataHubDataPoliciesApi dataPoliciesApi = mock(DataHubDataPoliciesApi.class);

private final @NotNull CommandLine commandLine =
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,8 @@

public class DataPolicyListCommandTest {

private final @NotNull HiveMQRestService hiveMQRestService = mock(HiveMQRestService.class);
private final @NotNull OutputFormatter outputFormatter = mock(OutputFormatter.class);
private final @NotNull HiveMQRestService hiveMQRestService = mock();
private final @NotNull OutputFormatter outputFormatter = mock();
private final @NotNull DataHubDataPoliciesApi policiesApi = mock(DataHubDataPoliciesApi.class);

private final @NotNull CommandLine commandLine =
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,9 +41,9 @@

public class DataPolicyUpdateCommandTest {

private final @NotNull HiveMQRestService hiveMQRestService = mock(HiveMQRestService.class);
private final @NotNull HiveMQRestService hiveMQRestService = mock();
private final @NotNull Gson gson = new Gson();
private final @NotNull OutputFormatter outputFormatter = mock(OutputFormatter.class);
private final @NotNull OutputFormatter outputFormatter = mock();
private final @NotNull DataHubDataPoliciesApi policiesApi = mock(DataHubDataPoliciesApi.class);

private final @NotNull CommandLine commandLine =
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,11 +52,11 @@

public class SchemaCreateCommandTest {

private final @NotNull HiveMQRestService hiveMQRestService = mock(HiveMQRestService.class);
private final @NotNull HiveMQRestService hiveMQRestService = mock();
private @NotNull OutputFormatter outputFormatter;
private final @NotNull ByteArrayOutputStream outputStream = new ByteArrayOutputStream();
private final @NotNull JSON openapiSerialization = new JSON();
private final @NotNull DataHubSchemasApi schemasApi = mock(DataHubSchemasApi.class);
private final @NotNull DataHubSchemasApi schemasApi = mock();

private @NotNull CommandLine commandLine;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,9 +37,9 @@

public class SchemaDeleteCommandTest {

private final @NotNull HiveMQRestService hiveMQRestService = mock(HiveMQRestService.class);
private final @NotNull OutputFormatter outputFormatter = mock(OutputFormatter.class);
private final @NotNull DataHubSchemasApi schemasApi = mock(DataHubSchemasApi.class);
private final @NotNull HiveMQRestService hiveMQRestService = mock();
private final @NotNull OutputFormatter outputFormatter = mock();
private final @NotNull DataHubSchemasApi schemasApi = mock();

private final @NotNull CommandLine commandLine =
new CommandLine(new SchemaDeleteCommand(hiveMQRestService, outputFormatter));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,9 +37,9 @@

public class SchemaGetCommandTest {

private final @NotNull HiveMQRestService hiveMQRestService = mock(HiveMQRestService.class);
private final @NotNull OutputFormatter outputFormatter = mock(OutputFormatter.class);
private final @NotNull DataHubSchemasApi schemasApi = mock(DataHubSchemasApi.class);
private final @NotNull HiveMQRestService hiveMQRestService = mock();
private final @NotNull OutputFormatter outputFormatter = mock();
private final @NotNull DataHubSchemasApi schemasApi = mock();

private final @NotNull CommandLine commandLine =
new CommandLine(new SchemaGetCommand(hiveMQRestService, outputFormatter));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,9 +39,9 @@

public class SchemaListCommandTest {

private final @NotNull HiveMQRestService hiveMQRestService = mock(HiveMQRestService.class);
private final @NotNull OutputFormatter outputFormatter = mock(OutputFormatter.class);
private final @NotNull DataHubSchemasApi schemasApi = mock(DataHubSchemasApi.class);
private final @NotNull HiveMQRestService hiveMQRestService = mock();
private final @NotNull OutputFormatter outputFormatter = mock();
private final @NotNull DataHubSchemasApi schemasApi = mock();

private final @NotNull CommandLine commandLine =
new CommandLine(new SchemaListCommand(hiveMQRestService, outputFormatter));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@

public class ScriptCreateCommandTest {

private final @NotNull HiveMQRestService hiveMQRestService = mock(HiveMQRestService.class);
private final @NotNull HiveMQRestService hiveMQRestService = mock();
private @NotNull OutputFormatter outputFormatter;
private final @NotNull ByteArrayOutputStream outputStream = new ByteArrayOutputStream();
private final @NotNull JSON openapiSerialization = new JSON();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,8 @@

public class ScriptDeleteCommandTest {

private final @NotNull HiveMQRestService hiveMQRestService = mock(HiveMQRestService.class);
private final @NotNull OutputFormatter outputFormatter = mock(OutputFormatter.class);
private final @NotNull HiveMQRestService hiveMQRestService = mock();
private final @NotNull OutputFormatter outputFormatter = mock();
private final @NotNull DataHubScriptsApi scriptsApi = mock(DataHubScriptsApi.class);

private final @NotNull CommandLine commandLine =
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,8 @@

public class ScriptGetCommandTest {

private final @NotNull HiveMQRestService hiveMQRestService = mock(HiveMQRestService.class);
private final @NotNull OutputFormatter outputFormatter = mock(OutputFormatter.class);
private final @NotNull HiveMQRestService hiveMQRestService = mock();
private final @NotNull OutputFormatter outputFormatter = mock();
private final @NotNull DataHubScriptsApi scriptsApi = mock(DataHubScriptsApi.class);

private final @NotNull CommandLine commandLine =
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,9 +39,9 @@

public class ScriptListCommandTest {

private final @NotNull HiveMQRestService hiveMQRestService = mock(HiveMQRestService.class);
private final @NotNull OutputFormatter outputFormatter = mock(OutputFormatter.class);
private final @NotNull DataHubScriptsApi scriptsApi = mock(DataHubScriptsApi.class);
private final @NotNull HiveMQRestService hiveMQRestService = mock();
private final @NotNull OutputFormatter outputFormatter = mock();
private final @NotNull DataHubScriptsApi scriptsApi = mock();

private final @NotNull CommandLine commandLine =
new CommandLine(new ScriptListCommand(hiveMQRestService, outputFormatter));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
public class BehaviorPolicyCreateTaskTest {

private final @NotNull DataHubBehaviorPoliciesApi behaviorPoliciesApi = mock(DataHubBehaviorPoliciesApi.class);
private final @NotNull OutputFormatter outputFormatter = mock(OutputFormatter.class);
private final @NotNull OutputFormatter outputFormatter = mock();
private final @NotNull ArgumentCaptor<BehaviorPolicy> policyCaptor = ArgumentCaptor.forClass(BehaviorPolicy.class);
private final @NotNull Gson gson = new Gson();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
public class BehaviorPolicyDeleteTaskTest {

private final @NotNull DataHubBehaviorPoliciesApi behaviorPoliciesApi = mock(DataHubBehaviorPoliciesApi.class);
private final @NotNull OutputFormatter outputFormatter = mock(OutputFormatter.class);
private final @NotNull OutputFormatter outputFormatter = mock();

private static final @NotNull String POLICY_ID = "policy-1";

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
public class BehaviorPolicyGetTaskTest {

private final @NotNull DataHubBehaviorPoliciesApi behaviorPoliciesApi = mock(DataHubBehaviorPoliciesApi.class);
private final @NotNull OutputFormatter outputFormatter = mock(OutputFormatter.class);
private final @NotNull OutputFormatter outputFormatter = mock();

private static final @NotNull String POLICY_ID = "policy-1";

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@
public class BehaviorPolicyListTaskTest {

private final @NotNull DataHubBehaviorPoliciesApi behaviorPoliciesApi = mock(DataHubBehaviorPoliciesApi.class);
private final @NotNull OutputFormatter outputFormatter = mock(OutputFormatter.class);
private final @NotNull OutputFormatter outputFormatter = mock();

@Test
void execute_policyIdsProvided_usedAsUrlParameter() throws ApiException {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@
public class BehaviorPolicyUpdateTaskTest {

private final @NotNull DataHubBehaviorPoliciesApi behaviorPoliciesApi = mock(DataHubBehaviorPoliciesApi.class);
private final @NotNull OutputFormatter outputFormatter = mock(OutputFormatter.class);
private final @NotNull OutputFormatter outputFormatter = mock();
private final @NotNull ArgumentCaptor<BehaviorPolicy> policyCaptor = ArgumentCaptor.forClass(BehaviorPolicy.class);
private final @NotNull Gson gson = new Gson();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
public class GetBehaviorStateTaskTest {

private final @NotNull DataHubStateApi stateApi = mock(DataHubStateApi.class);
private final @NotNull OutputFormatter outputFormatter = mock(OutputFormatter.class);
private final @NotNull OutputFormatter outputFormatter = mock();

private static final @NotNull String CLIENT_ID = "client-1";

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
public class DataPolicyCreateTaskTest {

private final @NotNull DataHubDataPoliciesApi dataPoliciesApi = mock(DataHubDataPoliciesApi.class);
private final @NotNull OutputFormatter outputFormatter = mock(OutputFormatter.class);
private final @NotNull OutputFormatter outputFormatter = mock();
private final @NotNull ArgumentCaptor<DataPolicy> policyCaptor = ArgumentCaptor.forClass(DataPolicy.class);
private final @NotNull Gson gson = new Gson();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
public class DataPolicyDeleteTaskTest {

private final @NotNull DataHubDataPoliciesApi dataPoliciesApi = mock(DataHubDataPoliciesApi.class);
private final @NotNull OutputFormatter outputFormatter = mock(OutputFormatter.class);
private final @NotNull OutputFormatter outputFormatter = mock();

private static final @NotNull String POLICY_ID = "policy-1";

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
public class DataPolicyGetTaskTest {

private final @NotNull DataHubDataPoliciesApi dataPoliciesApi = mock(DataHubDataPoliciesApi.class);
private final @NotNull OutputFormatter outputFormatter = mock(OutputFormatter.class);
private final @NotNull OutputFormatter outputFormatter = mock();

private static final @NotNull String POLICY_ID = "policy-1";

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@
public class DataPolicyListTaskTest {

private final @NotNull DataHubDataPoliciesApi dataPoliciesApi = mock(DataHubDataPoliciesApi.class);
private final @NotNull OutputFormatter outputFormatter = mock(OutputFormatter.class);
private final @NotNull OutputFormatter outputFormatter = mock();

@Test
void execute_policyIdsProvided_usedAsUrlParameter() throws ApiException {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@
public class DataPolicyUpdateTaskTest {

private final @NotNull DataHubDataPoliciesApi dataPoliciesApi = mock(DataHubDataPoliciesApi.class);
private final @NotNull OutputFormatter outputFormatter = mock(OutputFormatter.class);
private final @NotNull OutputFormatter outputFormatter = mock();
private final @NotNull ArgumentCaptor<DataPolicy> policyCaptor = ArgumentCaptor.forClass(DataPolicy.class);
private final @NotNull Gson gson = new Gson();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,8 @@

public class CreateSchemaTaskTest {

private final @NotNull DataHubSchemasApi schemasApi = mock(DataHubSchemasApi.class);
private final @NotNull OutputFormatter outputFormatter = mock(OutputFormatter.class);
private final @NotNull DataHubSchemasApi schemasApi = mock();
private final @NotNull OutputFormatter outputFormatter = mock();

@SuppressWarnings("FieldCanBeLocal")
private final @NotNull String JSON_SCHEMA_DEFINITION = "{ \"type\": \"object\" }";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,8 @@

public class DeleteSchemaTaskTest {

private final @NotNull DataHubSchemasApi schemasApi = mock(DataHubSchemasApi.class);
private final @NotNull OutputFormatter outputFormatter = mock(OutputFormatter.class);
private final @NotNull DataHubSchemasApi schemasApi = mock();
private final @NotNull OutputFormatter outputFormatter = mock();

private static final @NotNull String SCHEMA_ID = "schema-1";

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,8 @@

public class GetSchemaTaskTest {

private final @NotNull DataHubSchemasApi schemasApi = mock(DataHubSchemasApi.class);
private final @NotNull OutputFormatter outputFormatter = mock(OutputFormatter.class);
private final @NotNull DataHubSchemasApi schemasApi = mock();
private final @NotNull OutputFormatter outputFormatter = mock();

@Test
void execute_schemaFound_printSchema() throws ApiException {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,8 @@

public class ListSchemasTaskTest {

private final @NotNull DataHubSchemasApi schemasApi = mock(DataHubSchemasApi.class);
private final @NotNull OutputFormatter outputFormatter = mock(OutputFormatter.class);
private final @NotNull DataHubSchemasApi schemasApi = mock();
private final @NotNull OutputFormatter outputFormatter = mock();

@Test
void execute_schemaIdsProvided_usedAsUrlParameter() throws ApiException {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
import org.mockito.ArgumentCaptor;

import java.nio.ByteBuffer;
import java.util.Base64;

import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertFalse;
Expand All @@ -41,7 +42,7 @@
public class CreateScriptTaskTest {

private final @NotNull DataHubScriptsApi scriptsApi = mock(DataHubScriptsApi.class);
private final @NotNull OutputFormatter outputFormatter = mock(OutputFormatter.class);
private final @NotNull OutputFormatter outputFormatter = mock();

@SuppressWarnings("FieldCanBeLocal")
private final @NotNull String SCRIPT_DEFINITION = "function transform(person) { return 'hello ' + person }";
Expand Down Expand Up @@ -70,7 +71,7 @@ void execute_validScript_created() throws ApiException {
assertEquals("script-1", createdScript.getId());
assertEquals("TRANSFORMATION", createdScript.getFunctionType());
assertEquals("Sample Script", createdScript.getDescription());
final String createdScriptDefinition = new String(java.util.Base64.getDecoder().decode(createdScript.getSource()));
final String createdScriptDefinition = new String(Base64.getDecoder().decode(createdScript.getSource()));
assertEquals(SCRIPT_DEFINITION, createdScriptDefinition);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
public class DeleteScriptTaskTest {

private final @NotNull DataHubScriptsApi scriptsApi = mock(DataHubScriptsApi.class);
private final @NotNull OutputFormatter outputFormatter = mock(OutputFormatter.class);
private final @NotNull OutputFormatter outputFormatter = mock();

private static final @NotNull String SCRIPT_ID = "script-1";

Expand Down
Loading

0 comments on commit 7549748

Please sign in to comment.