Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Change asserts + clean client builder code #48

Merged
merged 1 commit into from
Sep 18, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
@Buildable(editableEnabled = false, builderPackage = "io.fabric8.kubernetes.api.builder")
public class StrimziKafkaClients extends BaseClients {
private static final Logger LOGGER = LogManager.getLogger(StrimziKafkaClients.class);
private static Random rng = new Random();
private static final Random RNG = new Random();

private String producerName;
private String consumerName;
Expand Down Expand Up @@ -295,7 +295,7 @@ public JobBuilder defaultConsumerStrimzi() {
consumerLabels.put(TestConstants.STRIMZI_TEST_CLIENTS_LABEL_KEY, TestConstants.STRIMZI_TEST_CLIENTS_LABEL_VALUE);


final JobBuilder builder = new JobBuilder()
return new JobBuilder()
.withNewMetadata()
.withNamespace(this.getNamespaceName())
.withLabels(consumerLabels)
Expand Down Expand Up @@ -351,8 +351,6 @@ public JobBuilder defaultConsumerStrimzi() {
.endSpec()
.endTemplate()
.endSpec();

return builder;
}

private EnvVar getClusterCaCertEnv(String clusterName) {
Expand Down Expand Up @@ -410,7 +408,7 @@ protected List<EnvVar> getTlsEnvVars() {
* @return consumer group name with pattern: my-consumer-group-*-*
*/
private static String generateRandomConsumerGroup() {
int salt = rng.nextInt(Integer.MAX_VALUE);
int salt = RNG.nextInt(Integer.MAX_VALUE);

return "my-group" + salt;
}
Expand Down
7 changes: 3 additions & 4 deletions src/test/java/io/streams/unit/SqlWithTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,8 @@

import java.util.HashMap;
import java.util.Map;
import java.util.Objects;

import static org.junit.jupiter.api.Assertions.assertTrue;
import static org.junit.jupiter.api.Assertions.assertEquals;

public class SqlWithTest {
@Test
Expand All @@ -38,7 +37,7 @@ void testCreateTableWithFilesystemConnector() {
.withAdditionalProperties(additionalProperties)
.build();

assertTrue(Objects.equals(sqlWith.generateSql(), expectedSql));
assertEquals(sqlWith.generateSql(), expectedSql);
}

@Test
Expand Down Expand Up @@ -77,6 +76,6 @@ void testCreateTableWithKafkaConnector() {
.withAdditionalProperties(additionalProperties)
.build();

assertTrue(Objects.equals(sqlWith.generateSql(), expectedSql));
assertEquals(sqlWith.generateSql(), expectedSql);
}
}