focal_method stringlengths 13 60.9k | test_case stringlengths 25 109k |
|---|---|
@Override
public List<Intent> compile(SinglePointToMultiPointIntent intent,
List<Intent> installable) {
Set<Link> links = new HashSet<>();
final boolean allowMissingPaths = intentAllowsPartialFailure(intent);
boolean hasPaths = false;
boolean missingS... | @Test
public void testFilteredConnectPointIntent() {
FilteredConnectPoint ingress =
new FilteredConnectPoint(new ConnectPoint(DID_1, PORT_1));
Set<FilteredConnectPoint> egress = ImmutableSet.of(
new FilteredConnectPoint(new ConnectPoint(DID_3, PORT_1),
... |
@Override
public String getName() {
return name;
} | @Test
public void testEqualsAndHashCode() {
assumeDifferentHashCodes();
EqualsVerifier.forClass(RingbufferConfig.class)
.suppress(Warning.NULL_FIELDS, Warning.NONFINAL_FIELDS)
.withPrefabValues(RingbufferStoreConfigReadOnly.class,
... |
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
public void shouldNotRemoveGoodRefs() throws IOException {
final OpenAPI openAPI = getOpenAPI(RESOURCE_PATH);
assertNotNull(openAPI.getComponents().getSchemas().get("PetHeader"));
final RemoveUnreferencedDefinitionsFilter remover = new RemoveUnreferencedDefinitionsFilter();
fin... |
@Override
public String toString() {
return toString(false, null, BitcoinNetwork.MAINNET);
} | @Test
public void testCanonicalSigs() throws Exception {
// Tests the canonical sigs from Bitcoin Core unit tests
InputStream in = getClass().getResourceAsStream("sig_canonical.json");
// Poor man's JSON parser (because pulling in a lib for this is overkill)
while (in.available() > ... |
String driverPath(File homeDir, Provider provider) {
String dirPath = provider.path;
File dir = new File(homeDir, dirPath);
if (!dir.exists()) {
throw new MessageException("Directory does not exist: " + dirPath);
}
List<File> files = new ArrayList<>(FileUtils.listFiles(dir, new String[] {"jar"... | @Test
public void driver_dir_does_not_exist() {
assertThatThrownBy(() -> underTest.driverPath(homeDir, Provider.ORACLE))
.isInstanceOf(MessageException.class)
.hasMessage("Directory does not exist: extensions/jdbc-driver/oracle");
} |
@Override
public void incrementThreads() {
consumeTokens();
super.incrementThreads();
} | @Test
public void testIncrementThreads()
throws Exception {
// set test time first
_timeMillis = 100;
TestTokenSchedulerGroup group = new TestTokenSchedulerGroup();
int availableTokens = group.getAvailableTokens();
// verify token count is correctly set
assertEquals(availableTokens,
... |
@Override
public void updateHost(K8sHost host) {
checkNotNull(host, ERR_NULL_HOST);
hostStore.updateHost(host);
log.info(String.format(MSG_HOST, host.hostIp().toString(), MSG_UPDATED));
} | @Test
public void testAddNodesToHost() {
K8sHost updated = HOST_2.updateNodeNames(ImmutableSet.of("3", "4", "5"));
target.updateHost(updated);
validateEvents(K8S_HOST_UPDATED, K8S_NODES_ADDED);
} |
@Override
public Serializable read(final MySQLBinlogColumnDef columnDef, final MySQLPacketPayload payload) {
int time = payload.getByteBuf().readUnsignedMediumLE();
if (0 == time) {
return MySQLTimeValueUtils.ZERO_OF_TIME;
}
int minuteSecond = Math.abs(time) % 10000;
... | @Test
void assertReadNullTime() {
when(payload.getByteBuf()).thenReturn(byteBuf);
when(byteBuf.readUnsignedMediumLE()).thenReturn(0);
assertThat(new MySQLTimeBinlogProtocolValue().read(columnDef, payload), is(MySQLTimeValueUtils.ZERO_OF_TIME));
} |
public void isAnyOf(
@Nullable Object first, @Nullable Object second, @Nullable Object @Nullable ... rest) {
isIn(accumulate(first, second, rest));
} | @Test
public void isAnyOfJustTwo() {
assertThat("b").isAnyOf("a", "b");
} |
@Override
public int read() {
if (nextChar == UNSET || nextChar >= buf.length) {
fill();
if (nextChar == UNSET) {
return END_OF_STREAM;
}
}
byte signedByte = buf[nextChar];
nextChar++;
return signedByte & 0xFF;
} | @Test
void read_from_ClosableIterator_with_single_empty_line() throws IOException {
assertThat(read(create(""))).isEmpty();
} |
@Override
@SuppressWarnings("deprecation")
public HttpClientOperations addHandler(ChannelHandler handler) {
super.addHandler(handler);
return this;
} | @Test
void addEncoderReplaysLastHttp() {
ByteBuf buf = Unpooled.copiedBuffer("{\"foo\":1}", CharsetUtil.UTF_8);
EmbeddedChannel channel = new EmbeddedChannel();
new HttpClientOperations(() -> channel, ConnectionObserver.emptyListener(),
ClientCookieEncoder.STRICT, ClientCookieDecoder.STRICT, ReactorNettyHttp... |
@Override
public synchronized void execute() {
boolean debugMode = conf.isLoadBalancerDebugModeEnabled() || log.isDebugEnabled();
if (debugMode) {
log.info("Load balancer enabled: {}, Shedding enabled: {}.",
conf.isLoadBalancerEnabled(), conf.isLoadBalancerSheddingEna... | @Test(timeOut = 30 * 1000)
public void testExecuteSuccess() {
AtomicReference<List<Metrics>> reference = new AtomicReference<>();
UnloadCounter counter = new UnloadCounter();
LoadManagerContext context = setupContext();
BrokerRegistry registry = context.brokerRegistry();
Serv... |
@Override
protected EnumDeclaration create(CompilationUnit compilationUnit) {
EnumDeclaration lambdaClass = super.create(compilationUnit);
boolean hasDroolsParameter = lambdaParameters.stream().anyMatch(this::isDroolsParameter);
if (hasDroolsParameter) {
bitMaskVariables.forEach... | @Test
public void createConsequenceWithMultipleFieldUpdate() {
ArrayList<String> fields = new ArrayList<>();
fields.add("\"age\"");
fields.add("\"likes\"");
MaterializedLambda.BitMaskVariable bitMaskVariable = new MaterializedLambda.BitMaskVariableWithFields("DomainClassesMetadata534... |
@Override
public List<URI> get() {
return resultsCachingSupplier.get();
} | @Test
void testAutomaticDiscoveryOneUnconfigured() {
final IndexerDiscoveryProvider provider = new IndexerDiscoveryProvider(
Collections.emptyList(),
1,
Duration.seconds(1),
preflightConfig(PreflightConfigResult.FINISHED),
nodes... |
public void setProperty(String name, String value) {
if (value == null) {
return;
}
name = Introspector.decapitalize(name);
PropertyDescriptor prop = getPropertyDescriptor(name);
if (prop == null) {
addWarn("No such property [" + name + "] in " + objClass.getName() + ".");
} else ... | @Test
public void testSetProperty() {
{
House house = new House();
PropertySetter setter = new PropertySetter(house);
setter.setProperty("count", "10");
setter.setProperty("temperature", "33.1");
setter.setProperty("name", "jack");
setter.setProperty("open", "true");
... |
@Deprecated
public String getConnectionPath() {
return getPath();
} | @Test
public void getConnectionPathTest() {
VFSFile file = new VFSFile();
String pvfsPath = "pvfs://someConnectionName/bucket/to/file/file.txt";
file.setPath( pvfsPath );
file.setConnection( "someConnectionName" );
Assert.assertEquals( pvfsPath, file.getConnectionPath() );
} |
@Override
public double getDouble(final int columnIndex) throws SQLException {
return (double) ResultSetUtils.convertValue(mergeResultSet.getValue(columnIndex, double.class), double.class);
} | @Test
void assertGetDoubleWithColumnLabel() throws SQLException {
when(mergeResultSet.getValue(1, double.class)).thenReturn(1.0D);
assertThat(shardingSphereResultSet.getDouble("label"), is(1.0D));
} |
public boolean acquire(long messageCreateTime) {
if (isDelayed(messageCreateTime)) {
return eventRateLimiter.tryAcquire();
}
return false;
} | @Test
public void testAcquire() throws InterruptedException {
double permitsPerSecond = 0.5;
Duration delayThreshold = Duration.ofMillis(1000);
MessageDelayedEventLimiter delayedEventLimiter =
new MessageDelayedEventLimiter(delayThreshold, permitsPerSecond);
long end... |
static <T extends Type> String encodeArrayValues(Array<T> value) {
StringBuilder result = new StringBuilder();
for (Type type : value.getValue()) {
result.append(encode(type));
}
return result.toString();
} | @Test
public void testDynamicStructStaticArray() {
StaticArray3<Foo> array =
new StaticArray3<>(
Foo.class, new Foo("", ""), new Foo("id", "name"), new Foo("", ""));
assertEquals(
("0000000000000000000000000000000000000000000000000000000000000... |
@VisibleForTesting
CompletableFuture<Optional<SendPushNotificationResult>> sendNotification(final PushNotification pushNotification) {
if (pushNotification.tokenType() == PushNotification.TokenType.APN && !pushNotification.urgent()) {
// APNs imposes a per-device limit on background push notifications; sche... | @Test
void testSendNotificationUnregisteredApnTokenUpdated() {
final Instant tokenTimestamp = Instant.now();
final Account account = mock(Account.class);
final Device device = mock(Device.class);
final UUID aci = UUID.randomUUID();
when(device.getId()).thenReturn(Device.PRIMARY_ID);
when(devi... |
@Override
public void onAddedJobGraph(JobID jobId) {
runIfStateIs(State.RUNNING, () -> handleAddedJobGraph(jobId));
} | @Test
void onAddedJobGraph_submitsRecoveredJob() throws Exception {
final CompletableFuture<JobGraph> submittedJobFuture = new CompletableFuture<>();
final TestingDispatcherGateway testingDispatcherGateway =
TestingDispatcherGateway.newBuilder()
.setSubmitFunc... |
public Properties getProperties()
{
return properties;
} | @Test
void testUriWithSocksProxy()
throws SQLException
{
PrestoDriverUri parameters = createDriverUri("presto://localhost:8080?socksProxy=localhost:1234");
assertUriPortScheme(parameters, 8080, "http");
Properties properties = parameters.getProperties();
assertEquals... |
@Override
public Object convert(String value) {
if (isNullOrEmpty(value)) {
return value;
}
if (value.contains("=")) {
final Map<String, String> fields = new HashMap<>();
Matcher m = PATTERN.matcher(value);
while (m.find()) {
... | @Test
public void testFilterWithMixedSingleQuotedAndPlainValues() {
TokenizerConverter f = new TokenizerConverter(new HashMap<String, Object>());
@SuppressWarnings("unchecked")
Map<String, String> result = (Map<String, String>) f.convert("otters in k1='v1' k2=v2 more otters");
asser... |
@Override
public String toString() {
final String s = red.toString();
final StringBuilder h = new StringBuilder();
// Hex dump the small ones.
if (s.length() < 8) {
for (int i = 0; i < s.length(); i++) {
h.append(" ").append(Integer.toHexString(s.charAt(i)... | @Test
public void testToString() throws IOException {
String data = "test";
InputStream stream = new ByteArrayInputStream(data.getBytes(StandardCharsets.UTF_8));
XmlInputStream instance = new XmlInputStream(stream);
int r = instance.read();
assertEquals('t', r);
Strin... |
@ExecuteOn(TaskExecutors.IO)
@Post(uri = "/replay/by-query")
@Operation(tags = {"Executions"}, summary = "Create new executions from old ones filter by query parameters. Keep the flow revision")
public HttpResponse<?> replayByQuery(
@Parameter(description = "A string filter") @Nullable @QueryValue(v... | @Test
void replayByQuery() throws TimeoutException {
Execution execution1 = runnerUtils.runOne(null, "io.kestra.tests", "each-sequential-nested");
Execution execution2 = runnerUtils.runOne(null, "io.kestra.tests", "each-sequential-nested");
assertThat(execution1.getState().isTerminated(), i... |
@Override
public void define(Context context) {
NewController controller = context.createController("api/developers")
.setDescription("Return data needed by SonarLint.")
.setSince("1.0");
actions.forEach(action -> action.define(controller));
controller.done();
} | @Test
public void definition() {
WebService.Context context = new WebService.Context();
underTest.define(context);
WebService.Controller controller = context.controller("api/developers");
assertThat(controller).isNotNull();
assertThat(controller.description()).isNotEmpty();
assertThat(control... |
@PublicAPI(usage = ACCESS)
public JavaClass getClassWithSimpleName(String className) {
return getValue(tryGetClassWithSimpleName(className),
"This package does not contain any class with simple name '%s'", className);
} | @Test
public void rejects_retrieving_non_existing_classes_by_simple_name() {
assertThatThrownBy(
() -> importDefaultPackage().getClassWithSimpleName(Object.class.getSimpleName())
)
.isInstanceOf(IllegalArgumentException.class)
.hasMessageContaining("do... |
private void merge(ContentNodeStats stats, int factor) {
for (Map.Entry<String, BucketSpaceStats> entry : stats.bucketSpaces.entrySet()) {
BucketSpaceStats statsToUpdate = bucketSpaces.get(entry.getKey());
if (statsToUpdate == null && factor == 1) {
statsToUpdate = Bucket... | @Test
void bucket_space_stats_can_transition_from_invalid_to_valid() {
BucketSpaceStats stats = BucketSpaceStats.invalid();
assertFalse(stats.valid());
stats.merge(BucketSpaceStats.of(5, 1), 1);
assertFalse(stats.valid());
stats.merge(BucketSpaceStats.invalid(), -1);
... |
public MonitorBuilder username(String username) {
this.username = username;
return getThis();
} | @Test
void username() {
MonitorBuilder builder = MonitorBuilder.newBuilder();
builder.username("username");
Assertions.assertEquals("username", builder.build().getUsername());
} |
public void registerStrategy(BatchingStrategy<?, ?, ?> strategy) {
_strategies.add(strategy);
} | @Test
public void testBatchWithTimeoutAndSingleton() {
RecordingStrategy<Integer, Integer, String> strategy =
new RecordingStrategy<Integer, Integer, String>((key, promise) -> promise.done(String.valueOf(key)), key -> key % 2) {
@Override
public void executeBatch(final Integer group, final Ba... |
public JmxCollector register() {
return register(PrometheusRegistry.defaultRegistry);
} | @Test
public void nestedTabularDataTest() throws Exception {
JmxCollector jc = new JmxCollector("---").register(prometheusRegistry);
assertEquals(
338,
getSampleValue(
"Hadoop_DataNodeInfo_DatanodeNetworkCounts",
new Str... |
boolean hasActivity(Activity activity) {
if (activity != null) {
return hashSet.contains(activity.hashCode());
}
return false;
} | @Test
public void hasActivity() {
mActivityLifecycle.addActivity(mActivity);
assertTrue(mActivityLifecycle.hasActivity(mActivity));
} |
@Override
public synchronized void cancel(final BackgroundAction action) {
if(action.isRunning()) {
log.debug(String.format("Skip removing action %s currently running", action));
}
else {
this.remove(action);
}
} | @Test
public void testCancel() {
BackgroundActionRegistry r = new BackgroundActionRegistry();
final AbstractBackgroundAction action = new AbstractBackgroundAction() {
@Override
public Object run() {
return null;
}
};
assertTrue(r.ad... |
@Override
public boolean containsEntry(Object key, Object value) {
return get(containsEntryAsync(key, value));
} | @Test
public void testContainsEntry() {
RListMultimap<SimpleKey, SimpleValue> map = redisson.getListMultimap("test1");
map.put(new SimpleKey("0"), new SimpleValue("1"));
assertThat(map.containsEntry(new SimpleKey("0"), new SimpleValue("1"))).isTrue();
assertThat(map.containsEntry(ne... |
public boolean isActivated() {
return !StringUtils.isBlank(configuration.getSmtpHost());
} | @Test
public void isActivated_returns_false_if_smpt_host_is_null() {
when(configuration.getSmtpHost()).thenReturn(null);
assertThat(underTest.isActivated()).isFalse();
} |
@ConstantFunction(name = "datediff", argTypes = {DATETIME, DATETIME}, returnType = INT, isMonotonic = true)
public static ConstantOperator dateDiff(ConstantOperator first, ConstantOperator second) {
return ConstantOperator.createInt((int) Duration.between(
second.getDatetime().truncatedTo(Ch... | @Test
public void dateDiff() {
assertEquals(-1602,
ScalarOperatorFunctions.dateDiff(O_DT_20101102_183010, O_DT_20150323_092355).getInt());
assertEquals(-1572, ScalarOperatorFunctions.dateDiff(O_DT_20101202_023010, O_DT_20150323_092355).getInt());
} |
@VisibleForTesting
static SwitchGenerationCase checkSwitchGenerationCase(Type type, List<RowExpression> values)
{
if (values.size() > 32) {
// 32 is chosen because
// * SET_CONTAINS performs worst when smaller than but close to power of 2
// * Benchmark shows performa... | @Test
public void testVarchar()
{
List<RowExpression> values = new ArrayList<>();
values.add(constant(Slices.utf8Slice("1"), VARCHAR));
values.add(constant(Slices.utf8Slice("2"), VARCHAR));
values.add(constant(Slices.utf8Slice("3"), VARCHAR));
assertEquals(checkSwitchGene... |
@Override
public Optional<ConfigItem> resolve(final String propertyName, final boolean strict) {
if (propertyName.startsWith(KSQL_REQUEST_CONFIG_PROPERTY_PREFIX)) {
return resolveRequestConfig(propertyName);
} else if (propertyName.startsWith(KSQL_CONFIG_PROPERTY_PREFIX)
&& !propertyName.starts... | @Test
public void shouldNotFindUnknownStreamsPrefixedConsumerPropertyIfStrict() {
// Given:
final String configName = KsqlConfig.KSQL_STREAMS_PREFIX
+ StreamsConfig.CONSUMER_PREFIX
+ "custom.interceptor.config";
// Then:
assertThat(resolver.resolve(configName, true), is(Optional.empty... |
void start(Iterable<ShardCheckpoint> checkpoints) {
LOG.info(
"Pool {} - starting for stream {} consumer {}. Checkpoints = {}",
poolId,
read.getStreamName(),
consumerArn,
checkpoints);
for (ShardCheckpoint shardCheckpoint : checkpoints) {
checkState(
!stat... | @Test
public void poolReSubscribesWhenManyRecoverableErrorsOccur() throws Exception {
kinesis = new EFOStubbedKinesisAsyncClient(1);
for (int i = 0; i < 250; i++) {
kinesis
.stubSubscribeToShard("shard-000", eventsWithRecords(i, 1))
.failWith(new ReadTimeoutException());
}
... |
public static void validate(JobMetaDataParameterObject parameterObject) {
Path jarPath = parameterObject.getJarPath();
validateJarPathNotNull(jarPath);
validateFileSizeIsNotZero(jarPath);
validateFileExtension(jarPath);
validateJobParameters(parameterObject.getJobParameters());
... | @Test
public void testValidateJarOnMember() {
JobMetaDataParameterObject parameterObject = new JobMetaDataParameterObject();
assertThatThrownBy(() -> JarOnMemberValidator.validate(parameterObject))
.isInstanceOf(JetException.class);
} |
public JWT parse(String token) {
Assert.notBlank(token, "Token String must be not blank!");
final List<String> tokens = splitToken(token);
this.tokens = tokens;
this.header.parse(tokens.get(0), this.charset);
this.payload.parse(tokens.get(1), this.charset);
return this;
} | @Test
public void parseTest() {
final String rightToken = "eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9." +
"eyJzdWIiOiIxMjM0NTY3ODkwIiwiYWRtaW4iOnRydWUsIm5hbWUiOiJsb29seSJ9." +
"U2aQkC2THYV9L0fTN-yBBI7gmo5xhmvMhATtu8v0zEA";
final JWT jwt = JWT.of(rightToken);
assertTrue(jwt.setKey("1234567890".getBytes()).verif... |
@Override
public Map<Consumer, List<Range>> getConsumerKeyHashRanges() {
Map<Consumer, List<Range>> result = new HashMap<>();
Map.Entry<Integer, Consumer> prev = null;
for (Map.Entry<Integer, Consumer> entry: rangeMap.entrySet()) {
if (prev == null) {
prev = entry... | @Test
public void testGetConsumerKeyHashRanges() throws ExecutionException, InterruptedException {
HashRangeExclusiveStickyKeyConsumerSelector selector = new HashRangeExclusiveStickyKeyConsumerSelector(10);
List<String> consumerName = Arrays.asList("consumer1", "consumer2", "consumer3", "consumer4")... |
private ItemDTO createItem(long namespaceId, long itemId, String value) {
ItemDTO item = new ItemDTO();
item.setId(itemId);
item.setNamespaceId(namespaceId);
item.setValue(value);
item.setLineNum(1);
item.setKey(ConfigConsts.CONFIG_FILE_CONTENT_KEY);
return item;
} | @Test
public void testCreateItem(){
ItemChangeSets changeSets = resolver.resolve(NAMESPACE, CONFIG_TEXT, Collections.emptyList());
Assert.assertEquals(1, changeSets.getCreateItems().size());
Assert.assertEquals(0, changeSets.getUpdateItems().size());
Assert.assertEquals(0, changeSets.getDeleteItems()... |
@Subscribe
public void onChatMessage(ChatMessage chatMessage)
{
if (chatMessage.getType() != ChatMessageType.TRADE
&& chatMessage.getType() != ChatMessageType.GAMEMESSAGE
&& chatMessage.getType() != ChatMessageType.SPAM
&& chatMessage.getType() != ChatMessageType.FRIENDSCHATNOTIFICATION)
{
return;
}... | @Test
public void testZukKill()
{
ChatMessage chatMessage = new ChatMessage(null, GAMEMESSAGE, "", "Your TzKal-Zuk kill count is: <col=ff0000>3</col>.", null, 0);
chatCommandsPlugin.onChatMessage(chatMessage);
chatMessage = new ChatMessage(null, GAMEMESSAGE, "", "Duration: <col=ff0000>172:18</col>. Personal be... |
public static Object cast(Class<?> clazz, Object value) {
try {
return clazz.cast(value);
} catch (ClassCastException e) {
return null;
}
} | @Test
public void castTest() {
TestClass testClass = new TestSubClass();
Object cast = ReflectUtil.cast(TestSubClass.class, testClass);
Assert.assertTrue(cast instanceof TestSubClass);
} |
public static CuratorFramework createCurator(ZooKeeperCuratorConfiguration configuration) {
CuratorFramework curator = configuration.getCuratorFramework();
if (curator == null) {
// Validate parameters
ObjectHelper.notNull(configuration.getNodes(), "ZooKeeper Nodes");
... | @Test
public void testCreateCuratorRetryPolicy() {
ZooKeeperCuratorConfiguration configuration = new ZooKeeperCuratorConfiguration();
configuration.setNodes("nodes1,node2,node3");
configuration.setReconnectBaseSleepTime(10);
configuration.setReconnectMaxRetries(3);
configura... |
@Override
public Optional<ProtobufSystemInfo.SystemInfo> retrieveSystemInfo() {
return call(SystemInfoActionClient.INSTANCE);
} | @Test
public void retrieveSystemInfo_get_information_if_process_is_up() {
Buffer response = new Buffer();
response.read(ProtobufSystemInfo.Section.newBuilder().build().toByteArray());
server.enqueue(new MockResponse().setBody(response));
// initialize registration of process
setUpWithHttpUrl(Proc... |
public void cleanSelectorDataSelf(final List<SelectorData> selectorDataList) {
selectorDataList.forEach(this::removeSelectData);
} | @Test
public void testCleanSelectorDataSelf() throws NoSuchFieldException, IllegalAccessException {
SelectorData firstCachedSelectorData = SelectorData.builder().id("1").pluginName(mockPluginName1).build();
SelectorData secondCachedSelectorData = SelectorData.builder().id("2").pluginName(mockPluginN... |
public static Map<String, String> resolveAttachments(Object invocation, boolean isApache) {
if (invocation == null) {
return Collections.emptyMap();
}
final Map<String, String> attachments = new HashMap<>();
if (isApache) {
attachments.putAll(getAttachmentsFromCon... | @Test
public void testNull() {
final Map<String, String> map = DubboAttachmentsHelper.resolveAttachments(null, false);
Assert.assertEquals(map, Collections.emptyMap());
final Map<String, String> map2 = DubboAttachmentsHelper.resolveAttachments(null, true);
Assert.assertEquals(map2, C... |
public Node parse() throws ScanException {
return E();
} | @Test
public void lbcore193() throws Exception {
try {
Parser<Object> p = new Parser<>("hello%(abc");
p.setContext(context);
p.parse();
Assertions.fail("where the is exception?");
} catch (ScanException ise) {
Assertions.assertEquals("Expec... |
@Override
public String asLongText() {
String longValue = this.longValue;
if (longValue == null) {
this.longValue = longValue = newLongValue();
}
return longValue;
} | @Test
public void testDeserialization() throws Exception {
// DefaultChannelId with 8 byte machineId
final DefaultChannelId c8 = new DefaultChannelId(
new byte[] {
(byte) 0x01, (byte) 0x23, (byte) 0x45, (byte) 0x67,
(byte) 0x89, (byte) ... |
@Override
public PageResult<OAuth2AccessTokenDO> getAccessTokenPage(OAuth2AccessTokenPageReqVO reqVO) {
return oauth2AccessTokenMapper.selectPage(reqVO);
} | @Test
public void testGetAccessTokenPage() {
// mock 数据
OAuth2AccessTokenDO dbAccessToken = randomPojo(OAuth2AccessTokenDO.class, o -> { // 等会查询到
o.setUserId(10L);
o.setUserType(1);
o.setClientId("test_client");
o.setExpiresTime(LocalDateTime.now().plu... |
public synchronized TopologyDescription describe() {
return internalTopologyBuilder.describe();
} | @Test
public void sessionWindowZeroArgCountWithTopologyConfigShouldPreserveTopologyStructure() {
// override the default store into in-memory
final StreamsBuilder builder = new StreamsBuilder(overrideDefaultStore(StreamsConfig.IN_MEMORY));
builder.stream("input-topic")
.groupByKe... |
public static Read read() {
return new Read(null, "", new Scan());
} | @Test
public void testReadingKeyRangeMiddle() throws Exception {
final String table = tmpTable.getName();
final int numRows = 1001;
final byte[] startRow = "2".getBytes(StandardCharsets.UTF_8);
final byte[] stopRow = "9".getBytes(StandardCharsets.UTF_8);
createAndWriteData(table, numRows);
//... |
public boolean includes(String ipAddress) {
if (all) {
return true;
}
if (ipAddress == null) {
throw new IllegalArgumentException("ipAddress is null.");
}
try {
return includes(addressFactory.getByName(ipAddress));
} catch (UnknownHostException e) {
return fals... | @Test
public void testIPListSpaces() {
//create MachineList with a ip string which has duplicate ip and spaces
MachineList ml = new MachineList(IP_LIST_SPACES, new TestAddressFactory());
//test for inclusion with an known IP
assertTrue(ml.includes("10.119.103.112"));
//test for exclusion with an... |
public void close() {
synchronized (this) {
if (!closed) {
leaderCopyRLMTasks.values().forEach(RLMTaskWithFuture::cancel);
leaderExpirationRLMTasks.values().forEach(RLMTaskWithFuture::cancel);
followerRLMTasks.values().forEach(RLMTaskWithFuture::cancel... | @Test
void testIdempotentClose() throws IOException {
remoteLogManager.close();
remoteLogManager.close();
InOrder inorder = inOrder(remoteStorageManager, remoteLogMetadataManager);
inorder.verify(remoteStorageManager, times(1)).close();
inorder.verify(remoteLogMetadataManager... |
public SSLContext createContext(ContextAware context) throws NoSuchProviderException,
NoSuchAlgorithmException, KeyManagementException,
UnrecoverableKeyException, KeyStoreException, CertificateException {
SSLContext sslContext = getProvider() != null ?
SSLContext.getInstance(getProtocol(), getP... | @Test
public void testCreateContext() throws Exception {
factoryBean.setKeyManagerFactory(keyManagerFactory);
factoryBean.setKeyStore(keyStore);
factoryBean.setTrustManagerFactory(trustManagerFactory);
factoryBean.setTrustStore(trustStore);
factoryBean.setSecureRandom(secureRandom);
assertNot... |
@Override
public HttpOverXmppResp parse(XmlPullParser parser, int initialDepth, IqData iqData, XmlEnvironment xmlEnvironment) throws IOException, XmlPullParserException, SmackParsingException {
String version = parser.getAttributeValue("", ATTRIBUTE_VERSION);
String statusMessage = parser.getAttribu... | @Test
public void areAllRespAttributesCorrectlyParsed() throws Exception {
String string = "<resp xmlns='urn:xmpp:http' version='1.1' statusCode='200' statusMessage='OK'/>";
HttpOverXmppRespProvider provider = new HttpOverXmppRespProvider();
XmlPullParser parser = PacketParserUtils.getParser... |
@Override
public Mono<Authentication> convert(ServerWebExchange exchange) {
return super.convert(exchange)
// validate the password
.<Authentication>flatMap(token -> {
var credentials = (String) token.getCredentials();
byte[] credentialsBytes;
... | @Test
void applyPasswordWithoutBase64FormatThenBadCredentialsException() {
var username = "username";
var password = "+invalid-base64-format-password";
formData.add("username", username);
formData.add("password", password);
StepVerifier.create(converter.convert(exchange))
... |
@Override
public int division(int n1, int n2) throws Exception {
int n5 = n1 / n2;
return n5;
} | @Test
public void testDivision() throws Exception {
Controlador controlador = new Controlador();
int result = controlador.division(6, 3);
assertEquals(2, result);
} |
public static String removeLeadingAndEndingQuotes(final String s) {
if (ObjectHelper.isEmpty(s)) {
return s;
}
String copy = s.trim();
if (copy.length() < 2) {
return s;
}
if (copy.startsWith("'") && copy.endsWith("'")) {
return copy.s... | @Test
public void testRemoveLeadingAndEndingQuotes() {
assertEquals("abc", removeLeadingAndEndingQuotes("'abc'"));
assertEquals("abc", removeLeadingAndEndingQuotes("\"abc\""));
assertEquals("a'b'c", removeLeadingAndEndingQuotes("a'b'c"));
assertEquals("'b'c", removeLeadingAndEndingQu... |
public void fillMaxSpeed(Graph graph, EncodingManager em) {
// In DefaultMaxSpeedParser and in OSMMaxSpeedParser we don't have the rural/urban info,
// but now we have and can fill the country-dependent max_speed value where missing.
EnumEncodedValue<UrbanDensity> udEnc = em.getEnumEncodedValue(... | @Test
public void testLanes() {
ReaderWay way = new ReaderWay(0L);
way.setTag("country", Country.CHL);
way.setTag("highway", "primary");
EdgeIteratorState edge = createEdge(way).set(urbanDensity, RURAL);
calc.fillMaxSpeed(graph, em);
assertEquals(100, edge.get(maxSpee... |
boolean eosEnabled() {
return StreamsConfigUtils.eosEnabled(processingMode);
} | @Test
public void shouldEnableEosIfEosAlphaEnabled() {
assertThat(eosAlphaStreamsProducer.eosEnabled(), is(true));
} |
@PublicEvolving
public static CongestionControlRateLimitingStrategyBuilder builder() {
return new CongestionControlRateLimitingStrategyBuilder();
} | @Test
void testInvalidMaxInFlightRequests() {
assertThatExceptionOfType(IllegalArgumentException.class)
.isThrownBy(
() ->
CongestionControlRateLimitingStrategy.builder()
.setMaxInFlightRequests(0... |
@Override
public FSDataOutputStream create(Path path, boolean overwrite, int bufferSize, short replication,
long blockSize, Progressable progress) throws IOException {
String confUmask = mAlluxioConf.getString(PropertyKey.SECURITY_AUTHORIZATION_PERMISSION_UMASK);
Mode mode =... | @Test
public void hadoopShouldLoadFsWithMultiMasterUri() throws Exception {
URI uri = URI.create("alluxio://host1:19998,host2:19998,host3:19998/path");
org.apache.hadoop.fs.FileSystem fs = org.apache.hadoop.fs.FileSystem.get(uri, getConf());
assertTrue(fs instanceof FileSystem);
uri = URI.create("all... |
@Override
public List<StateInstance> queryStateInstanceListByMachineInstanceId(String stateMachineInstanceId) {
List<StateInstance> stateInstanceList = selectList(
stateLogStoreSqls.getQueryStateInstancesByMachineInstanceIdSql(dbType), RESULT_SET_TO_STATE_INSTANCE,
stateMachi... | @Test
public void testQueryStateInstanceListByMachineInstanceId() {
Assertions.assertDoesNotThrow(() -> dbAndReportTcStateLogStore.queryStateInstanceListByMachineInstanceId("test"));
} |
public Mono<Void> resetToLatest(
KafkaCluster cluster, String group, String topic, Collection<Integer> partitions) {
return checkGroupCondition(cluster, group)
.flatMap(ac ->
offsets(ac, topic, partitions, OffsetSpec.latest())
.flatMap(offsets -> resetOffsets(ac, group, off... | @Test
void resetToLatest() {
sendMsgsToPartition(Map.of(0, 10, 1, 10, 2, 10, 3, 10, 4, 10));
commit(Map.of(0, 5L, 1, 5L, 2, 5L));
offsetsResetService.resetToLatest(cluster, groupId, topic, List.of(0, 1)).block();
assertOffsets(Map.of(0, 10L, 1, 10L, 2, 5L));
commit(Map.of(0, 5L, 1, 5L, 2, 5L));
... |
@Override
public final void getSize(@NonNull SizeReadyCallback cb) {
sizeDeterminer.getSize(cb);
} | @Test
public void getSize_withWrapContentWidthAndValidHeight_usesDisplayDimenAndValidHeight() {
int height = 100;
LayoutParams params = new FrameLayout.LayoutParams(LayoutParams.WRAP_CONTENT, height);
view.setLayoutParams(params);
setDisplayDimens(100, 200);
activity.visible();
view.setRight... |
public String[] getS3ObjectsNames( String bucketName ) throws Exception {
Bucket bucket = getBucket( bucketName );
if ( bucket == null ) {
throw new Exception( Messages.getString( "S3DefaultService.Exception.UnableToFindBucket.Message", bucketName ) );
}
return getS3Objects( bucket ).getObjectSumm... | @Test public void testGetObjectsNamesInBucketWithObjects() throws Exception {
List<String> actual = Arrays.asList( provider.getS3ObjectsNames( BUCKET2_NAME ) );
assertEquals( bucket2Objects.getObjectSummaries().size(), actual.size() );
List<S3ObjectSummary> expectedList = bucket2Objects.getObjectSummaries()... |
public static SchemaPath schemaPathFromPath(String path) {
return new SchemaPath(path);
} | @Test
public void schemaPathFromPathWellFormed() {
SchemaPath path = PubsubClient.schemaPathFromPath("projects/projectId/schemas/schemaId");
assertEquals("projects/projectId/schemas/schemaId", path.getPath());
assertEquals("schemaId", path.getId());
} |
public static boolean hasIntfAleadyInDevice(DeviceId deviceId,
String intfName,
DeviceService deviceService) {
checkNotNull(deviceId);
checkNotNull(intfName);
return deviceService.getPorts(deviceId).... | @Test
public void testHasIntfAleadyInDevice() {
DeviceService deviceService = new TestDeviceService();
assertTrue(OpenstackNetworkingUtil.hasIntfAleadyInDevice(DeviceId.deviceId("deviceId"),
"port1", deviceService));
assertTrue(OpenstackNetworkingUtil.hasIntfAleadyInDevice(De... |
<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 testSiblingMethodConflict() throws Exception {
ProxyInvocationHandler handler = new ProxyInvocationHandler(Maps.newHashMap());
SiblingMethodConflict siblingMethodConflict = handler.as(SiblingMethodConflict.class);
siblingMethodConflict.setString("siblingValue");
assertEquals("sibling... |
public void updateLags() {
for (final Task t: tasks.activeTasks()) {
t.updateLags();
}
} | @Test
public void shouldUpdateLagForAllActiveTasks() {
final StreamTask activeTask1 = statefulTask(taskId00, taskId00ChangelogPartitions)
.inState(State.RUNNING)
.withInputPartitions(taskId00Partitions).build();
final StreamTask activeTask2 = statefulTask(taskId01, taskId01Ch... |
public void onGlobalPropertyChange(String key, @Nullable String value) {
GlobalPropertyChangeHandler.PropertyChange change = GlobalPropertyChangeHandler.PropertyChange.create(key, value);
for (GlobalPropertyChangeHandler changeHandler : changeHandlers) {
changeHandler.onChange(change);
}
} | @Test
public void onGlobalPropertyChange() {
GlobalPropertyChangeHandler handler = mock(GlobalPropertyChangeHandler.class);
SettingsChangeNotifier notifier = new SettingsChangeNotifier(new GlobalPropertyChangeHandler[] {handler});
notifier.onGlobalPropertyChange("foo", "bar");
verify(handler).onChan... |
public boolean verifySignedPip(ASN1Sequence signedPip) throws BsnkException {
ASN1Sequence signedPipContent = (ASN1Sequence) signedPip.getObjectAt(1);
ASN1Sequence pipSignatureSequence = (ASN1Sequence) signedPip.getObjectAt(2);
ASN1Sequence pipSignature = (ASN1Sequence) pipSignatureSequence.getO... | @Test
public void verifySignedPipTest() throws IOException, BsnkException {
assertTrue(bsnkUtil.verifySignedPip(signedPip));
} |
public static KafkaRebalanceState rebalanceState(KafkaRebalanceStatus kafkaRebalanceStatus) {
if (kafkaRebalanceStatus != null) {
Condition rebalanceStateCondition = rebalanceStateCondition(kafkaRebalanceStatus);
String statusString = rebalanceStateCondition != null ? rebalanceStateCondi... | @Test
public void testNoConditionWithState() {
KafkaRebalanceStatus kafkaRebalanceStatus = new KafkaRebalanceStatusBuilder()
.withConditions(
new ConditionBuilder()
.withType("Some other type")
.withStatu... |
public Connector createConnector(Props props) {
Connector connector = new Connector(HTTP_PROTOCOL);
connector.setURIEncoding("UTF-8");
connector.setProperty("address", props.value(WEB_HOST.getKey(), "0.0.0.0"));
connector.setProperty("socket.soReuseAddress", "true");
// See Tomcat configuration refe... | @Test
public void createConnector_whenNotValidPort_shouldThrow() {
Props props = getEmptyProps();
props.set("sonar.web.port", "-1");
assertThatThrownBy(() -> tomcatHttpConnectorFactory.createConnector(props))
.isInstanceOf(IllegalStateException.class)
.hasMessage("HTTP port -1 is invalid");
... |
@Override
public PTransformOverrideFactory.PTransformReplacement<
PCollection<? extends InputT>, PCollection<OutputT>>
getReplacementTransform(
AppliedPTransform<
PCollection<? extends InputT>,
PCollection<OutputT>,
SingleOutput<InputT, O... | @Test
public void getReplacementTransformPopulateDisplayData() {
ParDo.SingleOutput<Integer, Long> originalTransform = ParDo.of(new ToLongFn());
DisplayData originalDisplayData = DisplayData.from(originalTransform);
PCollection<? extends Integer> input = pipeline.apply(Create.of(1, 2, 3));
AppliedPTra... |
public CompressionProvider getCompressionProvider() {
return compressionProvider;
} | @Test
public void getCompressionProvider() {
CompressionProvider provider = inStream.getCompressionProvider();
assertEquals( provider.getName(), PROVIDER_NAME );
} |
public void checkExecutePrerequisites(final ExecutionContext executionContext) {
ShardingSpherePreconditions.checkState(isValidExecutePrerequisites(executionContext), () -> new TableModifyInTransactionException(getTableName(executionContext)));
} | @Test
void assertCheckExecutePrerequisitesWhenExecuteCursorInPostgreSQLTransaction() {
when(transactionRule.getDefaultType()).thenReturn(TransactionType.LOCAL);
ExecutionContext executionContext = new ExecutionContext(
new QueryContext(createCursorStatementContext(), "", Collections.... |
@Override
public void set(String name, String value) {
checkKey(name);
String[] keyParts = splitKey(name);
String ns = registry.getNamespaceURI(keyParts[0]);
if (ns != null) {
try {
xmpData.setProperty(ns, keyParts[1], value);
} catch (XMPExc... | @Test
public void set_unknownPrefixKey_throw() {
assertThrows(PropertyTypeException.class, () -> {
xmpMeta.set("unknown:key", "value");
});
} |
public Timeline getStepInstanceTimeline(
String workflowId,
long workflowInstanceId,
long workflowRunId,
String stepId,
String stepAttempt) {
return getStepInstanceFieldByIds(
StepInstanceField.TIMELINE,
workflowId,
workflowInstanceId,
workflowRunId,
... | @Test
public void testGetStepInstanceTimeline() {
Timeline timeline = stepDao.getStepInstanceTimeline(TEST_WORKFLOW_ID, 1, 1, "job1", "1");
assertTrue(timeline.isEmpty());
Timeline latest = stepDao.getStepInstanceTimeline(TEST_WORKFLOW_ID, 1, 1, "job1", "latest");
assertEquals(timeline, latest);
} |
public static void addContainerEnvsToExistingEnvs(Reconciliation reconciliation, List<EnvVar> existingEnvs, ContainerTemplate template) {
if (template != null && template.getEnv() != null) {
// Create set of env var names to test if any user defined template env vars will conflict with those set abo... | @Test
public void testAddContainerToEnvVarsWithNullTemplate() {
List<EnvVar> vars = new ArrayList<>();
vars.add(new EnvVarBuilder().withName("VAR_1").withValue("value1").build());
ContainerUtils.addContainerEnvsToExistingEnvs(Reconciliation.DUMMY_RECONCILIATION, vars, null);
assert... |
@Override
public MapSettings setProperty(String key, String value) {
return (MapSettings) super.setProperty(key, value);
} | @Test
public void getStringLines_mix() {
Settings settings = new MapSettings();
settings.setProperty("foo", "one\r\ntwo\nthree");
assertThat(settings.getStringLines("foo")).isEqualTo(new String[]{"one", "two", "three"});
} |
public boolean overlaps(final BoundingBox pBoundingBox, double pZoom) {
//FIXME this is a total hack but it works around a number of issues related to vertical map
//replication and horiztonal replication that can cause polygons to completely disappear when
//panning
if (pZoom < 3)
... | @Test
public void testOverlapsWorld() {
// ________________
// | | |
// | | |
// |------+-------|
// | | |
// | | |
// ----------------
//box is notated as *
//test area is notated as &
... |
@VisibleForTesting
static Map<String, List<String>> getCombinedHeaders(final Map<String, List<String>> upgradeRequestHeaders, final Map<String, String> requestMessageHeaders) {
final Map<String, List<String>> combinedHeaders = new HashMap<>();
upgradeRequestHeaders.entrySet().stream()
.filter(entry -... | @Test
void testGetCombinedHeaders() {
final Map<String, List<String>> upgradeRequestHeaders = Map.of(
"Host", List.of("server.example.com"),
"Upgrade", List.of("websocket"),
"Connection", List.of("Upgrade"),
"Sec-WebSocket-Key", List.of("dGhlIHNhbXBsZSBub25jZQ=="),
"Sec-Web... |
@CheckForNull
@Override
public Map<Path, Set<Integer>> branchChangedLines(String targetBranchName, Path projectBaseDir, Set<Path> changedFiles) {
return branchChangedLinesWithFileMovementDetection(targetBranchName, projectBaseDir, toChangedFileByPathsMap(changedFiles));
} | @Test
public void branchChangedLines_should_not_fail_with_patience_diff_algo() throws IOException {
Path gitConfig = worktree.resolve(".git").resolve("config");
Files.write(gitConfig, "[diff]\nalgorithm = patience\n".getBytes(StandardCharsets.UTF_8));
Repository repo = FileRepositoryBuilder.create(worktre... |
@Override
protected Set<StepField> getUsedFields( RestMeta stepMeta ) {
Set<StepField> usedFields = new HashSet<>();
// add url field
if ( stepMeta.isUrlInField() && StringUtils.isNotEmpty( stepMeta.getUrlField() ) ) {
usedFields.addAll( createStepFields( stepMeta.getUrlField(), getInputs() ) );
... | @Test
public void testGetUsedFields_urlInField() throws Exception {
Set<StepField> fields = new HashSet<>();
when( meta.isUrlInField() ).thenReturn( true );
when( meta.getUrlField() ).thenReturn( "url" );
doReturn( stepNodes ).when( analyzer ).getInputs();
doReturn( fields ).when( analyzer ).creat... |
@Override
public void stop() {
lock.unlock();
} | @Test
/**
* If there is an error starting up the scan, we'll still try to unlock even if the lock
* was never done
*/
public void stopWithoutStarting() {
lock.stop();
lock.stop();
} |
@Override
public void execute(String commandName, BufferedReader reader, BufferedWriter writer)
throws Py4JException, IOException {
char subCommand = safeReadLine(reader).charAt(0);
String returnCommand = null;
if (subCommand == LIST_SLICE_SUB_COMMAND_NAME) {
returnCommand = slice_list(reader);
} else if... | @SuppressWarnings("rawtypes")
@Test
public void testConcat() {
String inputCommand = ListCommand.LIST_CONCAT_SUB_COMMAND_NAME + "\n" + target + "\n" + target2 + "\ne\n";
try {
// concat l + l2
command.execute("l", new BufferedReader(new StringReader(inputCommand)), writer);
assertEquals("!ylo2\n", sWrite... |
public void printStreamedRow(final StreamedRow row) {
row.getErrorMessage().ifPresent(this::printErrorMessage);
row.getFinalMessage().ifPresent(finalMsg -> writer().println(finalMsg));
row.getHeader().ifPresent(this::printRowHeader);
if (row.getRow().isPresent()) {
switch (outputFormat) {
... | @Test
public void testPrintErrorStreamedRow() {
final FakeException exception = new FakeException();
console.printStreamedRow(StreamedRow.error(exception, Errors.ERROR_CODE_SERVER_ERROR));
assertThat(terminal.getOutputString(), is(exception.getMessage() + NEWLINE));
} |
@SuppressWarnings( "unchecked" )
@Nullable
public <T extends VFSConnectionDetails> VFSConnectionProvider<T> getProvider(
@NonNull ConnectionManager manager,
@Nullable String key ) {
return (VFSConnectionProvider<T>) manager.getConnectionProvider( key );
} | @Test
public void testGetProviderReturnsNullForNonExistingProviderInManager() {
VFSConnectionProvider<VFSConnectionDetails> result =
vfsConnectionManagerHelper.getProvider( connectionManager, "missingProvider1" );
assertNull( result );
} |
public static long noHeapMemoryMax() {
return noHeapMemoryUsage.getMax();
} | @Test
public void noHeapMemoryMax() {
long memoryUsed = MemoryUtil.noHeapMemoryMax();
Assert.assertNotEquals(0, memoryUsed);
} |
@Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (!(obj instanceof DisplayModel))
return false;
DisplayModel other = (DisplayModel) obj;
if (this.backgroundColor != other.backgroundColor)
return false;
if (this... | @Test
public void equalsTest() {
DisplayModel displayModel1 = new DisplayModel();
DisplayModel displayModel2 = new DisplayModel();
DisplayModel displayModel3 = new DisplayModel();
displayModel3.setBackgroundColor(0xffff0000);
DisplayModel displayModel4 = new DisplayModel();... |
public Protocol forName(final String identifier) {
return this.forName(identifier, null);
} | @Test
public void testPrioritizeNonDeprecatedWithTypeLookup() {
final TestProtocol first = new TestProtocol(Scheme.http) {
@Override
public Type getType() {
return Type.dracoon;
}
@Override
public String getProvider() {
... |
@Override
public ScannerReport.Metadata readMetadata() {
ensureInitialized();
if (this.metadata == null) {
this.metadata = delegate.readMetadata();
}
return this.metadata;
} | @Test
public void readMetadata_result_is_cached() {
ScannerReport.Metadata metadata = ScannerReport.Metadata.newBuilder().build();
writer.writeMetadata(metadata);
ScannerReport.Metadata res = underTest.readMetadata();
assertThat(res).isEqualTo(metadata);
assertThat(underTest.readMetadata()).isSa... |
@Override
public boolean equals(Object obj) {
if (obj == this) {
return true;
} else if (obj != null && obj.getClass() == ResourceSpec.class) {
ResourceSpec that = (ResourceSpec) obj;
return Objects.equals(this.cpuCores, that.cpuCores)
&& Objec... | @Test
void testEquals() {
ResourceSpec rs1 = ResourceSpec.newBuilder(1.0, 100).build();
ResourceSpec rs2 = ResourceSpec.newBuilder(1.0, 100).build();
assertThat(rs2).isEqualTo(rs1);
assertThat(rs1).isEqualTo(rs2);
ResourceSpec rs3 =
ResourceSpec.newBuilder(1.... |
@Override
public boolean putRow( RowMetaInterface rowMeta, Object[] rowData ) {
this.rowMeta = rowMeta;
this.row = rowData;
return true;
} | @Test
public void testPutRow() throws Exception {
rowSet.putRow( new RowMeta(), row );
assertSame( row, rowSet.getRow() );
} |
public static KeyStore loadKeyStore(final String name, final char[] password) {
InputStream stream = null;
try {
stream = Config.getInstance().getInputStreamFromFile(name);
if (stream == null) {
String message = "Unable to load keystore '" + name + "', please prov... | @Test
public void testLoadValidKeyStore() {
KeyStore keyStore = TlsUtil.loadKeyStore(KEYSTORE_NAME, PASSWORD);
Assert.assertNotNull(keyStore);
} |
@Override
public <T> T unwrap(final Class<T> iface) {
return null;
} | @Test
void assertUnwrap() {
assertNull(metaData.unwrap(null));
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.