11/*
2- Copyright IBM Corp. 2016 All Rights Reserved.
2+ Copyright IBM Corp. All Rights Reserved.
33
4- Licensed under the Apache License, Version 2.0 (the "License");
5- you may not use this file except in compliance with the License.
6- You may obtain a copy of the License at
7-
8- http://www.apache.org/licenses/LICENSE-2.0
9-
10- Unless required by applicable law or agreed to in writing, software
11- distributed under the License is distributed on an "AS IS" BASIS,
12- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13- See the License for the specific language governing permissions and
14- limitations under the License.
4+ SPDX-License-Identifier: Apache-2.0
155*/
166
177package kafka
@@ -20,23 +10,19 @@ import (
2010 "testing"
2111
2212 "github.com/Shopify/sarama"
23- "github.com/hyperledger/fabric/common/configtx/tool/provisional "
13+ "github.com/stretchr/testify/assert "
2414)
2515
2616func TestStaticPartitioner (t * testing.T ) {
2717 var partition int32 = 3
2818 var numberOfPartitions int32 = 6
2919
3020 partitionerConstructor := newStaticPartitioner (partition )
31- partitioner := partitionerConstructor (provisional . TestChainID )
21+ partitioner := partitionerConstructor ("channelFoo" )
3222
3323 for i := 0 ; i < 10 ; i ++ {
3424 assignedPartition , err := partitioner .Partition (new (sarama.ProducerMessage ), numberOfPartitions )
35- if err != nil {
36- t .Fatal ("Partitioner not functioning as expected:" , err )
37- }
38- if assignedPartition != partition {
39- t .Fatalf ("Partitioner not returning the expected partition - expected %d, got %v" , partition , assignedPartition )
40- }
25+ assert .NoError (t , err , "Partitioner not functioning as expected:" , err )
26+ assert .Equal (t , partition , assignedPartition , "Partitioner not returning the expected partition - expected %d, got %v" , partition , assignedPartition )
4127 }
4228}
0 commit comments