Skip to content

Commit 65add0c

Browse files
committed
Replacing mocks of TabletId with TabletId.of()
Using the TabletId.of() method created in PR #5678, replaced instances of TabletId mocks in ConstraintCheckerTest.java. Closes #5705
1 parent 7b20789 commit 65add0c

1 file changed

Lines changed: 2 additions & 6 deletions

File tree

server/tserver/src/test/java/org/apache/accumulo/tserver/constraints/ConstraintCheckerTest.java

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -34,10 +34,10 @@
3434

3535
import org.apache.accumulo.core.data.ConstraintViolationSummary;
3636
import org.apache.accumulo.core.data.Mutation;
37+
import org.apache.accumulo.core.data.TableId;
3738
import org.apache.accumulo.core.data.TabletId;
3839
import org.apache.accumulo.core.data.constraints.Constraint;
3940
import org.apache.accumulo.core.data.constraints.Constraint.Environment;
40-
import org.apache.hadoop.io.Text;
4141
import org.junit.jupiter.api.BeforeEach;
4242
import org.junit.jupiter.api.Test;
4343

@@ -46,7 +46,6 @@ public class ConstraintCheckerTest {
4646
private ConstraintChecker cc;
4747
private ArrayList<Constraint> constraints;
4848
private Environment env;
49-
private TabletId tabletId;
5049
private Mutation m;
5150
private Mutation m2;
5251

@@ -57,13 +56,11 @@ public void setup() throws SecurityException {
5756
expect(cc.getConstraints()).andReturn(constraints);
5857

5958
env = createMock(Environment.class);
60-
tabletId = createMock(TabletId.class);
59+
TabletId tabletId = TabletId.of(TableId.of("id"), "d", "a");
6160
expect(env.getTablet()).andReturn(tabletId);
6261

6362
m = createMock(Mutation.class);
6463
m2 = createMock(Mutation.class);
65-
expect(tabletId.getEndRow()).andReturn(new Text("d")).anyTimes();
66-
expect(tabletId.getPrevEndRow()).andReturn(new Text("a")).anyTimes();
6764
expect(m.getRow()).andReturn("b".getBytes(UTF_8)).anyTimes();
6865
expect(m2.getRow()).andReturn("z".getBytes(UTF_8)).anyTimes();
6966
}
@@ -88,7 +85,6 @@ private Constraint makeFailureConstraint() {
8885
}
8986

9087
private void replayAll() {
91-
replay(tabletId);
9288
replay(env);
9389
replay(cc);
9490
replay(m);

0 commit comments

Comments
 (0)