Skip to content

Commit 03c365e

Browse files
committed
Add test for SimplePartitioner
1 parent 2e4a2ad commit 03c365e

File tree

1 file changed

+45
-0
lines changed

1 file changed

+45
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
/*
2+
* Copyright 2021 the original author or authors.
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+
* https://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.
15+
*/
16+
package org.springframework.batch.core.partition.support;
17+
18+
import java.util.Map;
19+
20+
import org.junit.Assert;
21+
import org.junit.Test;
22+
23+
import org.springframework.batch.item.ExecutionContext;
24+
25+
/**
26+
* @author Mahmoud Ben Hassine
27+
*/
28+
public class SimplePartitionerTests {
29+
30+
@Test
31+
public void testPartition() {
32+
// given
33+
SimplePartitioner partitioner = new SimplePartitioner();
34+
35+
// when
36+
Map<String, ExecutionContext> partitions = partitioner.partition(3);
37+
38+
// then
39+
Assert.assertNotNull(partitions);
40+
Assert.assertEquals(3, partitions.size());
41+
Assert.assertNotNull(partitions.get("partition0"));
42+
Assert.assertNotNull(partitions.get("partition1"));
43+
Assert.assertNotNull(partitions.get("partition2"));
44+
}
45+
}

0 commit comments

Comments
 (0)