Skip to content

Commit

Permalink
Change asserts + clean client builder code (#48)
Browse files Browse the repository at this point in the history
Signed-off-by: David Kornel <[email protected]>
  • Loading branch information
kornys authored Sep 18, 2024
1 parent 2e46b87 commit 85efcef
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 9 deletions.
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);
}
}

0 comments on commit 85efcef

Please sign in to comment.