focal_method stringlengths 13 60.9k | test_case stringlengths 25 109k |
|---|---|
@Override
public String getConfig(final String dataId) {
try {
return configService.getConfig(dataId, NacosPathConstants.GROUP, NacosPathConstants.DEFAULT_TIME_OUT);
} catch (NacosException e) {
LOG.error("Get data from nacos error.", e);
throw new ShenyuException... | @Test
public void testOnMetaDataChanged() throws NacosException {
when(configService.getConfig(anyString(), anyString(), anyLong())).thenReturn(null);
MetaData metaData = MetaData.builder().id(MOCK_ID).path(MOCK_PATH).appName(MOCK_APP_NAME).build();
nacosDataChangedListener.onMetaDataChanged... |
@Override
public int read() throws IOException {
fill();
if (buffered > position) {
return 0xff & buffer[position++];
} else {
return -1;
}
} | @Test
public void testNullStream() throws IOException {
InputStream lookahead = new LookaheadInputStream(null, 100);
assertEquals(-1, lookahead.read());
} |
@ThriftField(1)
public boolean isAll()
{
return all;
} | @Test
public void testFromValueSetAll()
{
PrestoThriftValueSet thriftValueSet = fromValueSet(ValueSet.all(HYPER_LOG_LOG));
assertNotNull(thriftValueSet.getAllOrNoneValueSet());
assertTrue(thriftValueSet.getAllOrNoneValueSet().isAll());
} |
public Parser getParser() {
return parser;
} | @Test
public void testDynamicServiceLoaderFromConfig() throws Exception {
URL url = getResourceAsUrl("TIKA-1700-dynamic.xml");
TikaConfig config = new TikaConfig(url);
DummyParser parser = (DummyParser) config.getParser();
ServiceLoader loader = parser.getLoader();
boolean ... |
public static InfluxDBSinkConfig load(String yamlFile) throws IOException {
ObjectMapper mapper = new ObjectMapper(new YAMLFactory());
return mapper.readValue(new File(yamlFile), InfluxDBSinkConfig.class);
} | @Test
public final void loadFromYamlFileTest() throws IOException {
File yamlFile = getFile("sinkConfig-v1.yaml");
String path = yamlFile.getAbsolutePath();
InfluxDBSinkConfig config = InfluxDBSinkConfig.load(path);
assertNotNull(config);
assertEquals("http://localhost:8086",... |
public ResignedState(
Time time,
int localId,
int epoch,
Set<Integer> voters,
long electionTimeoutMs,
List<ReplicaKey> preferredSuccessors,
Endpoints endpoints,
LogContext logContext
) {
this.localId = localId;
this.epoch = epoch;
... | @Test
public void testResignedState() {
int remoteId = 1;
Set<Integer> voters = Utils.mkSet(localId, remoteId);
ResignedState state = newResignedState(voters);
assertEquals(ElectionState.withElectedLeader(epoch, localId, voters), state.election());
assertEquals(epoch, state... |
@Override
public Object[] toArray() {
throw new UnsupportedOperationException();
} | @Test(expected = UnsupportedOperationException.class)
public void testToArray() {
queue.toArray();
} |
public String stringify(boolean value) {
throw new UnsupportedOperationException(
"stringify(boolean) was called on a non-boolean stringifier: " + toString());
} | @Test
public void testUUIDStringifier() {
PrimitiveStringifier stringifier = PrimitiveStringifier.UUID_STRINGIFIER;
assertEquals(
"00112233-4455-6677-8899-aabbccddeeff",
stringifier.stringify(toBinary(
0x00, 0x11, 0x22, 0x33, 0x44, 0x55, 0x66, 0x77, 0x88, 0x99, 0xaa, 0xbb, 0xcc, 0... |
@VisibleForTesting
static Instant getCreationTime(String configuredCreationTime, ProjectProperties projectProperties)
throws DateTimeParseException, InvalidCreationTimeException {
try {
switch (configuredCreationTime) {
case "EPOCH":
return Instant.EPOCH;
case "USE_CURRENT_T... | @Test
public void testGetCreationTime_epoch() throws InvalidCreationTimeException {
Instant time = PluginConfigurationProcessor.getCreationTime("EPOCH", projectProperties);
assertThat(time).isEqualTo(Instant.EPOCH);
} |
@Override
public String getSessionId() {
return sessionID;
} | @Test
public void testEditConfigRequestWithOnlyNewConfiguration() {
log.info("Starting edit-config async");
assertNotNull("Incorrect sessionId", session1.getSessionId());
try {
assertTrue("NETCONF edit-config command failed",
session1.editConfig(EDIT_CONFIG_RE... |
public void close(final boolean closeQueries) {
primaryContext.getQueryRegistry().close(closeQueries);
try {
cleanupService.stopAsync().awaitTerminated(
this.primaryContext.getKsqlConfig()
.getLong(KsqlConfig.KSQL_QUERY_CLEANUP_SHUTDOWN_TIMEOUT_MS),
TimeUnit.MILLISECONDS... | @Test
public void shouldCleanUpInternalTopicsOnEngineCloseForTransientQueries() {
// Given:
setupKsqlEngineWithSharedRuntimeDisabled();
final QueryMetadata query = KsqlEngineTestUtil.executeQuery(
serviceContext,
ksqlEngine,
"select * from test1 EMIT CHANGES;",
ksqlConfig,
... |
@Override
public Set<IpSubnet> convertFrom(String value) {
final Set<IpSubnet> converted = new LinkedHashSet<>();
if (value != null) {
Iterable<String> subnets = Splitter.on(',').trimResults().split(value);
for (String subnet : subnets) {
try {
... | @Test
public void convertFromThrowsParameterExceptionWithInvalidSubnet() {
expectedException.expect(ParameterException.class);
expectedException.expectMessage("Invalid subnet: HODOR");
converter.convertFrom("127.0.0.1/32, ::1/128, HODOR");
} |
<T extends PipelineOptions> T as(Class<T> iface) {
checkNotNull(iface);
checkArgument(iface.isInterface(), "Not an interface: %s", iface);
T existingOption = computedProperties.interfaceToProxyCache.getInstance(iface);
if (existingOption == null) {
synchronized (this) {
// double check
... | @Test
public void testDisplayDataDeserializationWithRegistration() throws Exception {
PipelineOptionsFactory.register(HasClassOptions.class);
HasClassOptions options = PipelineOptionsFactory.as(HasClassOptions.class);
options.setClassOption(ProxyInvocationHandlerTest.class);
PipelineOptions deseriali... |
@Override
public void writeTo(ByteBuf byteBuf) throws LispWriterException {
WRITER.writeTo(byteBuf, this);
} | @Test
public void testSerialization() throws LispReaderException, LispWriterException, LispParseError {
ByteBuf byteBuf = Unpooled.buffer();
LocatorWriter writer = new LocatorWriter();
writer.writeTo(byteBuf, record1);
LocatorReader reader = new LocatorReader();
LispLocator... |
@Override
public KTable<Windowed<K>, V> aggregate(final Initializer<V> initializer) {
return aggregate(initializer, Materialized.with(null, null));
} | @Test
public void shouldNotHaveNullMaterializedOnAggregate() {
assertThrows(NullPointerException.class, () -> windowedCogroupedStream.aggregate(MockInitializer.STRING_INIT, Named.as("Test"), null));
} |
@Override
public String getManagedUsersSqlFilter(boolean filterByManaged) {
return findManagedInstanceService()
.map(managedInstanceService -> managedInstanceService.getManagedUsersSqlFilter(filterByManaged))
.orElseThrow(() -> NOT_MANAGED_INSTANCE_EXCEPTION);
} | @Test
public void getManagedUsersSqlFilter_whenNoDelegates_throws() {
Set<ManagedInstanceService> managedInstanceServices = emptySet();
DelegatingManagedServices delegatingManagedServices = new DelegatingManagedServices(managedInstanceServices);
assertThatIllegalStateException()
.isThrownBy(() -> de... |
@Override
public Set<Long> calculateUsers(DelegateExecution execution, String param) {
return StrUtils.splitToLongSet(param);
} | @Test
public void testCalculateUsers() {
// 准备参数
String param = "1,2";
// 调用
Set<Long> results = strategy.calculateUsers(null, param);
// 断言
assertEquals(asSet(1L, 2L), results);
} |
static int inferParallelism(
ReadableConfig readableConfig, long limitCount, Supplier<Integer> splitCountProvider) {
int parallelism =
readableConfig.get(ExecutionConfigOptions.TABLE_EXEC_RESOURCE_DEFAULT_PARALLELISM);
if (readableConfig.get(FlinkConfigOptions.TABLE_EXEC_ICEBERG_INFER_SOURCE_PARAL... | @Test
public void testInferedParallelism() throws IOException {
Configuration configuration = new Configuration();
// Empty table, infer parallelism should be at least 1
int parallelism = SourceUtil.inferParallelism(configuration, -1L, () -> 0);
assertThat(parallelism).isEqualTo(1);
// 2 splits (... |
public static boolean versionSupportsMultiKeyPullQuery(final String ksqlServerVersion) {
final KsqlVersion version;
try {
version = new KsqlVersion(ksqlServerVersion);
} catch (IllegalArgumentException e) {
LOGGER.warn("Could not parse ksqlDB server version to verify whether multi-key pull queri... | @Test
public void shouldReturnMultiKeyPullQueriesUnsupported() {
assertThat(versionSupportsMultiKeyPullQuery("v6.0.3"), is(false));
assertThat(versionSupportsMultiKeyPullQuery("v6.0.0"), is(false));
assertThat(versionSupportsMultiKeyPullQuery("v5.5.5"), is(false));
assertThat(versionSupportsMultiKeyPu... |
@Override
public synchronized T getValue(int index) {
BarSeries series = getBarSeries();
if (series == null) {
// Series is null; the indicator doesn't need cache.
// (e.g. simple computation of the value)
// --> Calculating the value
T result = calcul... | @Test
public void leaveLastBarUncached() {
BarSeries barSeries = new MockBarSeries(numFunction);
SMAIndicator smaIndicator = new SMAIndicator(new ClosePriceIndicator(barSeries), 5);
assertNumEquals(4998.0, smaIndicator.getValue(barSeries.getEndIndex()));
barSeries.getLastBar().addTra... |
public static String quoteStringLiteralForJson(String string)
{
return '"' + new String(JsonStringEncoder.getInstance().quoteAsUTF8(string)) + '"';
} | @Test
public void testQuoteJson()
{
assertEquals("\"foo\"", quoteStringLiteralForJson("foo"));
assertEquals("\"Presto's\"", quoteStringLiteralForJson("Presto's"));
assertEquals("\"xx\\\"xx\"", quoteStringLiteralForJson("xx\"xx"));
} |
public static Comparator<byte[]> arrayUnsignedComparator() {
return ARRAY_UNSIGNED_COMPARATOR;
} | @Test
@Parameters(method = "arrayUnsignedComparatorVectors")
public void testArrayUnsignedComparator(String stringA, String stringB, int expectedResult) {
Comparator<byte[]> comparator = ByteUtils.arrayUnsignedComparator();
byte[] a = ByteUtils.parseHex(stringA);
byte[] b = ByteUtils.par... |
Double getSum() {
if (count == 0) {
return null;
}
// Better error bounds to add both terms as the final sum
double tmp = sum + sumCompensation;
if (Double.isNaN(tmp) && Double.isInfinite(simpleSum)) {
// If the compensated sum is spuriously NaN from
// accumulat... | @Test
public void testEmptySum() {
DoubleStat sum = new DoubleStat();
assertNull(sum.getSum());
} |
public static String getArrayType(TypeRef<?> type) {
return getArrayType(getRawType(type));
} | @Test
public void getArrayTypeTest() {
assertEquals("int[][][][][]", TypeUtils.getArrayType(int[][][][][].class));
assertEquals("java.lang.Object[][][][][]", TypeUtils.getArrayType(Object[][][][][].class));
assertEquals("int[][][][][]", TypeUtils.getArrayType(TypeRef.of(int[][][][][].class)));
assertE... |
public boolean checkAccess(UserGroupInformation callerUGI,
ApplicationAccessType applicationAccessType, String applicationOwner,
ApplicationId applicationId) {
LOG.debug("Verifying access-type {} for {} on application {} owned by {}",
applicationAccessType, callerUGI, applicationId, applica... | @Test
void testCheckAccessWithNullACLS() {
Configuration conf = new Configuration();
conf.setBoolean(YarnConfiguration.YARN_ACL_ENABLE,
true);
conf.set(YarnConfiguration.YARN_ADMIN_ACL,
ADMIN_USER);
ApplicationACLsManager aclManager = new ApplicationACLsManager(conf);
UserGroupInfo... |
public static PersistenceSchema from(
final List<? extends SimpleColumn> columns,
final SerdeFeatures features
) {
return new PersistenceSchema(columns, features);
} | @Test(expected = IllegalArgumentException.class)
public void shouldThrowOnWrapIfMultipleFields() {
PersistenceSchema.from(MULTI_COLUMN, SerdeFeatures.of(SerdeFeature.WRAP_SINGLES));
} |
@Override
public void releaseDataView() {
memoryDataManagerOperation.onConsumerReleased(subpartitionId, consumerId);
} | @Test
void testRelease() {
CompletableFuture<HsConsumerId> consumerReleasedFuture = new CompletableFuture<>();
TestingMemoryDataManagerOperation memoryDataManagerOperation =
TestingMemoryDataManagerOperation.builder()
.setOnConsumerReleasedBiConsumer(
... |
@Override
public Mono<Subscription> subscribe(Subscription.Subscriber subscriber,
Subscription.InterestReason reason) {
return unsubscribe(subscriber, reason)
.then(Mono.defer(() -> {
var subscription = new Subscription();
subscription.setMetadata(new Meta... | @Test
public void testSubscribe() {
var spyNotificationCenter = spy(notificationCenter);
Subscription subscription = createSubscriptions().get(0);
var subscriber = subscription.getSpec().getSubscriber();
var reason = subscription.getSpec().getReason();
doReturn(Mono.empty(... |
private static <R extends JarRequestBody, M extends MessageParameters>
List<String> getProgramArgs(HandlerRequest<R> request, Logger log)
throws RestHandlerException {
JarRequestBody requestBody = request.getRequestBody();
@SuppressWarnings("deprecation")
List<Str... | @Test
void testFromRequestRequestBody() throws Exception {
final JarPlanRequestBody requestBody = getDummyJarPlanRequestBody("entry-class", 37, null);
final HandlerRequest<JarPlanRequestBody> request = getDummyRequest(requestBody);
final JarHandlerUtils.JarHandlerContext jarHandlerContext =... |
public static boolean isCarDrivingLicence(CharSequence value) {
return isMatchRegex(CAR_DRIVING_LICENCE, value);
} | @Test
public void isCarDrivingLicenceTest() {
assertTrue(Validator.isCarDrivingLicence("430101758218"));
} |
public <ConfigType extends ConfigInstance> ConfigType toInstance(Class<ConfigType> clazz, String configId) {
return ConfigInstanceUtil.getNewInstance(clazz, configId, this);
} | @Test
public void test_empty_payload() {
Slime slime = new Slime();
slime.setObject();
IntConfig config = new ConfigPayload(slime).toInstance(IntConfig.class, "");
assertThat(config.intVal(), is(1));
} |
@Override
public Collection<LocalDataQueryResultRow> getRows(final ExportStorageNodesStatement sqlStatement, final ContextManager contextManager) {
checkSQLStatement(contextManager.getMetaDataContexts().getMetaData(), sqlStatement);
String exportedData = generateExportData(contextManager.getMetaData... | @Test
void assertExecuteWithWrongDatabaseName() {
ContextManager contextManager = mockEmptyContextManager();
when(ProxyContext.getInstance().getContextManager()).thenReturn(contextManager);
when(ProxyContext.getInstance().getAllDatabaseNames()).thenReturn(Collections.singleton("empty_metadat... |
public int encodedLength()
{
if (presence() == CONSTANT)
{
return 0;
}
if (varLen)
{
return Token.VARIABLE_LENGTH;
}
return primitiveType.size() * length;
} | @Test
void shouldReturnCorrectSizeForPrimitiveTypes() throws Exception
{
final String testXmlString =
"<types>" +
" <type name=\"testTypeChar\" primitiveType=\"char\"/>" +
" <type name=\"testTypeInt8\" primitiveType=\"int8\"/>" +
" <type name=\"te... |
@Override
public Set<String> getValues(Extension object) {
if (getObjectType().isInstance(object)) {
return getNonNullValues(getObjectType().cast(object));
}
throw new IllegalArgumentException("Object type does not match");
} | @Test
void getValues() {
var attribute = new FunctionalMultiValueIndexAttribute<>(FakeExtension.class,
FakeExtension::getCategories);
var fake = new FakeExtension();
fake.setCategories(Set.of("test", "halo"));
assertThat(attribute.getValues(fake)).isEqualTo(fake.getCatego... |
public static List<BlockParserFactory> calculateBlockParserFactories(List<BlockParserFactory> customBlockParserFactories, Set<Class<? extends Block>> enabledBlockTypes) {
List<BlockParserFactory> list = new ArrayList<>();
// By having the custom factories come first, extensions are able to change behavi... | @Test
public void calculateBlockParserFactories_givenAListOfAllowedNodes_includesAssociatedFactories() {
List<BlockParserFactory> customParserFactories = List.of();
Set<Class<? extends Block>> nodes = new HashSet<>();
nodes.add(IndentedCodeBlock.class);
List<BlockParserFactory> bloc... |
public static KTableHolder<GenericKey> build(
final KGroupedStreamHolder groupedStream,
final StreamAggregate aggregate,
final RuntimeBuildContext buildContext,
final MaterializedFactory materializedFactory) {
return build(
groupedStream,
aggregate,
buildContext,
... | @Test
public void shouldBuildMaterializationCorrectlyForUnwindowedAggregate() {
// Given:
givenUnwindowedAggregate();
// When:
final KTableHolder<GenericKey> result = aggregate.build(planBuilder, planInfo);
// Then:
assertCorrectMaterializationBuilder(result, false);
} |
public static NacosRestTemplate getNacosRestTemplate(Logger logger) {
return getNacosRestTemplate(new DefaultHttpClientFactory(logger));
} | @Test
void testGetNacosRestTemplateWithDefault() {
assertTrue(restMap.isEmpty());
NacosRestTemplate actual = HttpClientBeanHolder.getNacosRestTemplate((Logger) null);
assertEquals(1, restMap.size());
NacosRestTemplate duplicateGet = HttpClientBeanHolder.getNacosRestTemplate((Logger) ... |
public static boolean isNotEmpty(@Nullable String string) {
return string != null && !string.isEmpty();
} | @Test
public void testEmptyString() {
assertThat(StringUtils.isNotEmpty("")).isFalse();
} |
public static int getTag(byte[] raw) {
try (final Asn1InputStream is = new Asn1InputStream(raw)) {
return is.readTag();
}
} | @Test
public void getTagDoubleByte() {
assertEquals(0x7f01, Asn1Utils.getTag(new byte[] { 0x7f, 0x01, 0}));
} |
@Override
public String execute(CommandContext commandContext, String[] args) {
if (args.length > 0) {
return "Unsupported parameter " + Arrays.toString(args) + " for pwd.";
}
String service =
commandContext.getRemote().attr(ChangeTelnet.SERVICE_KEY).get();
... | @Test
void testSlash() throws RemotingException {
defaultAttributeMap.attr(ChangeTelnet.SERVICE_KEY).set(null);
String result = pwdTelnet.execute(mockCommandContext, new String[0]);
assertEquals("/", result);
} |
public static String fix(final String raw) {
if ( raw == null || "".equals( raw.trim() )) {
return raw;
}
MacroProcessor macroProcessor = new MacroProcessor();
macroProcessor.setMacros( macros );
return macroProcessor.parse( raw );
} | @Test
public void testRetract() {
final String raw = "System.out.println(\"some text\");retract(object);";
assertEqualsIgnoreWhitespace( "System.out.println(\"some text\");drools.retract(object);",
KnowledgeHelperFixerTest.fixer.fix( raw ) );
} |
@Nullable String getCollectionName(BsonDocument command, String commandName) {
if (COMMANDS_WITH_COLLECTION_NAME.contains(commandName)) {
String collectionName = getNonEmptyBsonString(command.get(commandName));
if (collectionName != null) {
return collectionName;
}
}
// Some other ... | @Test void getCollectionName_notAllowListedCommand() {
assertThat(
listener.getCollectionName(new BsonDocument("cmd", new BsonString(" bar ")), "cmd")).isNull();
} |
public static LoggingContext forConnector(String connectorName) {
Objects.requireNonNull(connectorName);
LoggingContext context = new LoggingContext();
MDC.put(CONNECTOR_CONTEXT, prefixFor(connectorName, Scope.WORKER, null));
return context;
} | @Test
public void shouldNotAllowNullConnectorNameForConnectorContext() {
assertThrows(NullPointerException.class, () -> LoggingContext.forConnector(null));
} |
public static void mergeParams(
Map<String, ParamDefinition> params,
Map<String, ParamDefinition> paramsToMerge,
MergeContext context) {
if (paramsToMerge == null) {
return;
}
Stream.concat(params.keySet().stream(), paramsToMerge.keySet().stream())
.forEach(
name ... | @Test
public void testKeepMergeKeepOrder() {
Map<String, ParamDefinition> allParams = new LinkedHashMap<>();
Map<String, ParamDefinition> paramsToMerge = new LinkedHashMap<>();
String[] keyOrder = new String[40];
// add params with some order, and few overlapping
for (int i = 0; i < 20; i++) {
... |
public Set<Argument> getArguments(ServerWebExchange request, String namespace, String service) {
RateLimitProto.RateLimit rateLimitRule = serviceRuleManager.getServiceRateLimitRule(namespace, service);
if (rateLimitRule == null) {
return Collections.emptySet();
}
List<RateLimitProto.Rule> rules = rateLimitRu... | @Test
public void testGetRuleArguments() {
// Mock request
MetadataContext.LOCAL_SERVICE = "Test";
// Mock request
MockServerHttpRequest request = MockServerHttpRequest.get("http://127.0.0.1:8080/test")
.remoteAddress(new InetSocketAddress("127.0.0.1", 8080))
.header("xxx", "xxx")
.queryParam("yyy"... |
@Override
public Checksum compute(final InputStream in, final TransferStatus status) throws BackgroundException {
return new Checksum(HashAlgorithm.md5, this.digest("MD5",
this.normalize(in, status), status));
} | @Test
public void testCompute() throws Exception {
assertEquals("a43c1b0aa53a0c908810c06ab1ff3967",
new MD5FastChecksumCompute().compute(IOUtils.toInputStream("input", Charset.defaultCharset()), new TransferStatus()).hash);
} |
public static void main(String[] args) {
// create party and members
Party party = new PartyImpl();
var hobbit = new Hobbit();
var wizard = new Wizard();
var rogue = new Rogue();
var hunter = new Hunter();
// add party members
party.addMember(hobbit);
party.addMember(wizard);
p... | @Test
void shouldExecuteApplicationWithoutException() {
assertDoesNotThrow(() -> App.main(new String[]{}));
} |
@Override
public Map<String, Object> assembleFrom(OAuth2AccessTokenEntity accessToken, UserInfo userInfo, Set<String> authScopes) {
Map<String, Object> result = newLinkedHashMap();
OAuth2Authentication authentication = accessToken.getAuthenticationHolder().getAuthentication();
result.put(ACTIVE, true);
if (... | @Test
public void shouldAssembleExpectedResultForAccessToken() throws ParseException {
// given
OAuth2AccessTokenEntity accessToken = accessToken(new Date(123 * 1000L), scopes("foo", "bar"), null, "Bearer",
oauth2AuthenticationWithUser(oauth2Request("clientId"), "name"));
UserInfo userInfo = userInfo("sub"... |
@Override
public boolean equals(Object other) {
if (!(other instanceof Match)) {
return false;
}
Match<T> that = (Match<T>) other;
return this.matchAny == that.matchAny &&
Objects.equals(this.value, that.value) &&
this.negation == that.negati... | @Test
public void testEquals() {
Match<String> m1 = Match.any();
Match<String> m2 = Match.any();
Match<String> m3 = Match.ifNull();
Match<String> m4 = Match.ifValue("bar");
assertEquals(m1, m2);
assertFalse(Objects.equal(m1, m3));
assertFalse(Objects.equal(m3,... |
public Optional<Projection> createProjection(final ProjectionSegment projectionSegment) {
if (projectionSegment instanceof ShorthandProjectionSegment) {
return Optional.of(createProjection((ShorthandProjectionSegment) projectionSegment));
}
if (projectionSegment instanceof ColumnProj... | @Test
void assertCreateProjectionWhenProjectionSegmentInstanceOfAggregationProjectionSegment() {
AggregationProjectionSegment aggregationProjectionSegment = new AggregationProjectionSegment(0, 10, AggregationType.COUNT, "COUNT(1)");
Optional<Projection> actual = new ProjectionEngine(databaseType).cr... |
@Override
public boolean equals(Object o) {
if (this == o) {
return true;
}
if (o == null || getClass() != o.getClass()) {
return false;
}
DescriptorProperties that = (DescriptorProperties) o;
return Objects.equals(properties, that.properties);... | @Test
void testEquals() {
DescriptorProperties properties1 = new DescriptorProperties();
properties1.putString("hello1", "12");
properties1.putString("hello2", "13");
properties1.putString("hello3", "14");
DescriptorProperties properties2 = new DescriptorProperties();
... |
@Override
public double entropy() {
return entropy;
} | @Test
public void testEntropy() {
System.out.println("entropy");
WeibullDistribution instance = new WeibullDistribution(1.5, 1.0);
instance.rand();
assertEquals(0.78694011, instance.entropy(), 1E-7);
} |
@Override
public String toString() {
return "[" + Arrays.stream(MetadataVersion.VERSIONS).map(MetadataVersion::version).collect(
Collectors.joining(", ")) + "]";
} | @Test
public void testMetadataVersionValidator() {
String str = new MetadataVersionValidator().toString();
String[] apiVersions = str.substring(1).split(",");
assertEquals(MetadataVersion.VERSIONS.length, apiVersions.length);
} |
public JmxCollector register() {
return register(PrometheusRegistry.defaultRegistry);
} | @Test
public void testLabelsAreSet() throws Exception {
new JmxCollector(
"\n---\nrules:\n- pattern: `^hadoop<service=DataNode, name=DataNodeActivity-ams-hdd001-50010><>replaceBlockOpMinTime:`\n name: foo\n labels:\n l: v"
.replace('`', '"'))
... |
public static DatabaseBackendHandler newInstance(final QueryContext queryContext, final ConnectionSession connectionSession, final boolean preferPreparedStatement) {
SQLStatementContext sqlStatementContext = queryContext.getSqlStatementContext();
SQLStatement sqlStatement = sqlStatementContext.getSqlSta... | @Test
void assertNewInstanceReturnedUnicastDatabaseBackendHandlerWithQueryWithoutFrom() {
String sql = "SELECT 1";
SQLStatementContext sqlStatementContext = mock(SQLStatementContext.class);
when(sqlStatementContext.getSqlStatement()).thenReturn(mock(SelectStatement.class));
DatabaseB... |
@Override
public boolean othersUpdatesAreVisible(final int type) {
return false;
} | @Test
void assertOthersUpdatesAreVisible() {
assertFalse(metaData.othersUpdatesAreVisible(0));
} |
public T setEnvVariable(String key, String value) {
envVariables.put(
requireNonNull(key, "key can't be null"),
requireNonNull(value, "value can't be null"));
return castThis();
} | @Test
public void setEnvVariable_fails_with_NPE_if_value_is_null() throws IOException {
File workDir = temp.newFolder();
AbstractCommand underTest = new AbstractCommand(ProcessId.ELASTICSEARCH, workDir, System2.INSTANCE) {
};
assertThatThrownBy(() -> underTest.setEnvVariable(randomAlphanumeric(30), ... |
@Override
public SchemaAndValue toConnectData(String topic, byte[] value) {
try {
return new SchemaAndValue(schema, deserializer.deserialize(topic, value));
} catch (SerializationException e) {
throw new DataException("Failed to deserialize " + typeName + ": ", e);
}
... | @Test
public void testDeserializingDataWithTooManyBytes() {
assertThrows(DataException.class, () -> converter.toConnectData(TOPIC, new byte[10]));
} |
public void dump(DumpRequest dumpRequest) {
if (dumpRequest.isBeta()) {
dumpBeta(dumpRequest.getDataId(), dumpRequest.getGroup(), dumpRequest.getTenant(),
dumpRequest.getLastModifiedTs(), dumpRequest.getSourceIp());
} else if (dumpRequest.isBatch()) {
dumpBatc... | @Test
void dumpRequest() throws Throwable {
String dataId = "12345667dataId";
String group = "234445group";
DumpRequest dumpRequest = DumpRequest.create(dataId, group, "testtenant", System.currentTimeMillis(), "127.0.0.1");
// TaskManager dumpTaskMgr;
ReflectionTestUtils.setF... |
public Map<String, Object> toObjectMap(final String json) {
return GSON_MAP.fromJson(json, new TypeToken<LinkedHashMap<String, Object>>() {
}.getType());
} | @Test
public void testToObjectMap() {
Map<String, Object> map = ImmutableMap.of("id", 123L, "name", "test", "double", 1.0D,
"boolean", true, "data", generateTestObject());
String json = "{\"name\":\"test\",\"id\":123,\"double\":1.0,\"boolean\":true,\"data\":" + EXPECTED_JSON + "}";
... |
@Nullable
public static TraceContextOrSamplingFlags parseB3SingleFormat(CharSequence b3) {
return parseB3SingleFormat(b3, 0, b3.length());
} | @Test void parseB3SingleFormat_spanIdsUnsampled() {
assertThat(parseB3SingleFormat(traceId + "-" + spanId + "-0").context())
.isEqualToComparingFieldByField(TraceContext.newBuilder()
.traceId(Long.parseUnsignedLong(traceId, 16))
.spanId(Long.parseUnsignedLong(spanId, 16))
.sampled(fals... |
public static CustomWeighting.Parameters createWeightingParameters(CustomModel customModel, EncodedValueLookup lookup) {
String key = customModel.toString();
Class<?> clazz = customModel.isInternal() ? INTERNAL_CACHE.get(key) : null;
if (CACHE_SIZE > 0 && clazz == null)
clazz = CACHE... | @Test
public void parseValueWithError() {
CustomModel customModel1 = new CustomModel();
customModel1.addToSpeed(If("true", LIMIT, "unknown"));
IllegalArgumentException ret = assertThrows(IllegalArgumentException.class,
() -> CustomModelParser.createWeightingParameters(custom... |
@Override
public DescriptiveUrlBag toUrl(final Path file) {
final DescriptiveUrlBag list = new DescriptiveUrlBag();
if(file.attributes().getLink() != DescriptiveUrl.EMPTY) {
list.add(file.attributes().getLink());
}
list.add(new DescriptiveUrl(URI.create(String.format("%s%... | @Test
public void testDefaultPathRoot() {
Host host = new Host(new TestProtocol(), "localhost");
host.setDefaultPath("/");
Path path = new Path("/file", EnumSet.of(Path.Type.directory));
assertEquals("http://localhost/file", new DefaultUrlProvider(host).toUrl(path).find(DescriptiveUr... |
public static ThreadFactory createThreadFactory(final String pattern,
final boolean daemon) {
return new ThreadFactory() {
private final AtomicLong threadEpoch = new AtomicLong(0);
@Override
public Thread newThread(Runnable... | @Test
public void testThreadNameWithoutNumberDemon() {
Thread daemonThread = ThreadUtils.createThreadFactory(THREAD_NAME, true).newThread(EMPTY_RUNNABLE);
try {
assertEquals(THREAD_NAME, daemonThread.getName());
assertTrue(daemonThread.isDaemon());
} finally {
... |
public ManagedProcess launch(AbstractCommand command) {
EsInstallation esInstallation = command.getEsInstallation();
if (esInstallation != null) {
cleanupOutdatedEsData(esInstallation);
writeConfFiles(esInstallation);
}
Process process;
if (command instanceof JavaCommand<?> javaCommand)... | @Test
public void do_not_fail_if_outdated_es_directory_does_not_exist() throws Exception {
File tempDir = temp.newFolder();
File homeDir = temp.newFolder();
File dataDir = temp.newFolder();
File logDir = temp.newFolder();
ProcessLauncher underTest = new ProcessLauncherImpl(tempDir, commands, TestP... |
@Override
public MapSettings setProperty(String key, String value) {
return (MapSettings) super.setProperty(key, value);
} | @Test
public void should_load_values_of_deprecated_key() {
Settings settings = new MapSettings(definitions);
settings.setProperty("oldKey", "a,b");
assertThat(settings.getStringArray("newKey")).containsOnly("a", "b");
assertThat(settings.getStringArray("oldKey")).containsOnly("a", "b");
} |
public long getUnknown() {
return unknown;
} | @Test
public void testGetUnknown() {
assertEquals(TestParameters.VP_RES_TBL_UNKNOWN, chmLzxcResetTable.getUnknown());
} |
CompletableFuture<Map<TopicIdPartition, PartitionData>> processFetchResponse(
ShareFetchPartitionData shareFetchPartitionData,
List<Tuple2<TopicIdPartition, FetchPartitionData>> responseData
) {
Map<TopicIdPartition, CompletableFuture<PartitionData>> futures = new HashMap<>();
respon... | @Test
public void testProcessFetchResponse() {
String groupId = "grp";
String memberId = Uuid.randomUuid().toString();
Uuid topicId = Uuid.randomUuid();
TopicIdPartition tp0 = new TopicIdPartition(topicId, new TopicPartition("foo", 0));
TopicIdPartition tp1 = new TopicIdParti... |
public static synchronized @Nonnull Map<String, Object> loadYamlFile(File file)
throws Exception {
try (FileInputStream inputStream = new FileInputStream((file))) {
Map<String, Object> yamlResult =
(Map<String, Object>) loader.loadFromInputStream(inputStream);
... | @Test
void testLoadYamlFile_InvalidYAMLSyntaxException() {
File confFile = new File(tmpDir, "invalid.yaml");
try (final PrintWriter pw = new PrintWriter(confFile)) {
pw.println("key: value: secret");
} catch (FileNotFoundException e) {
throw new RuntimeException(e);
... |
public List<RawErasureCoderFactory> getCoders(String codecName) {
List<RawErasureCoderFactory> coders = coderMap.get(codecName);
return coders;
} | @Test
public void testGetCoders() {
List<RawErasureCoderFactory> coders = CodecRegistry.getInstance().
getCoders(ErasureCodeConstants.RS_CODEC_NAME);
assertEquals(2, coders.size());
assertTrue(coders.get(0) instanceof NativeRSRawErasureCoderFactory);
assertTrue(coders.get(1) instanceof RSR... |
@Override
public String getName() {
return ANALYZER_NAME;
} | @Test
public void testNuspecAnalysis() throws Exception {
File file = BaseTest.getResourceAsFile(this, "nuspec/test.nuspec");
Dependency result = new Dependency(file);
instance.analyze(result, null);
assertEquals(NuspecAnalyzer.DEPENDENCY_ECOSYSTEM, result.getEcosystem());
... |
@Override
public synchronized RoleRecvStatus deliverRoleReply(RoleReplyInfo rri)
throws SwitchStateException {
long xid = rri.getXid();
RoleState receivedRole = rri.getRole();
RoleState expectedRole = pendingReplies.getIfPresent(xid);
if (expectedRole == null) {
... | @Test
public void deliverRoleReply() {
RoleRecvStatus status;
RoleReplyInfo asserted = new RoleReplyInfo(MASTER, GID, XID);
RoleReplyInfo unasserted = new RoleReplyInfo(SLAVE, GID, XID);
try {
//call without sendRoleReq() for requestPending = false
//first, ... |
@Override
public BasicTypeDefine reconvert(Column column) {
BasicTypeDefine.BasicTypeDefineBuilder builder =
BasicTypeDefine.builder()
.name(column.getName())
.precision(column.getColumnLength())
.length(column.getColumn... | @Test
public void testReconvertUnsupported() {
Column column =
PhysicalColumn.of(
"test",
new MapType<>(BasicType.STRING_TYPE, BasicType.STRING_TYPE),
(Long) null,
true,
nu... |
@ScalarOperator(MODULUS)
@SqlType(StandardTypes.SMALLINT)
public static long modulus(@SqlType(StandardTypes.SMALLINT) long left, @SqlType(StandardTypes.SMALLINT) long right)
{
try {
return left % right;
}
catch (ArithmeticException e) {
throw new PrestoExcepti... | @Test
public void testModulus()
{
assertFunction("SMALLINT'37' % SMALLINT'37'", SMALLINT, (short) 0);
assertFunction("SMALLINT'37' % SMALLINT'17'", SMALLINT, (short) (37 % 17));
assertFunction("SMALLINT'17' % SMALLINT'37'", SMALLINT, (short) (17 % 37));
assertFunction("SMALLINT'1... |
public static boolean isClassNameSerializable(UserDefinedFunction function) {
final Class<?> functionClass = function.getClass();
if (!InstantiationUtil.hasPublicNullaryConstructor(functionClass)) {
// function must be parameterized
return false;
}
Class<?> curren... | @Test
void testSerialization() {
assertThat(isClassNameSerializable(new ValidTableFunction())).isTrue();
assertThat(isClassNameSerializable(new ValidScalarFunction())).isTrue();
assertThat(isClassNameSerializable(new ParameterizedTableFunction(12))).isFalse();
assertThat(isClassNa... |
@Override
public List<TenantDO> getTenantListByPackageId(Long packageId) {
return tenantMapper.selectListByPackageId(packageId);
} | @Test
public void testGetTenantListByPackageId() {
// mock 数据
TenantDO dbTenant1 = randomPojo(TenantDO.class, o -> o.setPackageId(1L));
tenantMapper.insert(dbTenant1);// @Sql: 先插入出一条存在的数据
TenantDO dbTenant2 = randomPojo(TenantDO.class, o -> o.setPackageId(2L));
tenantMapper.i... |
public String getPath() {
return path;
} | @Test
public void getPath() {
assertThat(sourceFile.getPath()).isEqualTo(DUMMY_PATH);
} |
void start() throws TransientKinesisException {
ImmutableMap.Builder<String, ShardRecordsIterator> shardsMap = ImmutableMap.builder();
for (ShardCheckpoint checkpoint : initialCheckpoint) {
shardsMap.put(checkpoint.getShardId(), createShardIterator(kinesis, checkpoint));
}
shardIteratorsMap.set(sh... | @Test
public void shouldStartReadingSuccessiveShardsAfterReceivingShardClosedException()
throws Exception {
when(firstIterator.readNextBatch()).thenThrow(KinesisShardClosedException.class);
when(firstIterator.findSuccessiveShardRecordIterators())
.thenReturn(ImmutableList.of(thirdIterator, fourt... |
public void writeXml(OutputStream out) throws IOException {
writeXml(new OutputStreamWriter(out, StandardCharsets.UTF_8));
} | @Test
public void testCDATA() throws IOException {
String xml = new String(
"<configuration>" +
"<property>" +
"<name>cdata</name>" +
"<value><![CDATA[>cdata]]></value>" +
"</property>\n" +
"<property>" +
"<name>cdata-multiple</name>" +
... |
@Override
public ParDoFn create(
PipelineOptions options,
CloudObject cloudUserFn,
@Nullable List<SideInputInfo> sideInputInfos,
TupleTag<?> mainOutputTag,
Map<TupleTag<?>, Integer> outputTupleTagsToReceiverIndices,
DataflowExecutionContext<?> executionContext,
DataflowOperat... | @Test
public void testCleanupWorks() throws Exception {
PipelineOptions options = PipelineOptionsFactory.create();
CounterSet counters = new CounterSet();
DoFn<?, ?> initialFn = new TestStatefulDoFn();
CloudObject cloudObject =
getCloudObject(initialFn, WindowingStrategy.of(FixedWindows.of(Dur... |
@Override
public boolean dropTable(TableIdentifier identifier, boolean purge) {
if (!isValidIdentifier(identifier)) {
return false;
}
String database = identifier.namespace().level(0);
TableOperations ops = newTableOps(identifier);
TableMetadata lastMetadata = null;
if (purge) {
... | @Test
public void testCreateTableCustomSortOrder() throws Exception {
Schema schema = getTestSchema();
PartitionSpec spec = PartitionSpec.builderFor(schema).bucket("data", 16).build();
SortOrder order = SortOrder.builderFor(schema).asc("id", NULLS_FIRST).build();
TableIdentifier tableIdent = TableIden... |
public synchronized Schema create(URI id, String refFragmentPathDelimiters) {
URI normalizedId = id.normalize();
if (!schemas.containsKey(normalizedId)) {
URI baseId = removeFragment(id).normalize();
if (!schemas.containsKey(baseId)) {
logger.debug("Reading sch... | @Test
public void createWithEmbeddedSelfRef() throws URISyntaxException {
URI schemaUri = getClass().getResource("/schema/embeddedRef.json").toURI();
SchemaStore schemaStore = new SchemaStore();
Schema topSchema = schemaStore.create(schemaUri, "#/.");
Schema embeddedSchema = schema... |
@Override
public void apply(IntentOperationContext<FlowRuleIntent> context) {
Optional<IntentData> toUninstall = context.toUninstall();
Optional<IntentData> toInstall = context.toInstall();
if (toInstall.isPresent() && toUninstall.isPresent()) {
Intent intentToInstall = toInstal... | @Test
public void testNoAnyIntentToApply() {
IntentData toInstall = null;
IntentData toUninstall = null;
IntentOperationContext<FlowRuleIntent> operationContext;
IntentInstallationContext context = new IntentInstallationContext(toUninstall, toInstall);
operationContext = new ... |
@Override
public Collection<V> values() {
return mInternalMap.values();
} | @Test
public void values() {
String x1 = new String("x");
String x2 = new String("x");
assertNull(mMap.put(x1, "z"));
assertNull(mMap.put(x2, "z"));
Collection<String> v = mMap.values();
assertEquals(2, v.size());
v.forEach(val -> assertEquals("z", val));
assertEquals("z", mMap.remove(... |
public Set<ContentPack> findAllById(ModelId id) {
final DBCursor<ContentPack> result = dbCollection.find(DBQuery.is(Identified.FIELD_META_ID, id));
return ImmutableSet.copyOf((Iterable<ContentPack>) result);
} | @Test
@MongoDBFixtures("ContentPackPersistenceServiceTest.json")
public void findAllByIdWithInvalidId() {
final Set<ContentPack> contentPacks = contentPackPersistenceService.findAllById(ModelId.of("does-not-exist"));
assertThat(contentPacks).isEmpty();
} |
public void getFields( RowMetaInterface inputRowMeta, String name, RowMetaInterface[] info, StepMeta nextStep,
VariableSpace space, Repository repository, IMetaStore metaStore ) throws KettleStepException {
String realresultfieldname = space.environmentSubstitute( resultfieldname );
if ( !Utils.isEmpty( rea... | @Test
public void testGetFields() throws KettleStepException {
CreditCardValidatorMeta meta = new CreditCardValidatorMeta();
meta.setDefault();
meta.setResultFieldName( "The Result Field" );
meta.setCardType( "The Card Type Field" );
meta.setNotValidMsg( "Is Card Valid" );
RowMeta rowMeta = n... |
public static String trim(String str) {
return str == null ? null : str.trim();
} | @Test
public void testTrim() {
Assert.assertNull(StringUtil.trim(null));
Assert.assertEquals("", StringUtil.trim(""));
Assert.assertEquals("foo", StringUtil.trim("foo "));
} |
public static Deserializer<LacpBaseTlv> deserializer() {
return (data, offset, length) -> {
checkInput(data, offset, length, LENGTH - HEADER_LENGTH);
LacpBaseTlv lacpBaseTlv = new LacpBaseTlv();
ByteBuffer bb = ByteBuffer.wrap(data, offset, length);
lacpBaseTlv.... | @Test
public void deserializer() throws Exception {
LacpBaseTlv actorInfo = LacpBaseTlv.deserializer().deserialize(data, 0, data.length);
assertEquals(SYS_PRIORITY, actorInfo.getSystemPriority());
assertEquals(SYS_MAC, actorInfo.getSystemMac());
assertEquals(KEY, actorInfo.getKey());... |
static int determineCoordinatorReservoirSize(int numPartitions) {
int reservoirSize = numPartitions * COORDINATOR_TARGET_PARTITIONS_MULTIPLIER;
if (reservoirSize < COORDINATOR_MIN_RESERVOIR_SIZE) {
// adjust it up and still make reservoirSize divisible by numPartitions
int remainder = COORDINATOR_M... | @Test
public void testCoordinatorReservoirSize() {
// adjusted to over min threshold of 10_000 and is divisible by number of partitions (3)
assertThat(SketchUtil.determineCoordinatorReservoirSize(3)).isEqualTo(10_002);
// adjust to multiplier of 100
assertThat(SketchUtil.determineCoordinatorReservoirS... |
@Override
protected void doStop() throws Exception {
// First stop the polling process
if (future != null) {
future.cancel(true);
}
super.doStop();
} | @Test
public void doStop() {
} |
public boolean processRow( StepMetaInterface smi, StepDataInterface sdi ) throws KettleException {
Object[] r = getRow(); // get row, set busy!
// no more input to be expected...
if ( r == null ) {
setOutputDone();
return false;
}
putRow( getInputRowMeta(), r ); // copy row to possible ... | @Test
public void testDummyTransWritesOutputWithInputRow() throws KettleException {
DummyTrans dummy =
new DummyTrans(
stepMockHelper.stepMeta, stepMockHelper.stepDataInterface, 0, stepMockHelper.transMeta,
stepMockHelper.trans );
dummy.init( stepMockHelper.initStepMetaInterface, stepMoc... |
@Override
public Set<KubevirtNetwork> networks() {
return ImmutableSet.copyOf(networkStore.networks());
} | @Test
public void testGetNetworks() {
createBasicNetworks();
assertEquals("Number of network did not match", 1, target.networks().size());
} |
public synchronized int sendFetches() {
final Map<Node, FetchSessionHandler.FetchRequestData> fetchRequests = prepareFetchRequests();
sendFetchesInternal(
fetchRequests,
(fetchTarget, data, clientResponse) -> {
synchronized (Fetcher.this) {
... | @Test
public void testFetchForgetTopicIdWhenReplaced() {
buildFetcher();
TopicIdPartition fooWithOldTopicId = new TopicIdPartition(Uuid.randomUuid(), new TopicPartition("foo", 0));
TopicIdPartition fooWithNewTopicId = new TopicIdPartition(Uuid.randomUuid(), new TopicPartition("foo", 0));
... |
@Override
public boolean isVersionCompatible(String hiveVersion, String dbVersion) {
hiveVersion = getEquivalentVersion(hiveVersion);
dbVersion = getEquivalentVersion(dbVersion);
if (hiveVersion.equals(dbVersion)) {
return true;
}
String[] hiveVerParts = hiveVersion.split("\\.");
String[... | @Test
public void testIsVersionCompatible() throws Exception {
// first argument is hiveVersion, it is compatible if 2nd argument - dbVersion is
// greater than or equal to it
// check the compatible case
IMetaStoreSchemaInfo metastoreSchemaInfo =
MetaStoreSchemaInfoFactory.get(MetastoreConf.n... |
@VisibleForTesting
static void setProxyProperties(Proxy proxy) {
String protocol = proxy.getProtocol();
setPropertySafe(protocol + ".proxyHost", proxy.getHost());
setPropertySafe(protocol + ".proxyPort", String.valueOf(proxy.getPort()));
setPropertySafe(protocol + ".proxyUser", proxy.getUsername());
... | @Test
public void testSetProxyProperties() {
Proxy httpProxy = new Proxy();
httpProxy.setProtocol("http");
httpProxy.setHost("host");
httpProxy.setPort(1080);
httpProxy.setUsername("user");
httpProxy.setPassword("pass");
httpProxy.setNonProxyHosts("non proxy hosts");
MavenSettingsProx... |
@Override
public ApiResult<TopicPartition, ListOffsetsResultInfo> handleResponse(
Node broker,
Set<TopicPartition> keys,
AbstractResponse abstractResponse
) {
ListOffsetsResponse response = (ListOffsetsResponse) abstractResponse;
Map<TopicPartition, ListOffsetsResultInfo>... | @Test
public void testHandleLookupRetriablePartitionInvalidMetadataResponse() {
TopicPartition errorPartition = t0p0;
Errors error = Errors.NOT_LEADER_OR_FOLLOWER;
Map<TopicPartition, Short> errorsByPartition = new HashMap<>();
errorsByPartition.put(errorPartition, error.code());
... |
@Override
public void write(final Path file, final Distribution distribution, final LoginCallback prompt) throws BackgroundException {
final Path container = session.getFeature(PathContainerService.class).getContainer(file);
try {
if(null == distribution.getId()) {
// No ... | @Test
public void testWriteNewDownload() throws Exception {
final AtomicBoolean set = new AtomicBoolean();
final CloudFrontDistributionConfiguration configuration = new CloudFrontDistributionConfiguration(session,
new S3LocationFeature(session), new DisabledX509TrustManager(), new De... |
void prioritizeCopiesAndShiftUps(List<MigrationInfo> migrations) {
for (int i = 0; i < migrations.size(); i++) {
prioritize(migrations, i);
}
if (logger.isFinestEnabled()) {
StringBuilder s = new StringBuilder("Migration order after prioritization: [");
int i... | @Test
public void testSingleMigrationPrioritization() throws UnknownHostException {
List<MigrationInfo> migrations = new ArrayList<>();
final MigrationInfo migration1 = new MigrationInfo(0, null, new PartitionReplica(new Address("localhost", 5701), uuids[0]), -1, -1, -1, 0);
migrations.add(m... |
public FloatArrayAsIterable usingTolerance(double tolerance) {
return new FloatArrayAsIterable(tolerance(tolerance), iterableSubject());
} | @Test
public void usingTolerance_containsExactly_primitiveFloatArray_failure() {
expectFailureWhenTestingThat(array(1.1f, TOLERABLE_2POINT2, 3.3f))
.usingTolerance(DEFAULT_TOLERANCE)
.containsExactly(array(2.2f, 1.1f));
assertFailureKeys(
"value of", "unexpected (1)", "---", "expected"... |
public static List<Path> pluginUrls(Path topPath) throws IOException {
boolean containsClassFiles = false;
Set<Path> archives = new TreeSet<>();
LinkedList<DirectoryEntry> dfs = new LinkedList<>();
Set<Path> visited = new HashSet<>();
if (isArchive(topPath)) {
return... | @Test
public void testPluginUrlsWithRelativeSymlinkForwards() throws Exception {
// Since this test case defines a relative symlink within an already included path, the main
// assertion of this test is absence of exceptions and correct resolution of paths.
createBasicDirectoryLayout();
... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.