### Question:
BaseTransactionalExecutor implements Executor<T> { protected String buildLockKey(TableRecords rowsIncludingPK) { if (rowsIncludingPK.size() == 0) { return null; } StringBuilder sb = new StringBuilder(); sb.append(rowsIncludingPK.getTableMeta().getTableName()); sb.append(":"); int filedSequence = 0; List<Map<String, Field>> pksRows = rowsIncludingPK.pkRows(); for (Map<String, Field> rowMap : pksRows) { int pkSplitIndex = 0; for (String pkName : getTableMeta().getPrimaryKeyOnlyName()) { if (pkSplitIndex > 0) { sb.append("_"); } sb.append(rowMap.get(pkName).getValue()); pkSplitIndex++; } filedSequence++; if (filedSequence < pksRows.size()) { sb.append(","); } } return sb.toString(); } BaseTransactionalExecutor(StatementProxy<S> statementProxy, StatementCallback<T, S> statementCallback,
                                     SQLRecognizer sqlRecognizer);  BaseTransactionalExecutor(StatementProxy<S> statementProxy, StatementCallback<T, S> statementCallback,
                                     List<SQLRecognizer> sqlRecognizers); @Override T execute(Object... args);  }### Answer:
@Test public void testBuildLockKey() { String tableName = "test_name"; String fieldOne = "1"; String fieldTwo = "2"; String split1 = ":"; String split2 = ","; String pkColumnName="id"; String buildLockKeyExpect = tableName + split1 + fieldOne + split2 + fieldTwo; Field field1 = mock(Field.class); when(field1.getValue()).thenReturn(fieldOne); Field field2 = mock(Field.class); when(field2.getValue()).thenReturn(fieldTwo); List<Map<String,Field>> pkRows =new ArrayList<>(); pkRows.add(Collections.singletonMap(pkColumnName, field1)); pkRows.add(Collections.singletonMap(pkColumnName, field2)); TableMeta tableMeta = mock(TableMeta.class); when(tableMeta.getTableName()).thenReturn(tableName); when(tableMeta.getPrimaryKeyOnlyName()).thenReturn(Arrays.asList(new String[]{pkColumnName})); TableRecords tableRecords = mock(TableRecords.class); when(tableRecords.getTableMeta()).thenReturn(tableMeta); when(tableRecords.size()).thenReturn(pkRows.size()); when(tableRecords.pkRows()).thenReturn(pkRows); BaseTransactionalExecutor executor = mock(BaseTransactionalExecutor.class); when(executor.buildLockKey(tableRecords)).thenCallRealMethod(); when(executor.getTableMeta()).thenReturn(tableMeta); assertThat(executor.buildLockKey(tableRecords)).isEqualTo(buildLockKeyExpect); }