From 72b95c9c3322d932e31a81a921df24860c4800e3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sergio=20Pe=C3=B1a?= Date: Thu, 10 Oct 2019 09:40:19 -0500 Subject: [PATCH] fix: replace assertEquals for assertThat --- .../ksql/rest/entity/ServerClusterId.java | 5 +++++ .../ksql/rest/entity/ServerClusterIdTest.java | 14 ++++++++------ 2 files changed, 13 insertions(+), 6 deletions(-) diff --git a/ksql-rest-model/src/main/java/io/confluent/ksql/rest/entity/ServerClusterId.java b/ksql-rest-model/src/main/java/io/confluent/ksql/rest/entity/ServerClusterId.java index 0a5c2352fbd3..70f2f6f70a75 100644 --- a/ksql-rest-model/src/main/java/io/confluent/ksql/rest/entity/ServerClusterId.java +++ b/ksql-rest-model/src/main/java/io/confluent/ksql/rest/entity/ServerClusterId.java @@ -31,6 +31,9 @@ public final class ServerClusterId { private static final String KAFKA_CLUSTER = "kafka-cluster"; private static final String KSQL_CLUSTER = "ksql-cluster"; + // ID is unused for now, but it might be used later to include a URL that joins both, kafka and + // ksql, clusters names into one single string. This one URL string will be easier to pass + // through authorization commands to authorize access to this KSQL cluster. private static final String id = ""; private final Map scope; @@ -43,6 +46,8 @@ public final class ServerClusterId { public static ServerClusterId of(final String kafkaClusterId, final String ksqlClusterId) { return new ServerClusterId(ImmutableMap.of( + // 'path' is unused for now, but it might be used by Cloud environments that specify + // which account organization this cluster belongs to. "path", Collections.emptyList(), "clusters", ImmutableMap.of( KAFKA_CLUSTER, kafkaClusterId, diff --git a/ksql-rest-model/src/test/java/io/confluent/ksql/rest/entity/ServerClusterIdTest.java b/ksql-rest-model/src/test/java/io/confluent/ksql/rest/entity/ServerClusterIdTest.java index 3fec9881d256..1c569367117d 100644 --- a/ksql-rest-model/src/test/java/io/confluent/ksql/rest/entity/ServerClusterIdTest.java +++ b/ksql-rest-model/src/test/java/io/confluent/ksql/rest/entity/ServerClusterIdTest.java @@ -15,7 +15,9 @@ package io.confluent.ksql.rest.entity; -import static org.junit.Assert.assertEquals; +import static org.hamcrest.Matchers.equalTo; +import static org.hamcrest.Matchers.is; +import static org.junit.Assert.assertThat; import com.google.common.collect.ImmutableMap; @@ -34,15 +36,15 @@ public void shouldReturnServerClusterId() { final Map scope = serverClusterId.getScope(); // Then: - assertEquals("", id); - assertEquals( - ImmutableMap.of( + assertThat(id, is("")); + assertThat( + scope, + equalTo(ImmutableMap.of( "path", Collections.emptyList(), "clusters", ImmutableMap.of( "kafka-cluster", "kafka1", "ksql-cluster", "ksql1") - ), - scope + )) ); } }