focal_method stringlengths 13 60.9k | test_case stringlengths 25 109k |
|---|---|
@Override
public String get(String url, String path) throws RestClientException {
return get(url, path, String.class);
} | @Test
public void testGet() throws Exception {
String str = restClientTemplate.get("http://localhost:9990", "/api", String.class);
System.out.println(str);
assertNotNull(str);
} |
public void check( List<CheckResultInterface> remarks, TransMeta transMeta, StepMeta stepinfo, RowMetaInterface prev,
String[] input, String[] output, RowMetaInterface info, VariableSpace space, Repository repository,
IMetaStore metaStore ) {
CheckResult cr;
// Check output fields
if ( prev != ... | @Test
public void testCheck() throws Exception {
XMLOutputMeta xmlOutputMeta = new XMLOutputMeta();
xmlOutputMeta.setDefault();
TransMeta transMeta = mock( TransMeta.class );
StepMeta stepInfo = mock( StepMeta.class );
RowMetaInterface prev = mock( RowMetaInterface.class );
Repository repos = ... |
@Override
public void createFunction(SqlInvokedFunction function, boolean replace)
{
checkCatalog(function);
checkFunctionLanguageSupported(function);
checkArgument(!function.hasVersion(), "function '%s' is already versioned", function);
QualifiedObjectName functionName = functi... | @Test(expectedExceptions = PrestoException.class, expectedExceptionsMessageRegExp = "Error getting FunctionMetadata for handle: unittest\\.memory\\.power_tower\\(double\\):2")
public void testInvalidFunctionHandle()
{
createFunction(FUNCTION_POWER_TOWER_DOUBLE, true);
SqlFunctionHandle functionH... |
@Override
public List<PinotTaskConfig> generateTasks(List<TableConfig> tableConfigs) {
String taskType = MinionConstants.UpsertCompactionTask.TASK_TYPE;
List<PinotTaskConfig> pinotTaskConfigs = new ArrayList<>();
for (TableConfig tableConfig : tableConfigs) {
if (!validate(tableConfig)) {
LO... | @Test
public void testGenerateTasksWithConsumingSegment() {
SegmentZKMetadata consumingSegment = new SegmentZKMetadata("testTable__0");
consumingSegment.setStatus(CommonConstants.Segment.Realtime.Status.IN_PROGRESS);
when(_mockClusterInfoAccessor.getSegmentsZKMetadata(REALTIME_TABLE_NAME)).thenReturn(
... |
@Override
public ReadBufferResult readBuffer(
TieredStoragePartitionId partitionId,
TieredStorageSubpartitionId subpartitionId,
int segmentId,
int bufferIndex,
MemorySegment memorySegment,
BufferRecycler recycler,
@Nullable ReadProg... | @Test
void testReadProgress() throws IOException {
long currentFileOffset = 0;
ProducerMergedPartitionFileReader.ProducerMergedReadProgress readProgress = null;
CompositeBuffer partialBuffer = null;
for (int bufferIndex = 0; bufferIndex < DEFAULT_BUFFER_NUMBER; ) {
Partit... |
@Udf(description = "Returns all substrings of the input that matches the given regex pattern")
public List<String> regexpExtractAll(
@UdfParameter(description = "The regex pattern") final String pattern,
@UdfParameter(description = "The input string to apply regex on") final String input
) {
return ... | @Test
public void shouldReturnNullOnNullValue() {
assertNull(udf.regexpExtractAll(null, null));
assertNull(udf.regexpExtractAll(null, null, null));
assertNull(udf.regexpExtractAll(null, "", 1));
assertNull(udf.regexpExtractAll("some string", null, 1));
assertNull(udf.regexpExtractAll("some string"... |
@Override
public void asyncGetCursorInfo(String ledgerName, String cursorName,
MetaStoreCallback<ManagedCursorInfo> callback) {
String path = PREFIX + ledgerName + "/" + cursorName;
if (log.isDebugEnabled()) {
log.debug("Reading from {}", path);
}
store.get(p... | @Test(timeOut = 20000)
void readMalformedCursorNode() throws Exception {
MetaStore store = new MetaStoreImpl(metadataStore, executor);
metadataStore.put("/managed-ledgers/my_test", "".getBytes(), Optional.empty()).join();
metadataStore.put("/managed-ledgers/my_test/c1", "non-valid".getBytes... |
public SearchSourceBuilder create(SearchesConfig config) {
return create(SearchCommand.from(config));
} | @Test
void searchIncludesTimerange() {
final SearchSourceBuilder search = this.searchRequestFactory.create(ChunkCommand.builder()
.indices(Collections.singleton("graylog_0"))
.range(RANGE)
.build());
assertJsonPath(search, request -> {
req... |
@Nonnull
public static Number rem(@Nonnull Number first, @Nonnull Number second) {
// Check for widest types first, go down the type list to narrower types until reaching int.
if (second instanceof Double || first instanceof Double) {
return first.doubleValue() % second.doubleValue();
} else if (second instan... | @Test
void testRem() {
assertEquals(4, NumberUtil.rem(13, 9));
assertEquals(4D, NumberUtil.rem(13, 9.0D));
assertEquals(4F, NumberUtil.rem(13, 9.0F));
assertEquals(4L, NumberUtil.rem(13, 9L));
} |
public String toString(Object object) {
return toJson(object);
} | @Test
public void test2() {
TestBean testBean = new TestBean();
testBean.setDateTime(LocalDateTime.now());
System.out.println(JsonKit.toString(testBean));
} |
protected void setValues( JobEntryUnZip jobEntryUnZip, String zipFile, String destinationDirectory ) {
jobEntryUnZip.setZipFilename( zipFile );
jobEntryUnZip.setWildcardSource( "" );
jobEntryUnZip.setWildcardExclude( "" );
jobEntryUnZip.setSourceDirectory( destinationDirectory );
jobEntryUnZip.setM... | @Test
public void testSetValues() {
String destinationDirectory = "/tmp/some/path";
String zipFile = "/quotes/to/be/or/not/to/be/that/is/the/question.zip";
String empty = "";
JobEntryUnZip jobEntryUnZip = new JobEntryUnZip();
zipService.setValues( jobEntryUnZip, zipFile, destinationDirectory);
... |
public static Read read() {
return new Read(null, "", new Scan());
} | @Test
public void testReadingEmptyTable() throws Exception {
final String table = tmpTable.getName();
createTable(table);
runReadTest(
HBaseIO.read().withConfiguration(conf).withTableId(table), false, new ArrayList<>());
runReadTest(HBaseIO.read().withConfiguration(conf).withTableId(table), t... |
@Override
public Matrix clone()
{
return new Matrix(single.clone());
} | @Test
void testConstructionAndCopy() throws Exception
{
Matrix m1 = new Matrix();
assertMatrixIsPristine(m1);
Matrix m2 = m1.clone();
assertNotSame(m1, m2);
assertMatrixIsPristine(m2);
} |
@Nonnull
public <K, V> Consumer<K, V> newConsumer() {
return newConsumer(EMPTY_PROPERTIES);
} | @Test
public void should_create_new_consumer_for_each_call() {
kafkaDataConnection = createNonSharedKafkaDataConnection();
try (Consumer<Object, Object> c1 = kafkaDataConnection.newConsumer();
Consumer<Object, Object> c2 = kafkaDataConnection.newConsumer()) {
assertThat(c1)... |
@Override
public long recalculateRevision() {
return revision.addAndGet(1);
} | @Test
void testRecalculateRevisionAsync() throws InterruptedException {
assertEquals(0, connectionBasedClient.getRevision());
for (int i = 0; i < 10; i++) {
Thread thread = new Thread(() -> {
for (int j = 0; j < 10; j++) {
connectionBasedClient.recalcu... |
@Override
public List<String> getPartitionKeysByValue(String dbName, String tableName, List<Optional<String>> partitionValues) {
DatabaseTableName databaseTableName = DatabaseTableName.of(dbName, tableName);
HivePartitionValue hivePartitionValue = HivePartitionValue.of(databaseTableName, partitionVa... | @Test
public void testGetPartitionKeys() {
CachingHiveMetastore cachingHiveMetastore = new CachingHiveMetastore(
metastore, executor, expireAfterWriteSec, refreshAfterWriteSec, 1000, false);
Assert.assertEquals(Lists.newArrayList("col1"), cachingHiveMetastore.getPartitionKeysByValue(... |
public OpenAPI filter(OpenAPI openAPI, OpenAPISpecFilter filter, Map<String, List<String>> params, Map<String, String> cookies, Map<String, List<String>> headers) {
OpenAPI filteredOpenAPI = filterOpenAPI(filter, openAPI, params, cookies, headers);
if (filteredOpenAPI == null) {
return filte... | @Test(description = "it should change away with a new operation")
public void changeGetResources() throws IOException {
final OpenAPI openAPI = getOpenAPI(RESOURCE_PATH);
OpenAPI filter = new SpecFilter().filter(openAPI, new ChangeGetOperationsFilter(), null, null, null);
assertOperations(fi... |
public String build( final String cellValue ) {
switch ( type ) {
case FORALL:
return buildForAll( cellValue );
case INDEXED:
return buildMulti( cellValue );
default:
return buildSingle( cellValue );
}
} | @Test
public void testMultiPlaceHolderEscapedComma() {
final String snippet = "rulesOutputRouting.set( $1, $2, $3, $4, $5 );";
final SnippetBuilder snip = new SnippetBuilder(snippet);
final String result = snip.build("\"80\",\"Department Manager\",toa.getPersonExpense().getEntityCode(\"Part ... |
public Locality locality() {
return locality;
} | @Test
void localityCannotBeNull() {
Assertions.assertThrows(NullPointerException.class, () -> DefaultBot.getDefaultBuilder().locality(null).build());
} |
@Override
public BytesInput getBytes() {
// The Page Header should include: blockSizeInValues, numberOfMiniBlocks, totalValueCount
if (deltaValuesToFlush != 0) {
flushBlockBuffer();
}
return BytesInput.concat(
config.toBytesInput(),
BytesInput.fromUnsignedVarInt(totalValueCount),... | @Test
public void shouldSkipN() throws IOException {
int[] data = new int[5 * blockSize + 1];
for (int i = 0; i < data.length; i++) {
data[i] = i * 32;
}
writeData(data);
reader = new DeltaBinaryPackingValuesReader();
reader.initFromPage(100, writer.getBytes().toInputStream());
int s... |
@Override
public KsqlVersionMetrics collectMetrics() {
final KsqlVersionMetrics metricsRecord = new KsqlVersionMetrics();
metricsRecord.setTimestamp(TimeUnit.MILLISECONDS.toSeconds(clock.millis()));
metricsRecord.setConfluentPlatformVersion(AppInfo.getVersion());
metricsRecord.setKsqlComponentType(mod... | @Test
public void shouldSetActivenessToFalse() {
// Given:
when(activenessStatusSupplier.get()).thenReturn(false);
// When:
final KsqlVersionMetrics metrics = basicCollector.collectMetrics();
// Then:
assertThat(metrics.getIsActive(), is(false));
} |
@Override
public Set<V> removeAll(Object key) {
return (Set<V>) get(removeAllAsync(key));
} | @Test
public void testRemoveAll() {
RSetMultimap<SimpleKey, SimpleValue> map = redisson.getSetMultimap("test1");
map.put(new SimpleKey("0"), new SimpleValue("1"));
map.put(new SimpleKey("0"), new SimpleValue("2"));
map.put(new SimpleKey("0"), new SimpleValue("3"));
Set<Simpl... |
public static CopyFilter getCopyFilter(Configuration conf) {
String filtersClassName = conf
.get(DistCpConstants.CONF_LABEL_FILTERS_CLASS);
if (filtersClassName != null) {
try {
Class<? extends CopyFilter> filtersClass = conf
.getClassByName(filtersClassName)
... | @Test
public void testGetCopyFilterWrongClassType() throws Exception {
final String filterName =
"org.apache.hadoop.tools." +
"TestCopyFilter.FilterNotExtendingCopyFilter";
Configuration configuration = new Configuration(false);
configuration.set(DistCpConstants.CONF_LABEL_... |
public static boolean isNative(RunnerApi.PTransform pTransform) {
// TODO(https://github.com/apache/beam/issues/20192) Use default (context) classloader.
Iterator<IsNativeTransform> matchers =
ServiceLoader.load(IsNativeTransform.class, NativeTransforms.class.getClassLoader())
.iterator();
... | @Test
public void testMatch() {
Assert.assertTrue(
NativeTransforms.isNative(
RunnerApi.PTransform.newBuilder()
.setSpec(RunnerApi.FunctionSpec.newBuilder().setUrn("test").build())
.build()));
} |
@Override
public Object toKsqlRow(final Schema connectSchema, final Object connectData) {
if (connectData == null) {
return null;
}
return toKsqlValue(schema, connectSchema, connectData, "");
} | @Test
public void shouldThrowOnTypeMismatch() {
// Given:
final Schema schema = SchemaBuilder.struct()
.field("FIELD", SchemaBuilder.OPTIONAL_INT32_SCHEMA)
.optional()
.build();
final Schema badSchema = SchemaBuilder.struct()
.field("FIELD", SchemaBuilder.OPTIONAL_STRING_S... |
public String get(Component c) {
return get(Group.Alphabetic, c);
} | @Test
public void testValueOf() {
PersonName pn = new PersonName(
"Adams^John Robert Quincy^^Rev.^B.A. M.Div.");
assertEquals("Adams", pn.get(PersonName.Component.FamilyName));
assertEquals("John Robert Quincy", pn.get(PersonName.Component.GivenName));
assertEquals("R... |
public static Type fromHiveTypeToArrayType(String typeStr) {
if (HIVE_UNSUPPORTED_TYPES.stream().anyMatch(typeStr.toUpperCase()::contains)) {
return Type.UNKNOWN_TYPE;
}
Matcher matcher = Pattern.compile(ARRAY_PATTERN).matcher(typeStr.toLowerCase(Locale.ROOT));
Type itemType;... | @Test
public void testArrayString() {
ScalarType itemType = ScalarType.createType(PrimitiveType.DATE);
ArrayType arrayType = new ArrayType(new ArrayType(itemType));
String typeStr = "Array<Array<date>>";
Type resType = fromHiveTypeToArrayType(typeStr);
Assert.assertEquals(arr... |
@Override
public Result invoke(final Invocation invocation) throws RpcException {
checkWhetherDestroyed();
// binding attachments into invocation.
// Map<String, Object> contextAttachments = RpcContext.getClientAttachment().getObjectAttachments();
// if (contextAttachm... | @Test
void testTimeoutExceptionCode() {
List<Invoker<DemoService>> invokers = new ArrayList<Invoker<DemoService>>();
invokers.add(new Invoker<DemoService>() {
@Override
public Class<DemoService> getInterface() {
return DemoService.class;
}
... |
public static void rethrowIfUnrecoverable(Throwable exception) {
if (exception instanceof OutOfMemoryError) {
ExceptionUtils.throwAsUncheckedException(exception);
}
} | @Test
void ignoresThrowable() {
assertDoesNotThrow(() -> rethrowIfUnrecoverable(new Throwable()));
} |
@Override
public UUID generateId() {
long counterValue = counter.incrementAndGet();
if (counterValue == MAX_COUNTER_VALUE) {
throw new CucumberException(
"Out of " + IncrementingUuidGenerator.class.getSimpleName() +
" capacity. Please generate usin... | @Test
void same_thread_generates_different_UuidGenerators() {
// Given/When
List<UUID> uuids = IntStream.rangeClosed(1, 10)
.mapToObj(i -> new IncrementingUuidGenerator().generateId())
.collect(Collectors.toList());
// Then
checkUuidProperties(uuids);... |
static String headerLine(CSVFormat csvFormat) {
return String.join(String.valueOf(csvFormat.getDelimiter()), csvFormat.getHeader());
} | @Test
public void givenNoTrim_keepsSpaces() {
CSVFormat csvFormat = csvFormat().withTrim(false);
PCollection<String> input =
pipeline.apply(
Create.of(
headerLine(csvFormat),
" a ,1,1.1",
"b, 2 ,2.2",
"c,3, 3.3 ... |
public static void urlEncode(String str, StringBuilder sb) {
for (int idx = 0; idx < str.length(); ++idx) {
char c = str.charAt(idx);
if ('+' == c) {
sb.append("%2B");
} else if ('%' == c) {
sb.append("%25");
} else {
... | @Test
public void urlEncode() {
String str = "hello+World%";
String expected = "hello%2BWorld%25";
StringBuilder stringBuilder = new StringBuilder();
GroupKey.urlEncode(str, stringBuilder);
Assert.isTrue(stringBuilder.toString().contains(expected));
} |
@Override
public void updateTask(Task task) {
Map.Entry<String, Long> taskInDb = getTaskChecksumAndUpdateTime(task.getTaskId());
String taskCheckSum = computeChecksum(task);
if (taskInDb != null) {
long updateInterval = task.getUpdateTime() - taskInDb.getValue();
if (taskCheckSum.equals(taskIn... | @Test
public void testUpdateTask() {
// should update DB if this is new
maestroExecutionDao.updateTask(task);
Task actual = maestroExecutionDao.getTask(TEST_TASK_ID);
assertEquals("b1a2db354f803423e990fad1b9265b6f", actual.getWorkerId());
assertEquals(1, actual.getPollCount());
assertEquals(0,... |
public void updateDetectNewPartitionWatermark(Instant watermark) {
writeToMdTableWatermarkHelper(getFullDetectNewPartition(), watermark, null);
} | @Test
public void testUpdateDetectNewPartitionWatermark() {
Instant watermark = Instant.now();
metadataTableDao.updateDetectNewPartitionWatermark(watermark);
Row row =
dataClient.readRow(
metadataTableAdminDao.getTableId(),
metadataTableDao
.getChangeStreamN... |
@Override
public ConfigOperateResult insertOrUpdateTag(final ConfigInfo configInfo, final String tag, final String srcIp,
final String srcUser) {
if (findConfigInfo4TagState(configInfo.getDataId(), configInfo.getGroup(), configInfo.getTenant(), tag) == null) {
return addConfigInfo4Ta... | @Test
void testInsertOrUpdateTagOfAdd() {
String dataId = "dataId111222";
String group = "group";
String tenant = "tenant";
String appName = "appname1234";
String content = "c12345";
ConfigInfo configInfo = new ConfigInfo(dataId, group, tenant, appName, conte... |
@Override
public final int position() {
return pos;
} | @Test(expected = IllegalArgumentException.class)
public void testPositionNewPos_negativeNewPos() {
in.position(-1);
} |
@Override
public void createFunction(SqlInvokedFunction function, boolean replace)
{
checkCatalog(function);
checkFunctionLanguageSupported(function);
checkArgument(!function.hasVersion(), "function '%s' is already versioned", function);
QualifiedObjectName functionName = functi... | @Test(expectedExceptions = PrestoException.class, expectedExceptionsMessageRegExp = "Schema name exceeds max length of 128.*")
public void testSchemaNameTooLong()
{
QualifiedObjectName functionName = QualifiedObjectName.valueOf(TEST_CATALOG, dummyString(129), "tangent");
createFunction(createFun... |
public boolean init( StepMetaInterface smi, StepDataInterface sdi ) {
meta = (TableOutputMeta) smi;
data = (TableOutputData) sdi;
if ( super.init( smi, sdi ) ) {
try {
data.commitSize = Integer.parseInt( environmentSubstitute( meta.getCommitSize() ) );
data.databaseMeta = meta.getDat... | @Test
public void testInit_unsupportedConnection() {
TableOutputMeta meta = mock( TableOutputMeta.class );
TableOutputData data = mock( TableOutputData.class );
DatabaseInterface dbInterface = mock( DatabaseInterface.class );
doNothing().when( tableOutputSpy ).logError( anyString() );
when( m... |
@Override
public RedisClusterNode clusterGetNodeForSlot(int slot) {
Iterable<RedisClusterNode> res = clusterGetNodes();
for (RedisClusterNode redisClusterNode : res) {
if (redisClusterNode.isMaster() && redisClusterNode.getSlotRange().contains(slot)) {
return redisCluster... | @Test
public void testClusterGetNodeForSlot() {
RedisClusterNode node1 = connection.clusterGetNodeForSlot(1);
RedisClusterNode node2 = connection.clusterGetNodeForSlot(16000);
assertThat(node1.getId()).isNotEqualTo(node2.getId());
} |
@Override
public String getName() {
return this.name;
} | @Test
public void allCircuitBreakerStatesAllowTransitionToMetricsOnlyMode() {
for (final CircuitBreaker.State state : CircuitBreaker.State.values()) {
assertThatNoException().isThrownBy(() -> CircuitBreaker.StateTransition.transitionBetween(circuitBreaker.getName(), state, CircuitBreaker.State.M... |
public static SlotManagerConfiguration fromConfiguration(
Configuration configuration, WorkerResourceSpec defaultWorkerResourceSpec)
throws ConfigurationException {
final Time rpcTimeout =
Time.fromDuration(configuration.get(RpcOptions.ASK_TIMEOUT_DURATION));
fi... | @Test
void testComputeMinMaxMemoryIsInvalid() {
final Configuration configuration = new Configuration();
final MemorySize minMemorySize = MemorySize.ofMebiBytes(500);
final MemorySize maxMemorySize = MemorySize.ofMebiBytes(700);
final int numSlots = 3;
configuration.set(Resou... |
@Override
public boolean tryFence(HAServiceTarget target, String args) {
ProcessBuilder builder;
String cmd = parseArgs(target.getTransitionTargetHAStatus(), args);
if (!Shell.WINDOWS) {
builder = new ProcessBuilder("bash", "-e", "-c", cmd);
} else {
builder = new ProcessBuilder("cmd.exe"... | @Test
public void testBasicSuccessFailure() {
assertTrue(fencer.tryFence(TEST_TARGET, "echo"));
assertFalse(fencer.tryFence(TEST_TARGET, "exit 1"));
// bad path should also fail
assertFalse(fencer.tryFence(TEST_TARGET, "xxxxxxxxxxxx"));
} |
public void delete(final Map<Path, TransferStatus> files, final PasswordCallback prompt, final Callback callback) throws BackgroundException {
final Map<Path, List<ObjectKeyAndVersion>> map = new HashMap<>();
final List<Path> containers = new ArrayList<>();
for(Path file : files.keySet()) {
... | @Test
public void testDeleteFileBackslash() throws Exception {
final Path container = new Path("test-eu-central-1-cyberduck", EnumSet.of(Path.Type.volume, Path.Type.directory));
final Path test = new Path(container, String.format("%s\\%s", new AlphanumericRandomStringService().random(),
... |
@Override
public int getGroupKeyLength() {
return 0;
} | @Test
public void testGetGroupKeyLength() {
// Run the test
final int result = _selectionResultSetUnderTest.getGroupKeyLength();
// Verify the results
assertEquals(0, result);
} |
public EpochEntry findEpochEntryByOffset(final long offset) {
this.readLock.lock();
try {
if (!this.epochMap.isEmpty()) {
for (Map.Entry<Integer, EpochEntry> entry : this.epochMap.entrySet()) {
if (entry.getValue().getStartOffset() <= offset && entry.getVa... | @Test
public void testFindEpochEntryByOffset() {
final EpochEntry entry = this.epochCache.findEpochEntryByOffset(350);
assertEquals(entry.getEpoch(), 2);
assertEquals(entry.getStartOffset(), 300);
assertEquals(entry.getEndOffset(), 500);
} |
@Override
public void convertWeightsForChildQueues(FSQueue queue,
CapacitySchedulerConfiguration csConfig) {
List<FSQueue> children = queue.getChildQueues();
if (queue instanceof FSParentQueue || !children.isEmpty()) {
QueuePath queuePath = new QueuePath(queue.getName());
if (queue.getName(... | @Test
public void testAutoCreateV2FlagOnParent() {
FSQueue root = createFSQueues(1);
converter.convertWeightsForChildQueues(root, csConfig);
assertTrue("root autocreate v2 enabled",
csConfig.isAutoQueueCreationV2Enabled(ROOT));
} |
@Override
public int hashCode() {
return serializer != null ? serializer.hashCode() : 0;
} | @Test
public void testAdaptorEqualAndHashCode() {
StreamSerializerAdapter theOther = new StreamSerializerAdapter(serializer);
StreamSerializerAdapter theEmptyOne = new StreamSerializerAdapter(null);
assertEquals(adapter, adapter);
assertEquals(adapter, theOther);
assertNotEq... |
public PullResult pullKernelImpl(
final MessageQueue mq,
final String subExpression,
final String expressionType,
final long subVersion,
final long offset,
final int maxNums,
final int maxSizeInBytes,
final int sysFlag,
final long commitOffset,
... | @Test
public void testPullKernelImpl() throws Exception {
PullCallback pullCallback = mock(PullCallback.class);
when(mQClientFactory.getMQClientAPIImpl()).thenReturn(mqClientAPIImpl);
PullResult actual = pullAPIWrapper.pullKernelImpl(createMessageQueue(),
"",
... |
public static Set<X509Certificate> filterValid( X509Certificate... certificates )
{
final Set<X509Certificate> results = new HashSet<>();
if (certificates != null)
{
for ( X509Certificate certificate : certificates )
{
if ( certificate == null )
... | @Test
public void testFilterValidEmpty() throws Exception
{
// Setup fixture.
final Collection<X509Certificate> input = new ArrayList<>();
// Execute system under test.
final Collection<X509Certificate> result = CertificateUtils.filterValid( input );
// Verify results.
... |
public boolean allFieldsNoLessThan(final ResourceProfile other) {
checkNotNull(other, "Cannot compare null resources");
if (this.equals(ANY)) {
return true;
}
if (this.equals(other)) {
return true;
}
if (this.equals(UNKNOWN)) {
retur... | @Test
void testUnknownNoLessThanUnknown() {
assertThat(ResourceProfile.UNKNOWN.allFieldsNoLessThan(ResourceProfile.UNKNOWN)).isTrue();
} |
public static int[] computePhysicalIndices(
List<TableColumn> logicalColumns,
DataType physicalType,
Function<String, String> nameRemapping) {
Map<TableColumn, Integer> physicalIndexLookup =
computePhysicalIndices(logicalColumns.stream(), physicalType, nameRe... | @Test
void testFieldMappingLegacyDecimalType() {
int[] indices =
TypeMappingUtils.computePhysicalIndices(
TableSchema.builder()
.field("f0", DECIMAL(38, 18))
.build()
.getT... |
private NodesSpecification(ClusterResources min,
ClusterResources max,
IntRange groupSize,
boolean dedicated, Version version,
boolean required, boolean canFail, boolean exclusive,
... | @Test
void invalidResources() {
assertThrows(IllegalArgumentException.class,
() -> nodesSpecification("<nodes><resources vcpu='-1' /></nodes>"));
assertThrows(IllegalArgumentException.class,
() -> nodesSpecification("<nodes><resources vcpu='' /></nodes>"));
... |
public static void runCommand(Config config) throws TerseException {
try {
ManifestWorkspace workspace = new ManifestWorkspace(config.out);
ClassLoader parent = ConnectPluginPath.class.getClassLoader();
ServiceLoaderScanner serviceLoaderScanner = new ServiceLoaderScanner();
... | @Test
public void testNoArguments() {
CommandResult res = runCommand();
assertNotEquals(0, res.returnCode);
} |
public boolean tryUnblockFailedWorkflowInstance(
String workflowId, long workflowInstanceId, long workflowRunId, TimelineEvent event) {
int updated =
withMetricLogError(
() ->
withRetryableUpdate(
UNBLOCK_INSTANCE_FAILED_STATUS,
stmt ... | @Test
public void testTryUnblockFailedWorkflowInstance() {
int cnt =
instanceDao.terminateQueuedInstances(
TEST_WORKFLOW_ID, 2, WorkflowInstance.Status.FAILED, "test-reason");
assertEquals(1L, cnt);
String status = instanceDao.getWorkflowInstanceRawStatus(TEST_WORKFLOW_ID, 1L, 1L);
... |
public List<Modification> parse(String svnLogOutput, String path, SAXBuilder builder) {
try {
Document document = builder.build(new StringReader(svnLogOutput));
return parseDOMTree(document, path);
} catch (Exception e) {
throw bomb("Unable to parse svn log output: " ... | @Test
public void shouldParseBJCruiseLogCorrectly() {
String firstChangeLog = """
<?xml version="1.0"?>
<log>
<logentry
revision="11238">
<author>yxchu</author>
<date>2008-10-21T14:00:16.598195Z</date>
... |
public Span toSpan(TraceContext context) {
return toSpan(null, context);
} | @Test void toSpan() {
TraceContext context = tracer.newTrace().context();
assertThat(tracer.toSpan(context))
.isInstanceOf(RealSpan.class)
.extracting(Span::context)
.isEqualTo(context);
} |
public static <T extends PipelineOptions> T as(Class<T> klass) {
return new Builder().as(klass);
} | @Test
public void testGettersWithMultipleDefaults() throws Exception {
expectedException.expect(IllegalArgumentException.class);
// Make sure the error message says what the problem is, generally
expectedException.expectMessage("contradictory annotations");
// Make sure the error message gives actio... |
@Override
public HttpRestResult<String> httpDelete(String path, Map<String, String> headers, Map<String, String> paramValues,
String encode, long readTimeoutMs) throws Exception {
final long endTime = System.currentTimeMillis() + readTimeoutMs;
String currentServerAddr = serverListMgr.ge... | @Test
void testHttpDeleteWithRequestException() throws Exception {
assertThrows(NacosException.class, () -> {
when(nacosRestTemplate.<String>delete(eq(SERVER_ADDRESS_1 + "/test"), any(HttpClientConfig.class),
any(Header.class), any(Query.class), eq(String.class))).thenThrow(n... |
BackgroundJobRunner getBackgroundJobRunner(Job job) {
assertJobExists(job.getJobDetails());
return backgroundJobRunners.stream()
.filter(jobRunner -> jobRunner.supports(job))
.findFirst()
.orElseThrow(() -> problematicConfigurationException("Could not find... | @Test
void getBackgroundJobRunnerForIoCJobWithInstance() {
final Job job = anEnqueuedJob()
.withJobDetails(() -> testServiceForIoC.doWork())
.build();
assertThat(backgroundJobServer.getBackgroundJobRunner(job))
.isNotNull()
.isInstanceO... |
public static Read<JmsRecord> read() {
return new AutoValue_JmsIO_Read.Builder<JmsRecord>()
.setMaxNumRecords(Long.MAX_VALUE)
.setCoder(SerializableCoder.of(JmsRecord.class))
.setCloseTimeout(DEFAULT_CLOSE_TIMEOUT)
.setRequiresDeduping(false)
.setMessageMapper(
ne... | @Test
public void testReadMessagesWithCFProviderFn() throws Exception {
long count = 5;
produceTestMessages(count, JmsIOTest::createTextMessage);
PCollection<JmsRecord> output =
pipeline.apply(
JmsIO.read()
.withConnectionFactoryProviderFn(
toSerial... |
public Map<String, String> clientTags() {
return clientTags;
} | @Test
public void shouldReturnEmptyClientTagsMapByDefault() {
assertTrue(new ClientState().clientTags().isEmpty());
} |
public void requireAtLeast(final int requiredMajor, final int requiredMinor) {
final Version required = new Version(requiredMajor, requiredMinor);
if (this.compareTo(required) < 0) {
throw new UnsupportedOperationException(
"This operation requires API version at least "... | @Test
public void shouldObserveApiLimitsOnMinorVersions() {
assertThrows(UnsupportedOperationException.class,
() -> V35_0.requireAtLeast(35, 1));
} |
@Override
public PMML_MODEL getPMMLModelType() {
return PMML_MODEL.REGRESSION_MODEL;
} | @Test
void getPMMLModelType() {
assertThat(executor.getPMMLModelType()).isEqualTo(PMML_MODEL.REGRESSION_MODEL);
} |
public static double pow2(double x) {
return x * x;
} | @Test
public void testPow2() {
System.out.println("pow2");
assertEquals(0, MathEx.pow2(0), 1E-10);
assertEquals(1, MathEx.pow2(1), 1E-10);
assertEquals(4, MathEx.pow2(2), 1E-10);
assertEquals(9, MathEx.pow2(3), 1E-10);
} |
@Override
public void notifyCheckpointComplete(long completedCheckpointId) {
synchronized (uploadedSstFiles) {
// FLINK-23949: materializedSstFiles.keySet().contains(completedCheckpointId) make sure
// the notified checkpointId is not a savepoint, otherwise next checkpoint will
... | @Test
void testCheckpointIsIncremental() throws Exception {
try (CloseableRegistry closeableRegistry = new CloseableRegistry();
RocksIncrementalSnapshotStrategy<?> checkpointSnapshotStrategy =
createSnapshotStrategy()) {
FsCheckpointStreamFactory checkpoi... |
@Override
public long reservePermission(final int permits) {
long timeoutInNanos = state.get().config.getTimeoutDuration().toNanos();
State modifiedState = updateStateWithBackOff(permits, timeoutInNanos);
boolean canAcquireImmediately = modifiedState.nanosToWait <= 0;
if (canAcquire... | @Test
public void reserveManyCyclesIfWegithgreaterThenLimitPerPeriod() throws Exception {
setup(Duration.ofNanos(CYCLE_IN_NANOS * 5));
setTimeOnNanos(CYCLE_IN_NANOS);
long nanosToWait = rateLimiter.reservePermission(PERMISSIONS_RER_CYCLE * 3);
then(nanosToWait).isGreaterThan(CYCLE_IN... |
@VisibleForTesting
protected ClientRequestInterceptor createRequestInterceptorChain() {
Configuration conf = getConfig();
return RouterServerUtil.createRequestInterceptorChain(conf,
YarnConfiguration.ROUTER_CLIENTRM_INTERCEPTOR_CLASS_PIPELINE,
YarnConfiguration.DEFAULT_ROUTER_CLIENTRM_INTERCEP... | @Test
public void testRequestInterceptorChainCreation() throws Exception {
ClientRequestInterceptor root =
super.getRouterClientRMService().createRequestInterceptorChain();
int index = 0;
while (root != null) {
// The current pipeline is:
// PassThroughClientRequestInterceptor - index ... |
@SuppressWarnings("unchecked")
public static <S, F> S visit(final Schema schema, final Visitor<S, F> visitor) {
final BiFunction<Visitor<?, ?>, Schema, Object> handler = HANDLER.get(schema.type());
if (handler == null) {
throw new UnsupportedOperationException("Unsupported schema type: " + schema.type()... | @Test
public void shouldVisitInt8() {
// Given:
final Schema schema = Schema.OPTIONAL_INT8_SCHEMA;
when(visitor.visitInt8(any())).thenReturn("Expected");
// When:
final String result = SchemaWalker.visit(schema, visitor);
// Then:
verify(visitor).visitInt8(same(schema));
assertThat(r... |
public Node pop() {
return nodes.poll();
} | @Test
void require_SearcherNodes_ordered_by_insertion_order() {
int priority = 0;
ComponentNode a = new ComponentNode<>(createFakeComponentB("1"), priority++);
ComponentNode b = new ComponentNode<>(createFakeComponentA("2"), priority++);
ComponentNode c = new ComponentNode<>(createFa... |
@Udf(description = "Converts a TIMESTAMP value into the"
+ " string representation of the timestamp in the given format. Single quotes in the"
+ " timestamp format can be escaped with '', for example: 'yyyy-MM-dd''T''HH:mm:ssX'"
+ " The system default time zone is used when no time zone is explicitly ... | @Test
public void shouldThrowIfInvalidTimeZone() {
// When:
final KsqlException e = assertThrows(
KsqlFunctionException.class,
() -> udf.formatTimestamp(new Timestamp(1638360611123L),
"yyyy-MM-dd HH:mm:ss.SSS", "PST")
);
// Then:
assertThat(e.getMessage(), containsStri... |
public int indexOf(PDPage page)
{
SearchContext context = new SearchContext(page);
if (findPage(context, root))
{
return context.index;
}
return -1;
} | @Test
void indexOfPageFromOutlineDestination() throws IOException
{
doc = Loader.loadPDF(RandomAccessReadBuffer.createBufferFromStream(
TestPDPageTree.class.getResourceAsStream("with_outline.pdf")));
PDDocumentOutline outline = doc.getDocumentCatalog().getDocumentOutline();
... |
public static <T extends GeneratedMessageV3> ProtobufNativeSchema<T> of(Class<T> pojo) {
return of(pojo, new HashMap<>());
} | @Test
public void testSchema() {
ProtobufNativeSchema<org.apache.pulsar.client.schema.proto.Test.TestMessage> protobufSchema
= ProtobufNativeSchema.of(org.apache.pulsar.client.schema.proto.Test.TestMessage.class);
assertEquals(protobufSchema.getSchemaInfo().getType(), SchemaType.PRO... |
@Deprecated
public static UnboundedSource<Long, CounterMark> unbounded() {
return unboundedWithTimestampFn(new NowTimestampFn());
} | @Test
@Category({
ValidatesRunner.class,
UsesStatefulParDo.class // This test fails if State is unsupported despite no direct usage.
})
public void testUnboundedSourceSplits() throws Exception {
long numElements = 1000;
int numSplits = 10;
UnboundedSource<Long, ?> initial = CountingSource.unb... |
@Override
String getFileName(double lat, double lon) {
int intKey = calcIntKey(lat, lon);
String str = areas.get(intKey);
if (str == null)
return null;
int minLat = Math.abs(down(lat));
int minLon = Math.abs(down(lon));
str += "/";
if (lat >= 0)
... | @Disabled
@Test
public void testGetEleHorizontalBorder() {
instance = new SRTMProvider();
// Border between the tiles N42E011 and N42E012
assertEquals("Eurasia/N42E011", instance.getFileName(42.1, 11.999999));
assertEquals(324, instance.getEle(42.1, 11.999999), precision);
... |
@Override
public Response getListingJson(Application app, ServletConfig sc, HttpHeaders headers, UriInfo uriInfo)
throws JsonProcessingException {
Response response = getListingJsonResponse(app, context, sc, headers, uriInfo);
response.getHeaders().add("Access-Control-Allow-Origin", "*")... | @Test
void test() throws Exception {
DubboSwaggerApiListingResource resource = new DubboSwaggerApiListingResource();
app = mock(Application.class);
sc = mock(ServletConfig.class);
Set<Class<?>> sets = new HashSet<Class<?>>();
sets.add(SwaggerService.class);
when(sc... |
@Override
@CacheEvict(value = RedisKeyConstants.MAIL_ACCOUNT, key = "#id")
public void deleteMailAccount(Long id) {
// 校验是否存在账号
validateMailAccountExists(id);
// 校验是否存在关联模版
if (mailTemplateService.getMailTemplateCountByAccountId(id) > 0) {
throw exception(MAIL_ACCOUNT... | @Test
public void testDeleteMailAccount_notExists() {
// 准备参数
Long id = randomLongId();
// 调用, 并断言异常
assertServiceException(() -> mailAccountService.deleteMailAccount(id), MAIL_ACCOUNT_NOT_EXISTS);
} |
public static Autoscaling empty() {
return empty("");
} | @Test
public void test_changing_exclusivity() {
var min = new ClusterResources( 2, 1, new NodeResources( 3, 8, 100, 1));
var max = new ClusterResources(20, 1, new NodeResources(100, 1000, 1000, 1));
var fixture = DynamicProvisioningTester.fixture()
... |
@Override
public String get(final Scope scope, final ConnectionSession connectionSession, final MySQLSystemVariable variable) {
return Scope.GLOBAL == scope ? variable.getDefaultValue() : connectionSession.getIsolationLevel().orElse(TransactionIsolationLevel.REPEATABLE_READ).getIsolationLevel();
} | @Test
void assertGetGlobalValue() {
assertThat(new TransactionIsolationValueProvider().get(Scope.GLOBAL, null, MySQLSystemVariable.TRANSACTION_ISOLATION), is("REPEATABLE-READ"));
assertThat(new TransactionIsolationValueProvider().get(Scope.GLOBAL, null, MySQLSystemVariable.TX_ISOLATION), is("REPEATA... |
@Override
public SparkTable loadTable(Identifier ident) throws NoSuchTableException {
Pair<Table, Long> table = load(ident);
return new SparkTable(table.first(), table.second(), false /* refresh eagerly */);
} | @Test
public void testTimeTravel() {
sql("CREATE TABLE %s (id INT, dep STRING) USING iceberg", tableName);
Table table = validationCatalog.loadTable(tableIdent);
sql("INSERT INTO TABLE %s VALUES (1, 'hr')", tableName);
table.refresh();
Snapshot firstSnapshot = table.currentSnapshot();
waitU... |
public DdlCommandResult execute(
final String sql,
final DdlCommand ddlCommand,
final boolean withQuery,
final Set<SourceName> withQuerySources
) {
return execute(sql, ddlCommand, withQuery, withQuerySources, false);
} | @Test
public void shouldAddTableWithCorrectSql() {
// Given:
givenCreateTable();
// When:
cmdExec.execute(SQL_TEXT, createTable, false, NO_QUERY_SOURCES);
// Then:
assertThat(metaStore.getSource(TABLE_NAME).getSqlExpression(), is(SQL_TEXT));
} |
public static Ip4Prefix valueOf(int address, int prefixLength) {
return new Ip4Prefix(Ip4Address.valueOf(address), prefixLength);
} | @Test(expected = NullPointerException.class)
public void testInvalidValueOfNullString() {
Ip4Prefix ipPrefix;
String fromString;
fromString = null;
ipPrefix = Ip4Prefix.valueOf(fromString);
} |
@Override
public Map<String, ScannerPlugin> installRequiredPlugins() {
LOG.info("Loading required plugins");
InstallResult result = installPlugins(p -> p.getRequiredForLanguages() == null || p.getRequiredForLanguages().isEmpty());
LOG.debug("Plugins not loaded because they are optional: {}", result.skipp... | @Test
public void fail_if_json_of_installed_plugins_is_not_valid() {
WsTestUtil.mockReader(wsClient, "api/plugins/installed", new StringReader("not json"));
assertThatThrownBy(() -> underTest.installRequiredPlugins())
.isInstanceOf(IllegalStateException.class)
.hasMessage("Fail to parse response ... |
public static int[] computePhysicalIndices(
List<TableColumn> logicalColumns,
DataType physicalType,
Function<String, String> nameRemapping) {
Map<TableColumn, Integer> physicalIndexLookup =
computePhysicalIndices(logicalColumns.stream(), physicalType, nameRe... | @Test
void testFieldMappingLegacyDecimalTypeNotMatchingPrecision() {
assertThatThrownBy(
() ->
TypeMappingUtils.computePhysicalIndices(
TableSchema.builder()
.field... |
public <T> OutputSampler<T> sampleOutput(String pcollectionId, Coder<T> coder) {
return (OutputSampler<T>)
outputSamplers.computeIfAbsent(
pcollectionId,
k ->
new OutputSampler<>(
coder, this.maxSamples, this.sampleEveryN, this.onlySampleExceptions... | @Test
public void testMultipleOutputs() throws Exception {
DataSampler sampler = new DataSampler();
VarIntCoder coder = VarIntCoder.of();
sampler.sampleOutput("pcollection-id-1", coder).sample(globalWindowedValue(1));
sampler.sampleOutput("pcollection-id-2", coder).sample(globalWindowedValue(2));
... |
public static <T extends PipelineOptions> T validate(Class<T> klass, PipelineOptions options) {
return validate(klass, options, false);
} | @Test
public void testWhenOptionIsDefinedInMultipleSuperInterfacesAndIsNotPresentFailsRequirement() {
RightOptions rightOptions = PipelineOptionsFactory.as(RightOptions.class);
rightOptions.setBoth("foo");
rightOptions.setRunner(CrashingRunner.class);
expectedException.expect(IllegalArgumentException... |
static <T extends Type> String buildMethodSignature(
String methodName, List<TypeReference<T>> parameters) {
StringBuilder result = new StringBuilder();
result.append(methodName);
result.append("(");
String params =
parameters.stream().map(Utils::getTypeName)... | @Test
void testBuildMethodSignatureWithDynamicArrays() {
assertEquals(
"nazzEvent2((((string,string)[])[],uint256)[])",
EventEncoder.buildMethodSignature(
AbiV2TestFixture.nazzEvent2.getName(),
AbiV2TestFixture.nazzEvent2.getPar... |
@Override
public void handlerRule(final RuleData ruleData) {
Optional.ofNullable(ruleData.getHandle()).ifPresent(s -> {
RewriteHandle rewriteHandle = GsonUtils.getInstance().fromJson(s, RewriteHandle.class);
CACHED_HANDLE.get().cachedHandle(CacheKeyUtils.INST.getKey(ruleData), rewrit... | @Test
public void testHandlerRule() {
ruleData.setSelectorId("1");
ruleData.setHandle("{\"urlPath\":\"test\"}");
ruleData.setId("test");
rewritePluginDataHandler.handlerRule(ruleData);
Supplier<CommonHandleCache<String, RewriteHandle>> cache = RewritePluginDataHandler.CACHED_... |
@Override
public boolean register(final Application application) {
return SMAppService.loginItemServiceWithIdentifier(application.getIdentifier()).registerAndReturnError(null);
} | @Test
public void testRegister() {
assumeFalse(Factory.Platform.osversion.matches("(10|11|12)\\..*"));
assertFalse(new SMAppServiceApplicationLoginRegistry().register(
new Application("bundle.helper")));
} |
@Override
public boolean equals(@Nullable Object other) {
if (!(other instanceof PCollectionTuple)) {
return false;
}
PCollectionTuple that = (PCollectionTuple) other;
return this.pipeline.equals(that.pipeline) && this.pcollectionMap.equals(that.pcollectionMap);
} | @Test
public void testEquals() {
TestPipeline p = TestPipeline.create();
TupleTag<Long> longTag = new TupleTag<>();
PCollection<Long> longs = p.apply(GenerateSequence.from(0));
TupleTag<String> strTag = new TupleTag<>();
PCollection<String> strs = p.apply(Create.of("foo", "bar"));
EqualsTeste... |
public static boolean endsWith(CharSequence s, char c) {
int len = s.length();
return len > 0 && s.charAt(len - 1) == c;
} | @Test
public void testEndsWith() {
assertFalse(StringUtil.endsWith("", 'u'));
assertTrue(StringUtil.endsWith("u", 'u'));
assertTrue(StringUtil.endsWith("-u", 'u'));
assertFalse(StringUtil.endsWith("-", 'u'));
assertFalse(StringUtil.endsWith("u-", 'u'));
} |
@SuppressWarnings("unused") // Required for automatic type inference
public static <K> Builder0<K> forClass(final Class<K> type) {
return new Builder0<>();
} | @Test(expected = IllegalArgumentException.class)
public void shouldThrowIfHandlerSupplierThrows1() {
HandlerMaps.forClass(BaseType.class).withArgType(String.class)
.put(LeafTypeA.class, () -> {
throw new RuntimeException("Boom");
})
.build();
} |
public ContentPackUninstallDetails getUninstallDetails(ContentPack contentPack, ContentPackInstallation installation) {
if (contentPack instanceof ContentPackV1 contentPackV1) {
return getUninstallDetails(contentPackV1, installation);
} else {
throw new IllegalArgumentException("... | @Test
public void getUninstallDetails() {
/* Test will be uninstalled */
when(contentPackInstallService.countInstallationOfEntityById(ModelId.of("dead-beef1"))).thenReturn((long) 1);
ContentPackUninstallDetails expect = ContentPackUninstallDetails.create(nativeEntityDescriptors);
Con... |
public ConsumerStatsManager getConsumerStatsManager() {
return this.defaultMQPushConsumerImpl.getConsumerStatsManager();
} | @Test
public void testPullMessage_ConsumeSuccess() throws InterruptedException, RemotingException, MQBrokerException, NoSuchFieldException, Exception {
final CountDownLatch countDownLatch = new CountDownLatch(1);
final AtomicReference<MessageExt> messageAtomic = new AtomicReference<>();
Cons... |
public ReviewGroupResponse getReviewGroupSummary(String reviewRequestCode) {
ReviewGroup reviewGroup = reviewGroupRepository.findByReviewRequestCode(reviewRequestCode)
.orElseThrow(() -> new ReviewGroupNotFoundByReviewRequestCodeException(reviewRequestCode));
return new ReviewGroupRespo... | @Test
void 리뷰_요청_코드에_대한_리뷰_그룹이_존재하지_않을_경우_예외가_발생한다() {
// given, when, then
assertThatThrownBy(() -> reviewGroupLookupService.getReviewGroupSummary("reviewRequestCode"))
.isInstanceOf(ReviewGroupNotFoundByReviewRequestCodeException.class);
} |
public static boolean isDirectory(URL resourceURL) throws URISyntaxException {
final String protocol = resourceURL.getProtocol();
switch (protocol) {
case "jar":
try {
final JarURLConnection jarConnection = (JarURLConnection) resourceURL.openConnection();
... | @Test
void isDirectoryReturnsFalseForURLEncodedFilesInJars() throws Exception {
final URL url = new URL("jar:" + resourceJar.toExternalForm() + "!/file%20with%20space.txt");
assertThat(url.getProtocol()).isEqualTo("jar");
assertThat(ResourceURL.isDirectory(url)).isFalse();
} |
public FEELFnResult<Boolean> invoke(@ParameterName( "list" ) List list) {
if ( list == null ) {
return FEELFnResult.ofError(new InvalidParametersEvent(Severity.ERROR, "list", "cannot be null"));
}
boolean result = true;
boolean containsNull = false;
// Spec. definitio... | @Test
void invokeArrayParamReturnTrue() {
FunctionTestUtil.assertResult(allFunction.invoke(new Object[]{Boolean.TRUE, Boolean.TRUE}), true);
} |
@Override
@NotNull
public BTreeMutable getMutableCopy() {
final BTreeMutable result = new BTreeMutable(this);
result.addExpiredLoggable(rootLoggable);
return result;
} | @Test
public void testGetReturnsFirstSortedDuplicate() {
tm = new BTreeEmpty(log, createTestSplittingPolicy(), true, 1).getMutableCopy();
List<INode> l = new ArrayList<>();
l.add(kv("1", "1"));
l.add(kv("2", "2"));
l.add(kv("3", "3"));
l.add(kv("5", "51"));
l... |
public static String parametersToString(Object... objs) {
StringBuilder sb = new StringBuilder("(");
if (objs != null) {
for (int k = 0; k < objs.length; k++) {
if (k != 0) {
sb.append(", ");
}
if (objs[k] == null) {
sb.append("null");
} else {
... | @Test
public void parametersToString() {
class TestCase {
String mExpected;
Object[] mInput;
public TestCase(String expected, Object[] objs) {
mExpected = expected;
mInput = objs;
}
}
List<TestCase> testCases = new ArrayList<>();
testCases.add(new TestCase("()... |
@Deprecated
public List<Pet> findPetsByTags(List<String> tags) throws RestClientException {
return findPetsByTagsWithHttpInfo(tags).getBody();
} | @Test
public void findPetsByTagsTest() {
List<String> tags = null;
List<Pet> response = api.findPetsByTags(tags);
// TODO: test validations
} |
public void doGet( HttpServletRequest request, HttpServletResponse response ) throws ServletException,
IOException {
if ( isJettyMode() && !request.getContextPath().startsWith( CONTEXT_PATH ) ) {
return;
}
if ( log.isDebug() ) {
logDebug( BaseMessages.getString( PKG, "RunJobServlet.Log.RunJ... | @Test
public void doGetMissingMandatoryParamJobTest() throws Exception {
HttpServletRequest mockHttpServletRequest = mock( HttpServletRequest.class );
HttpServletResponse mockHttpServletResponse = mock( HttpServletResponse.class );
TransformationMap transformationMap = mock( TransformationMap.class );
... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.