focal_method stringlengths 13 60.9k | test_case stringlengths 25 109k |
|---|---|
@Override
public Protocol protocol(boolean enclave) {
if (enclave) throw new IllegalArgumentException("enclave is not supported with " + getClass());
return Protocol.dualstack;
} | @Test
public void test_protocol() {
assertEquals(LoadBalancerService.Protocol.dualstack, loadBalancerService.protocol(false));
} |
ImmutableList<PayloadDefinition> validatePayloads(List<PayloadDefinition> payloads) {
for (PayloadDefinition p : payloads) {
checkArgument(p.hasName(), "Parsed payload does not have a name.");
checkArgument(
p.getInterpretationEnvironment()
!= PayloadGeneratorConfig.Interpretatio... | @Test
public void validatePayloads_withRegexValidationWithoutValidationRegex_throwsException()
throws IOException {
PayloadDefinition p = goodNoCallbackDefinition.clearValidationRegex().build();
Throwable thrown =
assertThrows(
IllegalArgumentException.class, () -> module.validatePa... |
public long getNewJobId() {
return mNextJobId.getAndIncrement();
} | @Test
public void newIdTest() {
JobIdGenerator generator = new JobIdGenerator();
Assert.assertNotEquals(generator.getNewJobId(), generator.getNewJobId());
} |
@Override
public void resetConfigStats(RedisClusterNode node) {
RedisClient entry = getEntry(node);
RFuture<Void> f = executorService.writeAsync(entry, StringCodec.INSTANCE, RedisCommands.CONFIG_RESETSTAT);
syncFuture(f);
} | @Test
public void testResetConfigStats() {
RedisClusterNode master = getFirstMaster();
connection.resetConfigStats(master);
} |
public boolean writeRack() {
Map<String, String> nodeLabels = client.nodes().withName(config.getNodeName()).get().getMetadata().getLabels();
LOGGER.info("NodeLabels = {}", nodeLabels);
String rackId = nodeLabels.get(config.getRackTopologyKey());
LOGGER.info("Rack: {} = {}", config.getRa... | @Test
public void testWriteRackFailWithMissingKubernetesZoneLabel() {
// the cluster node will not have the requested label
Map<String, String> labels = new HashMap<>(LABELS);
labels.remove("failure-domain.beta.kubernetes.io/zone");
InitWriterConfig config = InitWriterConfig.fromMa... |
public static boolean load(final String library) {
synchronized(lock) {
final String path = Native.getPath(library);
try {
// Load using absolute path. Otherwise we may load
// a library in java.library.path that was not intended
// because... | @Test
public void testLoad() {
assertFalse(Native.load("notfound"));
} |
@Override
protected int command() {
if (!validateConfigFilePresent()) {
return 1;
}
final MigrationConfig config;
try {
config = MigrationConfig.load(getConfigFile());
} catch (KsqlException | MigrationException e) {
LOGGER.error(e.getMessage());
return 1;
}
retur... | @Test
public void shouldCleanMigrationsTableEvenIfStreamDoesntExist() throws Exception {
// Given:
givenMigrationsStreamDoesNotExist();
// When:
final int status = command.command(config, cfg -> client);
// Then:
assertThat(status, is(0));
verify(client).executeStatement("DROP TABLE " +... |
public FloatArrayAsIterable usingExactEquality() {
return new FloatArrayAsIterable(EXACT_EQUALITY_CORRESPONDENCE, iterableSubject());
} | @Test
public void usingExactEquality_contains_otherTypes() {
// Expected value is Integer - supported up to +/- 2^24
assertThat(array(1.0f, 2.0f, 3.0f)).usingExactEquality().contains(2);
assertThat(array(1.0f, 1 << 24, 3.0f)).usingExactEquality().contains(1 << 24);
// Expected value is Long - supporte... |
@VisibleForTesting
List<MessageSummary> getMessageBacklog(EventNotificationContext ctx, TeamsEventNotificationConfig config) {
List<MessageSummary> backlog = notificationCallbackService.getBacklogForEvent(ctx);
if (config.backlogSize() > 0 && backlog != null) {
return backlog.stream().li... | @Test
public void testBacklogMessageLimitWhenEventNotificationContextIsNull() {
TeamsEventNotificationConfig TeamsConfig = TeamsEventNotificationConfig.builder()
.backlogSize(0)
.build();
//global setting is at N and the eventNotificationContext is null then the mess... |
@Override
public Num calculate(BarSeries series, Position position) {
Num profitLossRatio = profitLossRatioCriterion.calculate(series, position);
Num numberOfPositions = numberOfPositionsCriterion.calculate(series, position);
Num numberOfWinningPositions = numberOfWinningPositionsCriterion.c... | @Test
public void calculateOnlyWithProfitPositions() {
MockBarSeries series = new MockBarSeries(numFunction, 100, 110, 120, 130, 150, 160);
TradingRecord tradingRecord = new BaseTradingRecord(Trade.buyAt(0, series), Trade.sellAt(2, series),
Trade.buyAt(3, series), Trade.sellAt(5, ser... |
public FloatArrayAsIterable usingExactEquality() {
return new FloatArrayAsIterable(EXACT_EQUALITY_CORRESPONDENCE, iterableSubject());
} | @Test
public void usingExactEquality_containsAtLeast_primitiveFloatArray_inOrder_success() {
assertThat(array(1.0f, 2.0f, 3.0f))
.usingExactEquality()
.containsAtLeast(array(1.0f, 2.0f))
.inOrder();
} |
public void makeReadOnly()
{
_isReadOnly = true;
} | @Test(expectedExceptions = UnsupportedOperationException.class)
public void testMakeReadOnly()
{
CompoundKey compoundKey = new CompoundKey();
compoundKey.append("foo", "foo-value");
compoundKey.append("bar", 1);
compoundKey.append("baz", 7L);
compoundKey.makeReadOnly();
compoundKey.append(... |
public static Gson instance() {
return SingletonHolder.INSTANCE;
} | @Test
void configurationPropertyWithSecretParamsShouldSerializeResolvedValues() {
ConfigurationProperty configurationProperty = new ConfigurationProperty(new ConfigurationKey("db_password"),
new ConfigurationValue("{{SECRET:[test_id][password]}}"));
configurationProperty.getSecretPar... |
public static Collection<Integer> getShardingItems(final String jobId) {
return JOBS.containsKey(jobId) ? JOBS.get(jobId).getJobRunnerManager().getShardingItems() : Collections.emptyList();
} | @Test
void assertGetExistedShardingItems() {
when(job.getJobRunnerManager().getShardingItems()).thenReturn(Arrays.asList(1, 2, 3));
assertThat(PipelineJobRegistry.getShardingItems("foo_job"), is(Arrays.asList(1, 2, 3)));
} |
public static DecryptionResultHandler getHandler(@NonNull ReactApplicationContext reactContext,
@NonNull final CipherStorage storage,
@NonNull final BiometricPrompt.PromptInfo promptInfo) {
if (storage.isBiometrySu... | @Test
@Config(sdk = Build.VERSION_CODES.M)
public void testBiometryNotSupported() {
// GIVEN
final ReactApplicationContext mockContext = mock(ReactApplicationContext.class);
final CipherStorage storage = mock(CipherStorage.class);
when(storage.isBiometrySupported()).thenReturn(false);
final Bio... |
public static Builder route() {
return new RouterFunctionBuilder();
} | @Test
void filter() {
Mono<String> stringMono = Mono.just("42");
HandlerFunction<EntityResponse<Mono<String>>> handlerFunction =
request -> EntityResponse.fromPublisher(stringMono, String.class).build();
RouterFunction<EntityResponse<Mono<String>>> routerFunction =
request -> Mono.just(handlerFunction);
... |
public static Set<Result> anaylze(String log) {
Set<Result> results = new HashSet<>();
for (Rule rule : Rule.values()) {
Matcher matcher = rule.pattern.matcher(log);
if (matcher.find()) {
results.add(new Result(rule, log, matcher));
}
}
... | @Test
public void loaderExceptionModCrash() throws IOException {
CrashReportAnalyzer.Result result = findResultByRule(
CrashReportAnalyzer.anaylze(loadLog("/crash-report/loader_exception_mod_crash.txt")),
CrashReportAnalyzer.Rule.LOADING_CRASHED_FORGE);
assertEquals("... |
Map<MetricName, ? extends Metric> metrics() {
return producer.metrics();
} | @SuppressWarnings({"rawtypes", "unchecked"})
@Test
public void shouldForwardCallToMetrics() {
final Map metrics = new HashMap<>();
when(mockedProducer.metrics()).thenReturn(metrics);
assertSame(metrics, streamsProducerWithMock.metrics());
} |
public static String toJson(MetadataUpdate metadataUpdate) {
return toJson(metadataUpdate, false);
} | @Test
public void testSetCurrentViewVersionToJson() {
String action = MetadataUpdateParser.SET_CURRENT_VIEW_VERSION;
String expected = String.format("{\"action\":\"%s\",\"view-version-id\":23}", action);
MetadataUpdate update = new MetadataUpdate.SetCurrentViewVersion(23);
assertThat(MetadataUpdatePar... |
public static List<DiskRange> mergeAdjacentDiskRanges(Collection<DiskRange> diskRanges, DataSize maxMergeDistance, DataSize maxReadSize)
{
// sort ranges by start offset
List<DiskRange> ranges = new ArrayList<>(diskRanges);
Collections.sort(ranges, new Comparator<DiskRange>()
{
... | @Test
public void testMergeSingle()
{
List<DiskRange> diskRanges = mergeAdjacentDiskRanges(
ImmutableList.of(new DiskRange(100, 100)),
new DataSize(0, BYTE),
new DataSize(0, BYTE));
assertEquals(diskRanges, ImmutableList.of(new DiskRange(100, 100))... |
public static Optional<ScalablePushRegistry> create(
final LogicalSchema logicalSchema,
final Supplier<List<PersistentQueryMetadata>> allPersistentQueries,
final boolean isTable,
final Map<String, Object> streamsProperties,
final Map<String, Object> consumerProperties,
final String s... | @Test
public void shouldCreate_badUrlApplicationServer() {
// When
final Exception e = assertThrows(
IllegalArgumentException.class,
() -> ScalablePushRegistry.create(SCHEMA, Collections::emptyList, false,
ImmutableMap.of(StreamsConfig.APPLICATION_SERVER_CONFIG, "abc"),
... |
@Override
public int read() throws EOFException {
return (pos < size) ? (data[pos++] & 0xff) : -1;
} | @Test
public void testReadPosition() throws Exception {
int read = in.read(1);
int readUnsigned = in.read(INIT_DATA.length - 1);
int readEnd = in.read(INIT_DATA.length);
assertEquals(1, read);
// Map the expected negative value to unsigned byte range
assertEquals(0xFF... |
public short encapEthType() {
return encapEthType;
} | @Test
public void testConstruction() {
final NiciraEncapEthType encapEthType = new NiciraEncapEthType(ethType1);
assertThat(encapEthType, is(notNullValue()));
assertThat(encapEthType.encapEthType(), is(ethType1));
} |
@Converter
static Predicate obtainPredicateFromBeanName(
final String predicateBeanName,
final CamelContext camelContext) {
return Optional.ofNullable(CamelContextHelper.lookup(camelContext, predicateBeanName, Predicate.class))
.orElseThrow(() -> new IllegalStateExcep... | @Test
void obtainPredicateFromBeanName() {
context.getRegistry().bind(predicateBeanName, Predicate.class, predicateInstance);
Predicate actualPredicate = DynamicRouterControlService.obtainPredicateFromBeanName(predicateBeanName, context);
assertEquals(predicateInstance, actualPredicate);
... |
@Override
public int hashCode() {
return map.hashCode();
} | @Test
public void testHashCode_doesNotThrowExceptionWhenEmpty() {
counter.hashCode();
} |
public CompletableFuture<Void> redeemReceipt(
final Account account,
final ReceiptCredentialPresentation receiptCredentialPresentation) {
try {
serverZkReceiptOperations.verifyReceiptCredentialPresentation(receiptCredentialPresentation);
} catch (VerificationFailedException e) {
throw St... | @Test
void mergeRedemptions() throws InvalidInputException, VerificationFailedException {
final Instant newExpirationTime = Instant.EPOCH.plus(Duration.ofDays(1));
final Instant existingExpirationTime = Instant.EPOCH.plus(Duration.ofDays(1)).plus(Duration.ofSeconds(1));
final BackupAuthManager authManage... |
@Override
public PluginWrapper whichPlugin(Class<?> clazz) {
ClassLoader classLoader = clazz.getClassLoader();
PluginWrapper plugin = getPlugin(currentPluginId);
if (plugin.getPluginClassLoader() == classLoader) {
return plugin;
}
return null;
} | @Test
public void whichPlugin() {
pluginManager.loadPlugins();
pluginManager.startPlugins();
assertEquals(null, wrappedPluginManager.whichPlugin(pluginManager.getExtensionClasses(OTHER_PLUGIN_ID).get(0)));
assertEquals(THIS_PLUGIN_ID, wrappedPluginManager.whichPlugin(pluginManager.ge... |
private T injectExtension(T instance) {
if (injector == null) {
return instance;
}
try {
for (Method method : instance.getClass().getMethods()) {
if (!isSetter(method)) {
continue;
}
/**
... | @Test
void testInjectExtension() {
// register bean for test ScopeBeanExtensionInjector
DemoImpl demoBean = new DemoImpl();
ApplicationModel.defaultModel().getBeanFactory().registerBean(demoBean);
// test default
InjectExt injectExt = getExtensionLoader(InjectExt.class).getEx... |
@JsonProperty("location")
public String location() {
return location;
} | @Test
public void testPluginDescWithNullVersion() {
String nullVersion = "null";
PluginDesc<SourceConnector> connectorDesc = new PluginDesc<>(
SourceConnector.class,
null,
PluginType.SOURCE,
pluginLoader
);
assertPlugin... |
public String getPath() {
return file.getAbsolutePath();
} | @Test
public void shouldGetFilePath() {
// When
final String path = replayFile.getPath();
// Then
assertThat(path, is(String.format(
"%s/%s", backupLocation.getRoot().getAbsolutePath(), REPLAY_FILE_NAME)));
} |
@Override
public int getMedium(int index) {
int value = getUnsignedMedium(index);
if ((value & 0x800000) != 0) {
value |= 0xff000000;
}
return value;
} | @Test
public void getMediumBoundaryCheck1() {
assertThrows(IndexOutOfBoundsException.class, new Executable() {
@Override
public void execute() {
buffer.getMedium(-1);
}
});
} |
public static void clearMemoryUtm() {
sUtmProperties.clear();
sLatestUtmProperties.clear();
} | @Test
public void clearMemoryUtm() {
ChannelUtils.clearMemoryUtm();
} |
@Override
public boolean add(E element) {
return add(element, element.hashCode());
} | @Test(expected = NullPointerException.class)
public void testAddWithHashNull() {
final OAHashSet<Integer> set = new OAHashSet<>(8);
set.add(null, 1);
} |
public static Map<String, Object> compare(byte[] baselineImg, byte[] latestImg, Map<String, Object> options,
Map<String, Object> defaultOptions) throws MismatchException {
boolean allowScaling = toBool(defaultOptions.get("allowScaling"));
ImageComparison im... | @Test
void testDataUrl() {
Map<String, Object> result = ImageComparison.compare(R_1x1_IMG, R_1x1_IMG, opts(), opts());
String dataUrl = "data:image/png;base64," + R_1x1_BASE64;
assertEquals(dataUrl, result.get("baseline"));
assertEquals(dataUrl, result.get("latest"));
} |
public static <T extends PipelineOptions> T as(Class<T> klass) {
return new Builder().as(klass);
} | @Test
public void testHavingExtraneousMethodThrows() throws Exception {
expectedException.expect(IllegalArgumentException.class);
expectedException.expectMessage(
"Methods [extraneousMethod(int, String)] on "
+ "[org.apache.beam.sdk.options.PipelineOptionsFactoryTest$ExtraneousMethod] "
... |
@Override
public List<Service> getServiceDefinitions() throws MockRepositoryImportException {
List<Service> result = new ArrayList<>();
List<Element> interfaceNodes = getConfigDirectChildren(projectElement, "interface");
for (Element interfaceNode : interfaceNodes) {
// Filter complete in... | @Test
void testSimpleProjectNoVersionImport() {
SoapUIProjectImporter importer = null;
try {
importer = new SoapUIProjectImporter(
"target/test-classes/io/github/microcks/util/soapui/RefTest-no-version-soapui-project.xml");
} catch (Exception e) {
fail("Exception sh... |
public DoubleValue increment(double increment) {
this.value += increment;
this.set = true;
return this;
} | @Test
public void multiple_calls_to_increment_DoubleVariationValue_increments_by_the_value_of_the_arg() {
DoubleValue target = new DoubleValue()
.increment(new DoubleValue().increment(35))
.increment(new DoubleValue().increment(10));
verifySetVariationValue(target, 45);
} |
public Flowable<EthBlock> replayPastBlocksFlowable(
DefaultBlockParameter startBlock,
boolean fullTransactionObjects,
Flowable<EthBlock> onCompleteFlowable) {
// We use a scheduler to ensure this Flowable runs asynchronously for users to be
// consistent with the othe... | @Test
public void testReplayPastBlocksFlowable() throws Exception {
List<EthBlock> expected =
Arrays.asList(
createBlock(0),
createBlock(1),
createBlock(2),
createBlock(3),
... |
public LoggerLevel getRootLoggerLevel() {
return Loggers.get(Logger.ROOT_LOGGER_NAME).getLevel();
} | @Test
public void getRootLoggerLevel() {
logTester.setLevel(TRACE);
assertThat(underTest.getRootLoggerLevel()).isEqualTo(TRACE);
} |
@VisibleForTesting
static Pair<TableRebalanceContext, Long> getLatestJob(
Map<String, Set<Pair<TableRebalanceContext, Long>>> candidateJobs) {
Pair<TableRebalanceContext, Long> candidateJobRun = null;
for (Map.Entry<String, Set<Pair<TableRebalanceContext, Long>>> entry : candidateJobs.entrySet()) {
... | @Test
public void testGetLatestJob() {
Map<String, Set<Pair<TableRebalanceContext, Long>>> jobs = new HashMap<>();
// The most recent job run is job1_3, and within 3 maxAttempts.
jobs.put("job1",
ImmutableSet.of(Pair.of(createDummyJobCtx("job1", 1), 10L), Pair.of(createDummyJobCtx("job1", 2), 20L)... |
@Deprecated
public String createToken(Authentication authentication) {
return createToken(authentication.getName());
} | @Test
void testCreateTokenWhenDisableAuthAndSecretKeyIsBlank() {
when(authConfigs.isAuthEnabled()).thenReturn(false);
MockEnvironment mockEnvironment = new MockEnvironment();
mockEnvironment.setProperty(AuthConstants.TOKEN_SECRET_KEY, "");
mockEnvironment.setProperty(AuthConstants.TO... |
List<String> getAnnotValues(Annotated a, String... annotKeys) {
List<String> result = new ArrayList<>(annotKeys.length);
for (String k : annotKeys) {
String v = a.annotations().value(k);
if (v == null) {
return null;
}
result.add(v);
... | @Test
public void annotValues() {
title("annotValues()");
verifyValues(t2.getAnnotValues(THING, K1), V1);
verifyValues(t2.getAnnotValues(THING, K3, K1), V3, V1);
verifyValues(t2.getAnnotValues(THING, K1, K2, K3), V1, V2, V3);
verifyValues(t2.getAnnotValues(THING, K1, K4));
... |
@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 testGauntletPersonalBest()
{
ChatMessage chatMessage = new ChatMessage(null, GAMEMESSAGE, "", "Challenge duration: <col=ff0000>10:24</col>. Personal best: 7:59.", null, 0);
chatCommandsPlugin.onChatMessage(chatMessage);
chatMessage = new ChatMessage(null, GAMEMESSAGE, "", "Your Gauntlet compl... |
public static String getTypeName(final int type) {
switch (type) {
case START_EVENT_V3:
return "Start_v3";
case STOP_EVENT:
return "Stop";
case QUERY_EVENT:
return "Query";
case ROTATE_EVENT:
return "... | @Test
public void getTypeNameInputPositiveOutputNotNull18() {
// Arrange
final int type = 29;
// Act
final String actual = LogEvent.getTypeName(type);
// Assert result
Assert.assertEquals("Rows_query", actual);
} |
@GetMapping("/queryList")
@RequiresPermissions("system:meta:list")
public ShenyuAdminResult queryList(final String path,
@RequestParam @NotNull(message = "currentPage not null") final Integer currentPage,
@RequestParam @NotNull(messag... | @Test
public void testQueryList() throws Exception {
final PageParameter pageParameter = new PageParameter();
List<MetaDataVO> metaDataVOS = new ArrayList<>();
metaDataVOS.add(metaDataVO);
final CommonPager<MetaDataVO> commonPager = new CommonPager<>();
commonPager.setPage(pa... |
public static String[] hadoopFsListAsArray(String files, Configuration conf,
String user)
throws URISyntaxException, FileNotFoundException, IOException,
InterruptedException {
if (files == null || conf == null) {
return null;
}
String[] dirty = files.split(",");
St... | @Test
public void testHadoopFsListAsArray() {
try {
String tmpFileName1 = "/tmp/testHadoopFsListAsArray1";
String tmpFileName2 = "/tmp/testHadoopFsListAsArray2";
File tmpFile1 = new File(tmpFileName1);
File tmpFile2 = new File(tmpFileName2);
tmpFile1.createNewFile();
tmpFile2.c... |
public static String getRmPrincipal(Configuration conf) throws IOException {
String principal = conf.get(YarnConfiguration.RM_PRINCIPAL);
String prepared = null;
if (principal != null) {
prepared = getRmPrincipal(principal, conf);
}
return prepared;
} | @Test
public void testGetRMPrincipalStandAlone_String() throws IOException {
Configuration conf = new Configuration();
conf.set(YarnConfiguration.RM_ADDRESS, "myhost");
conf.setBoolean(YarnConfiguration.RM_HA_ENABLED, false);
String result = YarnClientUtils.getRmPrincipal("test/_HOST@REALM", conf);
... |
@VisibleForTesting
Process execute() throws IOException, InterruptedException, ExecutionException {
// Nmap is a long running process and the collectStream method is a blocking method.
// By default CompletableFuture uses ForkJoinPool, which is for suitable short
// non-blocking operations.
Executor e... | @Test
public void execute_always_startsProcessAndReturnsProcessInstance()
throws IOException, InterruptedException, ExecutionException {
CommandExecutor executor = new CommandExecutor("/bin/sh", "-c", "echo 1");
Process process = executor.execute();
process.waitFor();
assertThat(process.exitVa... |
public static List<TargetInfo> parseOptTarget(CommandLine cmd, AlluxioConfiguration conf)
throws IOException {
String[] targets;
if (cmd.hasOption(TARGET_OPTION_NAME)) {
String argTarget = cmd.getOptionValue(TARGET_OPTION_NAME);
if (StringUtils.isBlank(argTarget)) {
throw new IOExcepti... | @Test
public void unrecognizedPort() throws Exception {
String allTargets = "localhost:12345";
CommandLine mockCommandLine = mock(CommandLine.class);
String[] mockArgs = new String[]{"--target", allTargets};
when(mockCommandLine.getArgs()).thenReturn(mockArgs);
when(mockCommandLine.hasOption(LogLe... |
@Override
public synchronized Snapshot record(long duration, TimeUnit durationUnit, Outcome outcome) {
totalAggregation.record(duration, durationUnit, outcome);
moveWindowByOne().record(duration, durationUnit, outcome);
return new SnapshotImpl(totalAggregation);
} | @Test
public void testRecordSuccess() {
Metrics metrics = new FixedSizeSlidingWindowMetrics(5);
Snapshot snapshot = metrics.record(100, TimeUnit.MILLISECONDS, Metrics.Outcome.SUCCESS);
assertThat(snapshot.getTotalNumberOfCalls()).isEqualTo(1);
assertThat(snapshot.getNumberOfSuccessf... |
public void delaySendingAckToUpstream(final String upstreamAddr)
throws IOException {
} | @Test(timeout = 60000)
public void testDelaySendingAckToUpstream() throws Exception {
final MetricsDataNodeFaultInjector mdnFaultInjector =
new MetricsDataNodeFaultInjector() {
@Override
public void delaySendingAckToUpstream(final String upstreamAddr)
throws IOException {... |
@Override
public void createPort(Port osPort) {
checkNotNull(osPort, ERR_NULL_PORT);
checkArgument(!Strings.isNullOrEmpty(osPort.getId()), ERR_NULL_PORT_ID);
checkArgument(!Strings.isNullOrEmpty(osPort.getNetworkId()), ERR_NULL_PORT_NET_ID);
osNetworkStore.createPort(osPort);
... | @Test(expected = IllegalArgumentException.class)
public void testCreatePortWithNullNetworkId() {
final Port testPort = NeutronPort.builder().build();
testPort.setId(PORT_ID);
target.createPort(testPort);
} |
public String convert(final String hostname) {
if(!PreferencesFactory.get().getBoolean("connection.hostname.idn")) {
return StringUtils.strip(hostname);
}
if(StringUtils.isNotEmpty(hostname)) {
try {
// Convenience function that implements the IDNToASCII o... | @Test
public void testHostnameStartsWithDot() {
assertEquals(".blob.core.windows.net", new PunycodeConverter().convert(".blob.core.windows.net"));
} |
Map<String, String> mergeReleaseConfigurations(List<Release> releases) {
Map<String, String> result = Maps.newLinkedHashMap();
for (Release release : Lists.reverse(releases)) {
result.putAll(gson.fromJson(release.getConfigurations(), configurationTypeReference));
}
return result;
} | @Test(expected = JsonSyntaxException.class)
public void testTransformConfigurationToMapFailed() throws Exception {
String someInvalidConfiguration = "xxx";
Release someRelease = new Release();
someRelease.setConfigurations(someInvalidConfiguration);
configController.mergeReleaseConfigurations(Lists.n... |
@Override
public Path touch(final Path file, final TransferStatus status) throws BackgroundException {
if(new SDSTripleCryptEncryptorFeature(session, nodeid).isEncrypted(containerService.getContainer(file))) {
status.setFilekey(SDSTripleCryptEncryptorFeature.generateFileKey());
}
... | @Test(expected = BackgroundException.class)
public void testTouchFileRoot() throws Exception {
try {
final SDSNodeIdProvider nodeid = new SDSNodeIdProvider(session);
new SDSTouchFeature(session, nodeid).touch(new Path(new AlphanumericRandomStringService().random(), EnumSet.of(Path.Ty... |
@Override
public void setViewID(View view, String viewID) {
} | @Test
public void testSetViewID1() {
Object view = new AlertDialog.Builder(mApplication).create();
mSensorsAPI.setViewID(view, "R.id.login");
Object tag = ((AlertDialog) view).getWindow().getDecorView().getTag(R.id.sensors_analytics_tag_view_id);
Assert.assertNull(tag);
} |
@SuppressWarnings("MethodLength")
static void dissectControlRequest(
final ArchiveEventCode eventCode,
final MutableDirectBuffer buffer,
final int offset,
final StringBuilder builder)
{
int encodedLength = dissectLogHeader(CONTEXT, eventCode, buffer, offset, builder);
... | @Test
void controlRequestStopRecordingByIdentity()
{
internalEncodeLogHeader(buffer, 0, 12, 32, () -> 10_000_000_000L);
final StopRecordingByIdentityRequestEncoder requestEncoder = new StopRecordingByIdentityRequestEncoder();
requestEncoder.wrapAndApplyHeader(buffer, LOG_HEADER_LENGTH, h... |
@Deprecated
public static SofaRequest buildSofaRequest(Class<?> clazz, String method, Class[] argTypes, Object[] args) {
SofaRequest request = new SofaRequest();
request.setInterfaceName(clazz.getName());
request.setMethodName(method);
request.setMethodArgs(args == null ? CodecUtils.... | @Test
public void buildSofaRequest() throws Exception {
SofaRequest request = MessageBuilder.buildSofaRequest(Number.class, "intValue",
new Class[0], CodecUtils.EMPTY_OBJECT_ARRAY);
Assert.assertEquals(request.getInterfaceName(), Number.class.getName());
Assert.assertEquals(reque... |
public static Type convertType(TypeInfo typeInfo) {
switch (typeInfo.getOdpsType()) {
case BIGINT:
return Type.BIGINT;
case INT:
return Type.INT;
case SMALLINT:
return Type.SMALLINT;
case TINYINT:
ret... | @Test
public void testConvertTypeCaseMap() {
TypeInfo keyTypeInfo = TypeInfoFactory.STRING;
TypeInfo valueTypeInfo = TypeInfoFactory.INT;
MapTypeInfo mapTypeInfo = TypeInfoFactory.getMapTypeInfo(keyTypeInfo, valueTypeInfo);
Type result = EntityConvertUtils.convertType(mapTypeInfo);
... |
public static Builder newIntegerColumnDefBuilder() {
return new Builder();
} | @Test
public void integerColumDef_is_nullable_by_default() {
assertThat(newIntegerColumnDefBuilder().setColumnName("a").build().isNullable()).isTrue();
} |
public static boolean webSocketHostPathMatches(String hostPath, String targetPath) {
boolean exactPathMatch = true;
if (ObjectHelper.isEmpty(hostPath) || ObjectHelper.isEmpty(targetPath)) {
// This scenario should not really be possible as the input args come from the vertx-websocket consum... | @Test
void webSocketHostExactPathMatches() {
String hostPath = "/foo/bar/cheese/wine";
String targetPath = "/foo/bar/cheese/wine";
assertTrue(VertxWebsocketHelper.webSocketHostPathMatches(hostPath, targetPath));
} |
static <T> T getWildcardMappedObject(final Map<String, T> mapping, final String query) {
T value = mapping.get(query);
if (value == null) {
for (String key : mapping.keySet()) {
// Turn the search key into a regex, using all characters but the * as a literal.
... | @Test
public void testSubdirExactConcat() throws Exception
{
// Setup test fixture.
final Map<String, Object> haystack = Map.of("myplugin/baz/foo", new Object());
// Execute system under test.
final Object result = PluginServlet.getWildcardMappedObject(haystack, "myplugin/baz/fo... |
static Builder newBuilder() {
return new AutoValue_SplunkEventWriter.Builder();
} | @Test
@Category(NeedsRunner.class)
public void failedSplunkWriteSingleBatchTest() {
// Create server expectation for FAILURE.
mockServerListening(404);
int testPort = mockServerRule.getPort();
List<KV<Integer, SplunkEvent>> testEvents =
ImmutableList.of(
KV.of(
... |
public boolean eval(ContentFile<?> file) {
// TODO: detect the case where a column is missing from the file using file's max field id.
return new MetricsEvalVisitor().eval(file);
} | @Test
public void testIntegerLt() {
boolean shouldRead =
new StrictMetricsEvaluator(SCHEMA, lessThan("id", INT_MIN_VALUE)).eval(FILE);
assertThat(shouldRead).as("Should not match: always false").isFalse();
shouldRead = new StrictMetricsEvaluator(SCHEMA, lessThan("id", INT_MIN_VALUE + 1)).eval(FIL... |
public static AvroGenericCoder of(Schema schema) {
return AvroGenericCoder.of(schema);
} | @Test
public void testDeterminismUnorderedMap() {
// LinkedHashMap is not deterministically ordered, so we should fail.
assertNonDeterministic(
AvroCoder.of(LinkedHashMapField.class),
reasonField(
LinkedHashMapField.class,
"nonDeterministicMap",
"java.util.L... |
@Override
@MethodNotAvailable
public void loadAll(boolean replaceExistingValues) {
throw new MethodNotAvailableException();
} | @Test(expected = MethodNotAvailableException.class)
public void testLoadAllWithKeys() {
adapter.loadAll(Collections.emptySet(), true);
} |
@Override
public void validateDeptList(Collection<Long> ids) {
if (CollUtil.isEmpty(ids)) {
return;
}
// 获得科室信息
Map<Long, DeptDO> deptMap = getDeptMap(ids);
// 校验
ids.forEach(id -> {
DeptDO dept = deptMap.get(id);
if (dept == null) ... | @Test
public void testValidateDeptList_success() {
// mock 数据
DeptDO deptDO = randomPojo(DeptDO.class).setStatus(CommonStatusEnum.ENABLE.getStatus());
deptMapper.insert(deptDO);
// 准备参数
List<Long> ids = singletonList(deptDO.getId());
// 调用,无需断言
deptService.va... |
@Override
public String toString() {
return toStringHelper(this)
.add("matchAny", matchAny)
.add("negation", negation)
.add("value", value)
.toString();
} | @Test
public void testToString() {
Match<String> m1 = Match.any();
Match<String> m2 = Match.any();
Match<String> m3 = Match.ifValue("foo");
Match<String> m4 = Match.ifValue("foo");
Match<String> m5 = Match.ifNotValue("foo");
String note = "Results of toString() shoul... |
public KsqlTarget target(final URI server) {
return target(server, Collections.emptyMap());
} | @Test
public void shouldPostQueryRequestStreamedWithLimit() throws Exception {
// Given:
int numRows = 10;
List<StreamedRow> expectedResponse = setQueryStreamResponse(numRows, true);
String sql = "whateva";
// When:
KsqlTarget target = ksqlClient.target(serverUri);
RestResponse<StreamPu... |
@Override
public String getName() {
return FUNCTION_NAME;
} | @Test
public void testRoundDecimalNullColumn() {
ExpressionContext expression =
RequestContextUtils.getExpression(String.format("round_decimal(%s)", INT_SV_NULL_COLUMN, 0));
TransformFunction transformFunction = TransformFunctionFactory.get(expression, _dataSourceMap);
Assert.assertTrue(transformF... |
public CompletableFuture<List<Credential>> getBackupAuthCredentials(
final Account account,
final Instant redemptionStart,
final Instant redemptionEnd) {
// If the account has an expired payment, clear it before continuing
if (hasExpiredVoucher(account)) {
return accountsManager.updateA... | @Test
void expiringBackupPayment() throws VerificationFailedException {
clock.pin(Instant.ofEpochSecond(1));
final Instant day0 = Instant.EPOCH;
final Instant day4 = Instant.EPOCH.plus(Duration.ofDays(4));
final Instant dayMax = day0.plus(BackupAuthManager.MAX_REDEMPTION_DURATION);
final BackupAu... |
@Override
public Long createProject(GoViewProjectCreateReqVO createReqVO) {
// 插入
GoViewProjectDO goViewProject = GoViewProjectConvert.INSTANCE.convert(createReqVO)
.setStatus(CommonStatusEnum.DISABLE.getStatus());
goViewProjectMapper.insert(goViewProject);
// 返回
... | @Test
public void testCreateProject_success() {
// 准备参数
GoViewProjectCreateReqVO reqVO = randomPojo(GoViewProjectCreateReqVO.class);
// 调用
Long goViewProjectId = goViewProjectService.createProject(reqVO);
// 断言
assertNotNull(goViewProjectId);
// 校验记录的属性是否正确
... |
public static void refreshSuperUserGroupsConfiguration() {
//load server side configuration;
refreshSuperUserGroupsConfiguration(new Configuration());
} | @Test
public void testNoHostsForUsers() throws Exception {
Configuration conf = new Configuration(false);
conf.set("y." + REAL_USER_NAME + ".users",
StringUtils.join(",", Arrays.asList(AUTHORIZED_PROXY_USER_NAME)));
ProxyUsers.refreshSuperUserGroupsConfiguration(conf, "y");
UserGroupInformation... |
@Override
public FailureResult howToHandleFailure(
Throwable failure, CompletableFuture<Map<String, String>> failureLabels) {
FailureResult failureResult = howToHandleFailure(failure);
if (reportEventsAsSpans) {
// TODO: replace with reporting as event once events are support... | @Test
void testHowToHandleFailureAllowedByStrategy() throws Exception {
final Configuration configuration = new Configuration();
configuration.set(TraceOptions.REPORT_EVENTS_AS_SPANS, Boolean.TRUE);
final List<Span> spanCollector = new ArrayList<>(1);
final UnregisteredMetricGroups.U... |
public static Comparator<Object[]> getComparator(List<OrderByExpressionContext> orderByExpressions,
ColumnContext[] orderByColumnContexts, boolean nullHandlingEnabled) {
return getComparator(orderByExpressions, orderByColumnContexts, nullHandlingEnabled, 0, orderByExpressions.size());
} | @Test
public void testTwoNullsCompareNextColumn() {
List<OrderByExpressionContext> orderBys = Arrays.asList(new OrderByExpressionContext(COLUMN1, ASC, NULLS_LAST),
new OrderByExpressionContext(COLUMN2, ASC, NULLS_LAST));
_rows = Arrays.asList(new Object[]{null, 2}, new Object[]{null, 3}, new Object[]{... |
@Override
public boolean dropTable(TableIdentifier identifier, boolean purge) {
if (!isValidIdentifier(identifier)) {
throw new NoSuchTableException("Invalid identifier: %s", identifier);
}
Path tablePath = new Path(defaultWarehouseLocation(identifier));
TableOperations ops = newTableOps(identi... | @Test
public void testDropTable() throws Exception {
HadoopCatalog catalog = hadoopCatalog();
TableIdentifier testTable = TableIdentifier.of("db", "ns1", "ns2", "tbl");
catalog.createTable(testTable, SCHEMA, PartitionSpec.unpartitioned());
String metaLocation = catalog.defaultWarehouseLocation(testTab... |
public static AlterReplicaTask rollupLocalTablet(long backendId, long dbId, long tableId, long partitionId,
long rollupIndexId, long rollupTabletId, long baseTabletId,
long newReplicaId, int newSchemaHash, int base... | @Test
public void testRollupLocalTablet() {
AlterReplicaTask task = AlterReplicaTask.rollupLocalTablet(1, 2, 3, 4, 5, 6,
7, 8, 9, 10, 11, 12, null, null);
Assert.assertEquals(1, task.getBackendId());
Assert.assertEquals(2, task.getDbId());
Assert.assertEquals(3, task... |
@Override
public CompletableFuture<Void> compensate(Exchange exchange) {
return sagaService.getClient().compensate(this.lraURL, exchange);
} | @DisplayName("Tests whether compensate is called on LRAClient")
@Test
void testCompensate() throws Exception {
CompletableFuture<Void> expected = CompletableFuture.completedFuture(null);
Mockito.when(client.compensate(url, exchange)).thenReturn(expected);
CompletableFuture<Void> actual ... |
@Override
public void onEvent(Event event) {
if (event instanceof ClientOperationEvent.ClientReleaseEvent) {
handleClientDisconnect((ClientOperationEvent.ClientReleaseEvent) event);
} else if (event instanceof ClientOperationEvent) {
handleClientOperation((ClientOperationEven... | @Test
void testOnEvent() {
Mockito.when(clientReleaseEvent.getClient()).thenReturn(client);
clientServiceIndexesManager.onEvent(clientReleaseEvent);
Mockito.verify(clientReleaseEvent).getClient();
clientServiceIndexesManager.onEvent(clientOperationEvent);
... |
public static TimeLimiterMetrics ofTimeLimiter(TimeLimiter timeLimiter) {
return new TimeLimiterMetrics(List.of(timeLimiter));
} | @Test
public void shouldRecordSuccesses() {
TimeLimiter timeLimiter = TimeLimiter.of(TimeLimiterConfig.ofDefaults());
metricRegistry.registerAll(TimeLimiterMetrics.ofTimeLimiter(timeLimiter));
timeLimiter.onSuccess();
timeLimiter.onSuccess();
assertThat(metricRegistry).hasM... |
public static Map<String, String> getKiePMMLMiningModelSourcesMap(final MiningModelCompilationDTO compilationDTO,
final List<KiePMMLModel> nestedModels) {
logger.trace("getKiePMMLMiningModelSourcesMap {} {} {}", compilationDTO.getFields(),
... | @Test
void getKiePMMLMiningModelSourcesMap() {
final List<KiePMMLModel> nestedModels = new ArrayList<>();
final CommonCompilationDTO<MiningModel> source =
CommonCompilationDTO.fromGeneratedPackageNameAndFields(PACKAGE_NAME,
... |
public static RpcQosOptions defaultOptions() {
return newBuilder().build();
} | @Test
public void ensureSerializable() {
SerializableUtils.ensureSerializable(RpcQosOptions.defaultOptions());
} |
public static boolean canDrop(
FilterPredicate pred, List<ColumnChunkMetaData> columns, DictionaryPageReadStore dictionaries) {
Objects.requireNonNull(pred, "pred cannnot be null");
Objects.requireNonNull(columns, "columns cannnot be null");
return pred.accept(new DictionaryFilter(columns, dictionarie... | @Test
public void testColumnWithDictionaryAndPlainEncodings() throws Exception {
IntColumn plain = intColumn("fallback_binary_field");
DictionaryPageReadStore dictionaryStore = mock(DictionaryPageReadStore.class);
assertFalse("Should never drop block using plain encoding", canDrop(eq(plain, -10), ccmd, d... |
@Override
public Object read(final PostgreSQLPacketPayload payload, final int parameterValueLength) {
return payload.getByteBuf().readShort();
} | @Test
void assertRead() {
byte[] data = {(byte) 0x80, (byte) 0x00, (byte) 0xFF, (byte) 0xFF, (byte) 0x7F, (byte) 0xFF};
PostgreSQLInt2BinaryProtocolValue actual = new PostgreSQLInt2BinaryProtocolValue();
PostgreSQLPacketPayload payload = new PostgreSQLPacketPayload(Unpooled.wrappedBuffer(dat... |
@Override
public int hashCode() {
int result = topic != null ? topic.hashCode() : 0;
result = 31 * result + (partition != null ? partition.hashCode() : 0);
result = 31 * result + (headers != null ? headers.hashCode() : 0);
result = 31 * result + (key != null ? key.hashCode() : 0);
... | @Test
public void testEqualsAndHashCode() {
ProducerRecord<String, Integer> producerRecord = new ProducerRecord<>("test", 1, "key", 1);
assertEquals(producerRecord, producerRecord);
assertEquals(producerRecord.hashCode(), producerRecord.hashCode());
ProducerRecord<String, Integer> e... |
@Override
public RegisterApplicationMasterResponse registerApplicationMaster(
RegisterApplicationMasterRequest request) throws YarnException,
IOException {
this.metrics.incrRequestCount();
long startTime = clock.getTime();
try {
RequestInterceptorChainWrapper pipeline =
authori... | @Test
public void testRegisterOneApplicationMaster() throws Exception {
// The testAppId identifier is used as host name and the mock resource
// manager return it as the queue name. Assert that we received the queue
// name
int testAppId = 1;
RegisterApplicationMasterResponse response1 = register... |
static boolean apply(@Nullable HttpStatus httpStatus) {
if (Objects.isNull(httpStatus)) {
return false;
}
RpcEnhancementReporterProperties reportProperties;
try {
reportProperties = ApplicationContextAwareUtils.getApplicationContext()
.getBean(RpcEnhancementReporterProperties.class);
}
catch (Bea... | @Test
public void testApplyWithSeries() {
RpcEnhancementReporterProperties properties = new RpcEnhancementReporterProperties();
// Mock Condition
properties.getStatuses().clear();
properties.getSeries().clear();
properties.getSeries().add(HttpStatus.Series.CLIENT_ERROR);
ApplicationContext applicationCont... |
@Override
@CheckForNull
public EmailMessage format(Notification notif) {
if (!(notif instanceof ChangesOnMyIssuesNotification)) {
return null;
}
ChangesOnMyIssuesNotification notification = (ChangesOnMyIssuesNotification) notif;
if (notification.getChange() instanceof AnalysisChange) {
... | @Test
public void user_input_content_should_be_html_escape() {
Project project = new Project.Builder("uuid").setProjectName("</projectName>").setKey("project_key").build();
String ruleName = "</RandomRule>";
String host = randomAlphabetic(15);
Rule rule = newRule(ruleName, randomRuleTypeHotspotExclude... |
@Override
public boolean equals(Object obj)
{
if (this == obj)
{
return true;
}
if (obj == null || getClass() != obj.getClass())
{
return false;
}
return areNewFieldsEqual((Request<?>) obj);
} | @Test(dataProvider = "toRequestFieldsData")
public void testRequestPagingFieldsEqual(List<PathSpec> pathSpecs1, List<PathSpec> pathSpecs2, Map<String,String> param1, Map<String,String> param2, boolean expect)
{
GetRequestBuilder<Long, TestRecord> builder1 = generateDummyRequestBuilder();
GetRequestBuilder<... |
static void run(
final SystemExit systemExit,
final String... args
) throws Throwable {
final Arguments arguments = new Arguments.Builder()
.parseArgs(args)
.build();
if (arguments.help) {
usage();
return;
}
final Properties props = getProperties(arguments);
... | @Test
public void shouldThrowIfSchemaFileDoesNotExist() throws Throwable {
// When:
final Exception e = assertThrows(
IllegalArgumentException.class,
() -> DataGen.run(
mockSystem,
"schema=you/won't/find/me/right?",
"format=avro",
"topic=foo",
... |
@Override
public Database getDb(String dbName) {
Database database;
try {
database = hmsOps.getDb(dbName);
} catch (Exception e) {
LOG.error("Failed to get hive database [{}.{}]", catalogName, dbName, e);
return null;
}
return database;
... | @Test
public void testGetDb() {
Database database = hiveMetadata.getDb("db1");
Assert.assertEquals("db1", database.getFullName());
} |
public static final String getTrimTypeDesc( int i ) {
if ( i < 0 || i >= trimTypeDesc.length ) {
return trimTypeDesc[0];
}
return trimTypeDesc[i];
} | @Test
public void testGetTrimTypeDesc() {
assertEquals( ValueMetaBase.getTrimTypeDesc( ValueMetaInterface.TRIM_TYPE_NONE ), BaseMessages.getString( PKG,
"ValueMeta.TrimType.None" ) );
assertEquals( ValueMetaBase.getTrimTypeDesc( ValueMetaInterface.TRIM_TYPE_LEFT ), BaseMessages.getString( PKG,
"Va... |
@Udf
public Map<String, String> splitToMap(
@UdfParameter(
description = "Separator string and values to join") final String input,
@UdfParameter(
description = "Separator string and values to join") final String entryDelimiter,
@UdfParameter(
description = "Separator s... | @Test
public void shouldSplitStringByGivenDelimiterChars() {
Map<String, String> result = udf.splitToMap("foo=apple;bar=cherry", ";", "=");
assertThat(result, hasEntry("foo", "apple"));
assertThat(result, hasEntry("bar", "cherry"));
assertThat(result.size(), equalTo(2));
} |
@Override
public List<?> deserialize(final String topic, final byte[] bytes) {
if (bytes == null) {
return null;
}
try {
final String recordCsvString = new String(bytes, StandardCharsets.UTF_8);
final List<CSVRecord> csvRecords = CSVParser.parse(recordCsvString, csvFormat)
.ge... | @Test
public void shouldThrowIfRowHasTooMayColumns() {
// Given:
final byte[] bytes = "1511897796092,1,item_1,10.0,10.10,100,100,100,100,extra\r\n"
.getBytes(StandardCharsets.UTF_8);
// When:
final Exception e = assertThrows(
SerializationException.class,
() -> deserializer.de... |
@Override
public Collection<ShutdownAwarePlugin> getShutdownAwarePluginList() {
return Collections.emptyList();
} | @Test
public void testGetShutdownAwarePluginList() {
Assert.assertEquals(Collections.emptyList(), manager.getShutdownAwarePluginList());
} |
public void verifyAndValidate(final String jwt) {
try {
Jws<Claims> claimsJws = Jwts.parser()
.verifyWith(tokenConfigurationParameter.getPublicKey())
.build()
.parseSignedClaims(jwt);
// Log the claims for debugging purposes
C... | @Test
void givenExpiredToken_whenVerifyAndValidate_thenThrowJwtException() {
// Given
String expiredToken = Jwts.builder()
.claim("user_id", "12345")
.issuedAt(new Date(System.currentTimeMillis() - 86400000L)) // 1 day ago
.expiration(new Date(System.... |
public Model parse(File file) throws PomParseException {
try (FileInputStream fis = new FileInputStream(file)) {
return parse(fis);
} catch (IOException ex) {
if (ex instanceof PomParseException) {
throw (PomParseException) ex;
}
LOGGER.deb... | @Test
public void testParse_InputStreamWithDocType() throws Exception {
InputStream inputStream = BaseTest.getResourceAsStream(this, "pom/mailapi-1.4.3_doctype.pom");
PomParser instance = new PomParser();
String expVersion = "1.4.3";
Model result = instance.parse(inputStream);
... |
public Rule<ProjectNode> projectNodeRule()
{
return new PullUpExpressionInLambdaProjectNodeRule();
} | @Test
public void testIfExpressionOnCondition()
{
tester().assertThat(new PullUpExpressionInLambdaRules(getFunctionManager()).projectNodeRule())
.setSystemProperty(PULL_EXPRESSION_FROM_LAMBDA_ENABLED, "true")
.on(p ->
{
p.variable("col1... |
public LU lu() {
return lu(false);
} | @Test
public void testLU() {
System.out.println("LU");
double[][] A = {
{0.9000, 0.4000, 0.7000f},
{0.4000, 0.5000, 0.3000f},
{0.7000, 0.3000, 0.8000f}
};
double[] b = {0.5, 0.5, 0.5f};
double[] x = {-0.2027027, 0.8783784, 0.47... |
private LinkKey(ConnectPoint src, ConnectPoint dst) {
this.src = checkNotNull(src);
this.dst = checkNotNull(dst);
} | @Test
public void testCompareNotEquals() {
LinkKey k1 = LinkKey.linkKey(SRC1, DST1);
LinkKey k2 = LinkKey.linkKey(SRC1, DST2);
assertThat(k1, is(not(equalTo(k2))));
assertThat(k1, is(not(equalTo(new Object()))));
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.