Unnamed: 0
int64
0
305k
body
stringlengths
7
52.9k
name
stringlengths
1
185
273,400
void (final String oldClassName, final String newClassName, final String changes) { final NameSuggester suggester = new NameSuggester(oldClassName, newClassName); assertEquals( changes, suggester.getChanges().toString() ); }
doChangesTest
273,401
void (final String oldClassName, final String newClassName, final String variableName, final String expectedSuggestion) { final NameSuggester suggester = new NameSuggester(oldClassName, newClassName); assertEquals(expectedSuggestion, suggester.suggestName(variableName)); }
doSuggestionTest
273,402
void () { System.clearProperty("jb.vmOptionsFile"); }
tearDown
273,403
void () { assertEquals(512, VMOptions.readOption(VMOptions.MemoryKind.HEAP, false)); assertEquals(128, VMOptions.readOption(VMOptions.MemoryKind.METASPACE, false)); }
reading
273,404
void () { VMOptions.parseMemoryOption("1b"); }
parsingInvalidMemoryOption
273,405
void () { String content = "*".repeat(1024); Attachment attachment = new Attachment("pure text.txt", content); assertThat(attachment.getDisplayText()).isEqualTo(content); assertThat(attachment.getBytes()).isEqualTo(content.getBytes(StandardCharsets.UTF_8)); }
stringContent
273,406
void () { assertEquals(HEAP, DefaultIdeaErrorLogger.getOOMErrorKind(new OutOfMemoryError())); assertEquals(HEAP, DefaultIdeaErrorLogger.getOOMErrorKind(new OutOfMemoryError("whatever"))); assertNull(DefaultIdeaErrorLogger.getOOMErrorKind(new OutOfMemoryError("unable to create new native thread"))); assertNull(DefaultId...
test
273,407
void () { assumeWindows(); assertNotNull(WindowsDefenderChecker.getInstance().isRealTimeProtectionEnabled()); }
defenderStatusDetection
273,408
void () { Element root = new Element("root"); root.addContent(new Text("$MACro1$ some text $macro2$ other text $MACRo3$")); root.addContent(new Text("$macro4$ some text")); root.addContent(new Text("some text$macro5$")); root.addContent(new Text("file:$mac_ro6$")); root.addContent(new Text("jar://$macr.o7$ ")); root.ad...
testCollectMacros
273,409
void () { Element root = new Element("root"); final Element configuration = new Element("configuration"); configuration.setAttribute("value", "some text$macro5$fdsjfhdskjfsd$MACRO$"); configuration.setAttribute("value2", "file://$root$/some/path/just$file$name.txt"); root.addContent(configuration); final Set<String> ma...
testWithRecursiveFilter
273,410
boolean (@NotNull Attribute attribute) { return "value".equals(attribute.getName()); }
recursePathMacros
273,411
void () { Element root = new Element("root"); final Element testTag = new Element("test"); testTag.setAttribute("path", "$MACRO$"); testTag.setAttribute("ignore", "$PATH$"); root.addContent(testTag); final Set<String> macros = PathMacrosCollector.getMacroNames(root, null, new PathMacrosImpl(false)); assertEquals(2, mac...
testWithFilter
273,412
boolean (@NotNull Attribute attribute) { return "ignore".equals(attribute.getName()); }
skipPathMacros
273,413
void () { doTest( new String[]{"1", "2", "3"}, new String[]{"4", "5", "6"}, new String[]{"7", "8", "9"}, new String[]{"1", "2", "3"}, new String[]{"4", "52", "6"}, new String[]{"7", "8", "9"} ); }
test1
273,414
void () { doTest( new String[]{"1", "1", "2", "3"}, new String[]{"4", "5", "6"}, new String[]{"7", "8", "9"}, new String[]{"1", "2", "3"}, new String[]{"4", "52", "6"}, new String[]{"7", "8", "9"} ); }
test2
273,415
void () { doTest( new String[]{"1", "2", "3"}, new String[]{"4", "5", "6"}, new String[]{"7", "8", "9"}, new String[]{"1", "2", "3"}, new String[]{"4", "5", "6"}, new String[]{"7", "8", "9"} ); }
test3
273,416
void () { doTest( new String[]{}, new String[]{"4", "5", "6"}, new String[]{"7", "8", "9"}, new String[]{"1", "2", "3"}, new String[]{"4", "5", "6"}, new String[]{"7", "8", "9"} ); }
test4
273,417
void () { doTest( new String[]{"1", "2", "3"}, new String[]{"4", "5", "6"}, new String[]{}, new String[]{"1", "2", "3"}, new String[]{"4", "5", "6"}, new String[]{"7", "8", "9"} ); }
test5
273,418
void () { doTest( new String[]{"1", "2", "3"}, new String[]{"4", "5", "6"}, new String[]{"7", "8", "9"}, new String[]{}, new String[]{"4", "5", "6"}, new String[]{"7", "8", "9"} ); }
test6
273,419
void () { doTest( new String[]{"1", "2", "3"}, new String[]{"4", "5", "6"}, new String[]{"7", "8", "9"}, new String[]{"1", "2", "3"}, new String[]{"4", "5", "6"}, new String[]{} ); }
test7
273,420
void () { doTest( new String[]{"1", "2", "3"}, new String[]{"4", "5", "6"}, new String[]{"7", "8", "9"}, new String[]{"1", "2", "3"}, new String[]{"44", "4", "5", "6", "66"}, new String[]{"7", "8", "9"} ); }
test8
273,421
void () { doTest( new String[]{"1", "2", "3"}, new String[]{"4", "5", "6"}, new String[]{"7", "8", "9"}, new String[]{"1", "2", "3"}, new String[]{"44", "4", "55", "6", "66"}, new String[]{"7", "8", "9"} ); }
test9
273,422
void () { doTest( new String[]{"0.5", "1", "3", "3.5"}, new String[]{"4", "5", "5.5", "6"}, new String[]{"6,5", "7", "8", "9", "9.5"}, new String[]{"+0.5", "1", "2", "3", "3.5+", "3.5++"}, new String[]{"4", "5", "5.5+", "6"}, new String[]{"+6,5", "++6,5", "7", "9", "9.5+", "9.5++"} ); }
test10
273,423
void () { doTest( new String[]{"1", "2", "3"}, new String[]{"a", "a"}, new String[]{"7", "8", "9"}, new String[]{"1", "2", "3"}, new String[]{"b"}, new String[]{"7", "8", "9"} ); }
test11
273,424
void () { doTest( new String[]{"1", "2", "3"}, new String[]{}, new String[]{"7", "8", "9"}, new String[]{"1", "2", "3"}, new String[]{"4", "5", "6"}, new String[]{"7", "8", "9"} ); }
test12
273,425
void () { doTest( new String[]{"1", "2", "3"}, new String[]{"4", "5", "6"}, new String[]{"7", "8", "9"}, new String[]{}, new String[]{"4", "52", "6"}, new String[]{} ); }
test13
273,426
void () { doTest( new String[]{}, new String[]{"4", "52", "6"}, new String[]{}, new String[]{"1", "2", "3"}, new String[]{"4", "5", "6"}, new String[]{"7", "8", "9"} ); }
test14
273,427
void () { doTest( new String[]{}, new String[]{"x", "y", "z"}, new String[]{}, new String[]{"1"}, new String[]{"2", "3"}, new String[]{"4"} ); doTest( new String[]{"1"}, new String[]{"0"}, new String[]{"3"}, new String[]{"1", "4"}, new String[]{"5", "0"}, new String[]{"3"} ); doTest( new String[]{"1", "2"}, new String[...
testGreediness
273,428
void () { doTest( new String[]{}, new String[]{}, new String[]{}, new String[]{}, new String[]{}, new String[]{} ); doTest( new String[]{}, new String[]{}, new String[]{}, new String[]{}, new String[]{}, new String[]{"x"} ); doTest( new String[]{}, new String[]{}, new String[]{}, new String[]{"x"}, new String[]{}, new ...
testEmptyPreviousText
273,429
void () { doTest( new String[]{}, new String[]{}, new String[]{"x"}, new String[]{}, new String[]{}, new String[]{} ); doTest( new String[]{}, new String[]{}, new String[]{"x", "y", "z"}, new String[]{}, new String[]{}, new String[]{} ); doTest( new String[]{}, new String[]{}, new String[]{"x"}, new String[]{}, new Str...
testEmptyCurrentRange
273,430
void () { Block block = new Block("0\n1\n2\n3\n4\n5\n6", 3, 7); String blockContent = block.getBlockContent(); assertEquals("3\n4\n5\n6", blockContent); block = new Block("0\n1\n2\n3\n4\n5\n6\n", 3, 7); blockContent = block.getBlockContent(); assertEquals("3\n4\n5\n6", blockContent); }
testContent
273,431
void ( String[] beforePrevBlock, String[] prevBlock, String[] afterPrevBlock, String[] beforeBlock, String[] block, String[] afterBlock) { String[] prevVersion = composeVersion(beforePrevBlock, prevBlock, afterPrevBlock); String[] currentVersion = composeVersion(beforeBlock, block, afterBlock); Block actualBlock = new ...
doTest
273,432
String[] (String[] beforeBlock, String[] block, String[] afterBlock) { List<String> beforeList = new ArrayList<>(); ContainerUtil.addAll(beforeList, beforeBlock); ContainerUtil.addAll(beforeList, block); ContainerUtil.addAll(beforeList, afterBlock); return ArrayUtilRt.toStringArray(beforeList); }
composeVersion
273,433
void () { int N = 10_000; List<Integer> things = new ArrayList<>(N); int sum = 0; for (int i = 0; i < N; i++) { int v = i < N-50 ? 1 : 1000; things.add(v); sum += v; } //noinspection PointlessArithmeticExpression assertEquals((N-50)*1 + 50*1000, sum); long elapsed = TimeoutUtil.measureExecutionTime(() -> assertTrue(Job...
testUnbalancedTaskJobUtilPerformance
273,434
void (int o) { busySleepAndIncrement(o); }
longSleep
273,435
int (int ms) { return busySleepAndIncrement(ms, EmptyRunnable.getInstance()); }
busySleepAndIncrement
273,436
int (int ms, @NotNull Runnable doWhileWait) { long deadline = System.currentTimeMillis() + ms; int nap = Math.max(1, ms / 100); while (System.currentTimeMillis() < deadline) { TimeoutUtil.sleep(nap); doWhileWait.run(); } return COUNT.incrementAndGet(); }
busySleepAndIncrement
273,437
void (@NotNull Runnable r) { LOG.debug("Elapsed: " + TimeoutUtil.measureExecutionTime(r::run) + "ms"); }
logElapsed
273,438
void () { int N = Timings.adjustAccordingToMySpeed(40, true); List<String> list = Collections.nCopies(N, null); for (int i = 0; i<10 && checkTestTimeout(i); i++) { COUNT.set(0); logElapsed(()-> JobLauncher.getInstance().invokeConcurrentlyUnderProgress(list, null, __ -> { JobLauncher.getInstance().invokeConcurrentlyUnde...
testJobUtilRecursiveStress
273,439
void () { checkExceptionBubblesUp(new RuntimeException("myMsg")); checkExceptionBubblesUp(new MyException("myMsg")); checkExceptionBubblesUp(new Error("myMsg")); checkExceptionBubblesUp(new IncorrectOperationException("myMsg")); //checkExceptionBubblesUp(new ProcessCanceledException()); }
testThrowExceptionInProcessorMustBubbleUpToInvokeConcurrently
273,440
void (@NotNull Throwable ex) { COUNT.set(0); assertTrue(ex.getMessage().contains("myMsg")); List<Object> objects = Collections.nCopies(100_000, null); UsefulTestCase.assertThrows(ex.getClass(), "myMsg", () -> JobLauncher.getInstance().invokeConcurrentlyUnderProgress(objects, null, __ -> { if (COUNT.incrementAndGet() ==...
checkExceptionBubblesUp
273,441
void () { ProgressIndicator progress = new DaemonProgressIndicator(); UsefulTestCase.assertThrows(ProcessCanceledException.class, () -> JobLauncher.getInstance().invokeConcurrentlyUnderProgress(Collections.nCopies(100_000, null), progress, __ -> { if (COUNT.incrementAndGet() == 10_000) { progress.cancel(); } return tru...
testIndicatorCancelMustEnsuePCE
273,442
void () { List<Object> objects = Collections.nCopies(100_000, null); boolean success = JobLauncher.getInstance().invokeConcurrentlyUnderProgress(objects, null, __ -> COUNT.incrementAndGet() != 10_000); assertFalse(success); }
testReturnFalseFromProcessorMustLeadToReturningFalseFromInvokeConcurrently
273,443
void () { List<Object> objects = Collections.nCopies(1_000_000, null); ApplicationManager.getApplication().runWriteAction(() -> { boolean success = JobLauncher.getInstance().invokeConcurrentlyUnderProgress(objects, null, true, false, __ -> { COUNT.incrementAndGet(); return true; }); assertTrue(success); assertEquals(ob...
testCompletesEvenIfCannotGrabReadAction
273,444
void () { List<Integer> list = IntStream.range(0, 100).boxed().collect(Collectors.toList()); for (int i = 0; i<10 && checkTestTimeout(i); i++) { int fingerPrint = i; COUNT.set(0); LOG.debug("--- " + i+"; fingerPrint="+fingerPrint+"; COUNT="+COUNT); boolean[] success = new boolean[1]; logElapsed(()-> UsefulTestCase.asse...
testRecursiveCancel
273,445
void () { AtomicInteger processed = new AtomicInteger(); Processor<String> processor = __ -> { int next = processed.incrementAndGet(); busySleepAndIncrement(next % 4, ProgressManager::checkCanceled); return next % 100 != 0; }; int N = Timings.adjustAccordingToMySpeed(10_000, true); for (int i = 0; i<100 && checkTestTim...
testProcessorReturningFalseDoesNotCrashTheOtherThreadStress
273,446
void (@NotNull String TOMB_STONE, @NotNull BlockingQueue<String> queue, @NotNull Queue<String> failedQueue) { while (true) { Disposable disposable = Disposer.newDisposable(); ProgressIndicator wrapper = new DaemonProgressIndicator(); try { // avoid "attach listener"/"write action" race ReadAction.run(() -> { wrapper.st...
processQueueInBackground
273,447
boolean (Object progress) { return !t.timedOut(progress); }
checkTestTimeout
273,448
void () { int parallelism = JobSchedulerImpl.getJobPoolParallelism(); // values higher than this can lead to too coarse tasks in FJP queue which means some of them may contain more than one element which means long-delay task and some short-delay tasks can be scheduled to one chunk which means some of the tasks will no...
testInvokeConcurrentlyMustExecuteMultipleTasksConcurrentlyEvenIfOneOfThemIsWildlySlowStress
273,449
void () { List<Integer> ints = IntStream.range(1, 123_271*JobSchedulerImpl.getJobPoolParallelism()/11).boxed().collect(Collectors.toList()); for (int i = 0; i<100 && checkTestTimeout(i); i++) { AtomicInteger executed = new AtomicInteger(); AtomicBoolean returnedFalse = new AtomicBoolean(); boolean result = JobLauncher....
testJobWaitForTerminationAfterReturningFalseInTheMiddleOfTheExecutionWaitsUntilAllOtherTasksFinished_Stress
273,450
void () { String json = "{ \"mandatory\" : \"text\" }"; doTest(json, Class1.class, true); }
testSuccess1
273,451
void () { String json = "{ \"simple\" : \"text2\", \"mandatory\" : \"text\" }"; doTest(json, Class1.class, true); }
testSuccess2
273,452
void () { String json = "{ \"unknown\" : \"text2\", \"mandatory\" : \"text\" }"; doTest(json, Class1.class, true); }
testSuccess3
273,453
void () { String json = "null"; doTest(json, Class1.class, true); }
testSuccess4
273,454
void () { String json = "{ \"simple\" : \"text2\" }"; doTest(json, Class1.class, false); }
testFailure1
273,455
void () { String json = "{ \"unknown\" : \"text2\" }"; doTest(json, Class1.class, false); }
testFailure2
273,456
void () { String json = "{ \"mandatory\" : null }"; doTest(json, Class1.class, false); }
testFailure3
273,457
void () { String json = "{ \"mandatory\" : { \"mandatory\" : \"text\" } }"; doTest(json, Class2.class, true); }
testSuccessEnclosed1
273,458
void () { String json = "{ \"mandatory\" : { \"mandatory\" : \"text\" }, \"simple\" : { \"mandatory\" : \"text\" } }"; doTest(json, Class2.class, true); }
testSuccessEnclosed2
273,459
void () { String json = "{ \"mandatory\" : { \"mandatory\" : \"text\" }, \"simple\" : null }"; doTest(json, Class2.class, true); }
testSuccessEnclosed3
273,460
void () { String json = "{ \"simple\" : { \"mandatory\" : \"text\" } }"; doTest(json, Class2.class, false); }
testFailureEnclosed1
273,461
void () { String json = "{ \"mandatory\" : null }"; doTest(json, Class2.class, false); }
testFailureEnclosed2
273,462
void () { String json = "{ \"mandatory\" : { \"simple\" : \"text\" } }"; doTest(json, Class2.class, false); }
testFailureEnclosed3
273,463
void () { String json = "{ \"mandatory\" : { \"mandatory\" : null, \"simple\" : \"text\" } }"; doTest(json, Class2.class, false); }
testFailureEnclosed4
273,464
void () { String json = "{ \"mandatory\" : { \"mandatory\" : \"text\" }, \"simple\" : { \"simple\" : \"text\" } }"; doTest(json, Class2.class, false); }
testFailureEnclosed5
273,465
void (@NotNull String json, @NotNull Class<?> clazz, boolean expectedSuccess) { Gson gson = new GsonBuilder() .registerTypeAdapterFactory(NullCheckingFactory.INSTANCE) .create(); boolean success; try { Object result = gson.fromJson(json, clazz); success = true; } catch (JsonMandatoryException e) { success = false; } as...
doTest
273,466
void () { addExposedPort(DEFAULT_PORT); }
configure
273,467
EventLogExternalSendSettings (@NotNull String productVersion) { EventLogConfigVersions version = findMajorVersion(productVersion); if (version == null) { return EMPTY; } Map<EventLogBuildType, EventLogSendConfiguration> configurations = new EnumMap<>(EventLogBuildType.class); for (EventLogConfigFilterCondition filter :...
toSendSettings
273,468
EventLogConfigVersions (@NotNull String productVersion) { if (versions == null || versions.isEmpty()) { return null; } return versions.stream() .filter(v -> v.majorBuildVersionBorders != null && v.majorBuildVersionBorders.accept(productVersion)) .findFirst().orElse(null); }
findMajorVersion
273,469
boolean () { return !myConfigurations.isEmpty(); }
isSendEnabled
273,470
EventLogSendConfiguration (@NotNull EventLogBuildType type) { return myConfigurations.get(type); }
getConfiguration
273,471
String (@NotNull String name) { return myEndpoints.get(name); }
getEndpoint
273,472
boolean (@Nullable String s) { return s == null || s.isEmpty(); }
isEmpty
273,473
boolean (@Nullable String s) { return !isEmpty(s); }
isNotEmpty
273,474
boolean (@Nullable String s) { if (isEmpty(s)) { return true; } for (int i = 0; i < s.length(); i++) { if (s.charAt(i) > ' ') { return false; } } return true; }
isEmptyOrSpaces
273,475
boolean (@Nullable String s1, @Nullable String s2) { //noinspection StringEquality if (s1 == s2) return true; if (s1 == null || s2 == null) return false; if (s1.length() != s2.length()) return false; return s1.equals(s2); }
equals
273,476
List<String> (@NotNull String text, char separator) { List<String> result = new ArrayList<>(); int pos = 0; int index = text.indexOf(separator, pos); while (index >= 0) { final int nextPos = index + 1; String token = text.substring(pos, index); if (token.length() != 0) { result.add(token); } pos = nextPos; index = text...
split
273,477
String (@Nullable String str) { return str == null ? null : str.toLowerCase(Locale.ENGLISH); }
toLowerCase
273,478
int () { return getOptionAsInt(DATA_THRESHOLD); }
getThreshold
273,479
int () { return getOptionAsInt(GROUP_THRESHOLD); }
getGroupThreshold
273,480
int () { return getOptionAsInt(GROUP_ALERT_THRESHOLD); }
getGroupAlertThreshold
273,481
int () { return getOptionAsInt(MACHINE_ID_SALT_REVISION); }
getMachineIdRevision
273,482
String () { return myOptions.get(MACHINE_ID_SALT); }
getMachineIdSalt
273,483
int (@NotNull String name) { return tryParseInt(myOptions.get(name)); }
getOptionAsInt
273,484
int (@Nullable String value) { try { if (StatisticsStringUtil.isNotEmpty(value)) { return Integer.parseInt(value); } } catch (NumberFormatException e) { //ignore } return -1; }
tryParseInt
273,485
boolean (int bucket) { return from <= bucket && bucket < to; }
contains
273,486
boolean (Object o) { if (this == o) return true; if (o == null || getClass() != o.getClass()) return false; EventLogBucketRange range = (EventLogBucketRange)o; return from == range.from && to == range.to; }
equals
273,487
int () { return Objects.hash(from, to); }
hashCode
273,488
void (EventLogBucketRange range) { myBuckets.add(range); }
addBucketRange
273,489
List<EventLogBucketRange> () { return myBuckets; }
getBuckets
273,490
boolean (Object o) { if (this == o) return true; if (o == null || getClass() != o.getClass()) return false; EventLogSendConfiguration that = (EventLogSendConfiguration)o; return Objects.equals(myBuckets, that.myBuckets); }
equals
273,491
int () { return Objects.hash(myBuckets); }
hashCode
273,492
List<EventLogConfigFilterCondition> () { return releaseFilters != null ? releaseFilters : Collections.emptyList(); }
getFilters
273,493
EventLogBucketRange () { return isValid() ? new EventLogBucketRange(from, to) : null; }
getBucketRange
273,494
boolean () { return from != 0 || to != Integer.MAX_VALUE; }
isValid
273,495
boolean (@NotNull String current) { EventLogMajorVersion build = EventLogMajorVersion.fromString(current); if (!isValidMajorVersion(build)) { return false; } EventLogMajorVersion toVersion = EventLogMajorVersion.fromString(to); EventLogMajorVersion fromVersion = EventLogMajorVersion.fromString(from); if (!isValidMajorV...
accept
273,496
boolean (@Nullable EventLogMajorVersion build) { if (build == null) return false; int[] components = build.getComponents(); return components.length > 0 && components[0] > 0; }
isValidMajorVersion
273,497
int[] () { return myComponents.clone(); }
getComponents
273,498
EventLogMajorVersion (@Nullable String version) { if (version == null || StatisticsStringUtil.isEmptyOrSpaces(version)) { return null; } int separator = version.indexOf('.'); if (separator > 0) { List<String> components = StatisticsStringUtil.split(version, '.'); return new EventLogMajorVersion(toIntArray(components));...
fromString
273,499
int[] (List<String> components) { int componentsSize = components.size(); int size = componentsSize != 1 ? componentsSize : 2; int[] array = new int[size]; for (int i = 0; i < componentsSize; i++) { String component = components.get(i); array[i] = tryParseInt(component); } if (componentsSize < size) { array[componentsS...
toIntArray