You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@rocketmq.apache.org by vo...@apache.org on 2017/08/29 08:12:37 UTC
incubator-rocketmq git commit: Remove and Polish unstable UT
Repository: incubator-rocketmq
Updated Branches:
refs/heads/develop 38d70bd54 -> c0e4c3fde
Remove and Polish unstable UT
Project: http://git-wip-us.apache.org/repos/asf/incubator-rocketmq/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-rocketmq/commit/c0e4c3fd
Tree: http://git-wip-us.apache.org/repos/asf/incubator-rocketmq/tree/c0e4c3fd
Diff: http://git-wip-us.apache.org/repos/asf/incubator-rocketmq/diff/c0e4c3fd
Branch: refs/heads/develop
Commit: c0e4c3fdea853ab4339e2640384c1e88dbf6b702
Parents: 38d70bd
Author: vongosling <vo...@apache.org>
Authored: Tue Aug 29 16:12:25 2017 +0800
Committer: vongosling <vo...@apache.org>
Committed: Tue Aug 29 16:12:25 2017 +0800
----------------------------------------------------------------------
.../rocketmq/common/filter/FilterAPITest.java | 25 ++++-----
.../common/protocol/route/BrokerDataTest.java | 57 --------------------
2 files changed, 9 insertions(+), 73 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-rocketmq/blob/c0e4c3fd/common/src/test/java/org/apache/rocketmq/common/filter/FilterAPITest.java
----------------------------------------------------------------------
diff --git a/common/src/test/java/org/apache/rocketmq/common/filter/FilterAPITest.java b/common/src/test/java/org/apache/rocketmq/common/filter/FilterAPITest.java
index 81ed971..73ab09e 100644
--- a/common/src/test/java/org/apache/rocketmq/common/filter/FilterAPITest.java
+++ b/common/src/test/java/org/apache/rocketmq/common/filter/FilterAPITest.java
@@ -17,11 +17,12 @@
package org.apache.rocketmq.common.filter;
-import java.util.HashSet;
-import java.util.Set;
import org.apache.rocketmq.common.protocol.heartbeat.SubscriptionData;
import org.junit.Test;
+import java.util.HashSet;
+import java.util.Set;
+
import static org.assertj.core.api.Assertions.assertThat;
public class FilterAPITest {
@@ -32,7 +33,7 @@ public class FilterAPITest {
@Test
public void testBuildSubscriptionData() throws Exception {
SubscriptionData subscriptionData =
- FilterAPI.buildSubscriptionData(group, topic, subString);
+ FilterAPI.buildSubscriptionData(group, topic, subString);
assertThat(subscriptionData.getTopic()).isEqualTo(topic);
assertThat(subscriptionData.getSubString()).isEqualTo(subString);
String[] tags = subString.split("\\|\\|");
@@ -47,7 +48,7 @@ public class FilterAPITest {
public void testBuildTagSome() {
try {
SubscriptionData subscriptionData = FilterAPI.build(
- "TOPIC", "A || B", ExpressionType.TAG
+ "TOPIC", "A || B", ExpressionType.TAG
);
assertThat(subscriptionData).isNotNull();
@@ -67,7 +68,7 @@ public class FilterAPITest {
public void testBuildSQL() {
try {
SubscriptionData subscriptionData = FilterAPI.build(
- "TOPIC", "a is not null", ExpressionType.SQL92
+ "TOPIC", "a is not null", ExpressionType.SQL92
);
assertThat(subscriptionData).isNotNull();
@@ -79,16 +80,8 @@ public class FilterAPITest {
}
}
- @Test
- public void testBuildSQLWithNullSubString() {
- try {
- FilterAPI.build(
- "TOPIC", null, ExpressionType.SQL92
- );
-
- assertThat(Boolean.FALSE).isTrue();
- } catch (Exception e) {
- e.printStackTrace();
- }
+ @Test(expected = IllegalArgumentException.class)
+ public void testBuildSQLWithNullSubString() throws Exception {
+ FilterAPI.build("TOPIC", null, ExpressionType.SQL92);
}
}
http://git-wip-us.apache.org/repos/asf/incubator-rocketmq/blob/c0e4c3fd/common/src/test/java/org/apache/rocketmq/common/protocol/route/BrokerDataTest.java
----------------------------------------------------------------------
diff --git a/common/src/test/java/org/apache/rocketmq/common/protocol/route/BrokerDataTest.java b/common/src/test/java/org/apache/rocketmq/common/protocol/route/BrokerDataTest.java
deleted file mode 100644
index 97da458..0000000
--- a/common/src/test/java/org/apache/rocketmq/common/protocol/route/BrokerDataTest.java
+++ /dev/null
@@ -1,57 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.rocketmq.common.protocol.route;
-
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.List;
-import org.junit.Assert;
-import org.junit.BeforeClass;
-import org.junit.Test;
-
-/**
- * BrokerData tests.
- */
-public class BrokerDataTest {
- private static BrokerData brokerData;
-
- @BeforeClass
- public static void prepare() {
- brokerData = new BrokerData("testCluster", "testBroker",
- new HashMap<Long, String>() {{
- put(1L, "addr1");
- put(2L, "addr2");
- put(3L, "addr3");
- }});
- }
-
- @Test
- public void selectBrokerAddr() throws Exception {
- List<String> selectedAddr = new ArrayList<String>();
-
- for (int i = 0; i < 5; i++)
- selectedAddr.add(brokerData.selectBrokerAddr());
-
- List<String> firstElemList = new ArrayList<String>();
-
- for (int i = 0; i < 5; i++)
- firstElemList.add(selectedAddr.get(0));
-
- Assert.assertFalse("Contains same addresses", selectedAddr.equals(firstElemList));
- }
-}