### Question:
SplitTransaction { public boolean prepare() { if (!this.parent.isSplittable()) return false; if (this.splitrow == null) return false; HRegionInfo hri = this.parent.getRegionInfo(); parent.prepareToSplit(); byte [] startKey = hri.getStartKey(); byte [] endKey = hri.getEndKey(); if (Bytes.equals(startKey, splitrow) || !this.parent.getRegionInfo().containsRow(splitrow)) { LOG.info("Split row is not inside region key range or is equal to " + "startkey: " + Bytes.toStringBinary(this.splitrow)); return false; } long rid = getDaughterRegionIdTimestamp(hri); this.hri_a = new HRegionInfo(hri.getTableName(), startKey, this.splitrow, false, rid); this.hri_b = new HRegionInfo(hri.getTableName(), this.splitrow, endKey, false, rid); return true; } SplitTransaction(final HRegion r, final byte [] splitrow); boolean prepare(); PairOfSameType<HRegion> execute(final Server server,
      final RegionServerServices services); boolean rollback(final Server server, final RegionServerServices services);  }### Answer:
@Test public void testPrepare() throws IOException { prepareGOOD_SPLIT_ROW(); }
@Test public void testPrepareWithRegionsWithReference() throws IOException { StoreFile storeFileMock = Mockito.mock(StoreFile.class); when(storeFileMock.isReference()).thenReturn(true); Store storeMock = Mockito.mock(Store.class); List<StoreFile> storeFileList = new ArrayList<StoreFile>(1); storeFileList.add(storeFileMock); when(storeMock.getStorefiles()).thenReturn(storeFileList); when(storeMock.close()).thenReturn(ImmutableList.copyOf(storeFileList)); this.parent.stores.put(Bytes.toBytes(""), storeMock); SplitTransaction st = new SplitTransaction(this.parent, GOOD_SPLIT_ROW); assertFalse("a region should not be splittable if it has instances of store file references", st.prepare()); }
@Test public void testPrepareWithBadSplitRow() throws IOException { SplitTransaction st = new SplitTransaction(this.parent, STARTROW); assertFalse(st.prepare()); st = new SplitTransaction(this.parent, HConstants.EMPTY_BYTE_ARRAY); assertFalse(st.prepare()); st = new SplitTransaction(this.parent, new byte [] {'A', 'A', 'A'}); assertFalse(st.prepare()); st = new SplitTransaction(this.parent, ENDROW); assertFalse(st.prepare()); }
@Test public void testPrepareWithClosedRegion() throws IOException { this.parent.close(); SplitTransaction st = new SplitTransaction(this.parent, GOOD_SPLIT_ROW); assertFalse(st.prepare()); }