1
1
/*
2
- Copyright IBM Corp. 2016 All Rights Reserved.
2
+ Copyright IBM Corp. All Rights Reserved.
3
3
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
15
5
*/
16
6
17
7
package kafka
@@ -20,23 +10,19 @@ import (
20
10
"testing"
21
11
22
12
"github.com/Shopify/sarama"
23
- "github.com/hyperledger/fabric/common/configtx/tool/provisional "
13
+ "github.com/stretchr/testify/assert "
24
14
)
25
15
26
16
func TestStaticPartitioner (t * testing.T ) {
27
17
var partition int32 = 3
28
18
var numberOfPartitions int32 = 6
29
19
30
20
partitionerConstructor := newStaticPartitioner (partition )
31
- partitioner := partitionerConstructor (provisional . TestChainID )
21
+ partitioner := partitionerConstructor ("channelFoo" )
32
22
33
23
for i := 0 ; i < 10 ; i ++ {
34
24
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 )
41
27
}
42
28
}
0 commit comments