focal_method
stringlengths
13
60.9k
test_case
stringlengths
25
109k
@Nullable public static DateTime parse(String s, DateTimeZone timeZone, Locale locale) { // Trim input string and consolidate repeating blanks final String text = s.trim().replaceAll("\\s{2,}", " "); // First try UNIX epoch millisecond timestamp try { final long l = Long...
@Test public void parseWithTimeZoneAndLocale() throws Exception { assertEquals(testString, expectedDateTime, CEFTimestampParser.parse(testString, timeZone, locale)); }
public static Set<String> findKeywordsFromCrashReport(String crashReport) { Matcher matcher = CRASH_REPORT_STACK_TRACE_PATTERN.matcher(crashReport); Set<String> result = new HashSet<>(); if (matcher.find()) { for (String line : matcher.group("stacktrace").split("\\n")) { ...
@Test public void nei() throws IOException { assertEquals( new HashSet<>(Arrays.asList("nei", "codechicken", "guihook")), CrashReportAnalyzer.findKeywordsFromCrashReport(loadLog("/crash-report/mod/nei.txt"))); }
@GET @Produces({ MediaType.APPLICATION_JSON + "; " + JettyUtils.UTF_8, MediaType.APPLICATION_XML + "; " + JettyUtils.UTF_8 }) public HistoryInfo get() { return getHistoryInfo(); }
@Test public void testInfoSlash() throws JSONException, Exception { WebResource r = resource(); ClientResponse response = r.path("ws").path("v1").path("history") .path("info/").accept(MediaType.APPLICATION_JSON) .get(ClientResponse.class); assertEquals(MediaType.APPLICATION_JSON + "; " + J...
@Override public NativeEntity<ViewDTO> createNativeEntity(Entity entity, Map<String, ValueReference> parameters, Map<EntityDescriptor, Object> nativeEntities, S...
@Test @MongoDBFixtures("ViewFacadeTest.json") public void itShouldCreateADTOFromAnEntity() throws Exception { final StreamImpl stream = new StreamImpl(Collections.emptyMap()); final Entity viewEntity = createViewEntity(); final Map<EntityDescriptor, Object> nativeEntities = Map.of(Entity...
public RemotingDesc getServiceDesc(Object bean, String beanName) { List<RemotingDesc> ret = new ArrayList<>(); for (RemotingParser remotingParser : allRemotingParsers) { RemotingDesc s = remotingParser.getServiceDesc(bean, beanName); if (s != null) { ret.add(s); ...
@Test public void testGetServiceDesc() { SimpleRemoteBean remoteBean = new SimpleRemoteBean(); RemotingDesc desc = remotingParser.getServiceDesc(remoteBean, remoteBean.getClass().getName()); assertEquals(Protocols.IN_JVM, desc.getProtocol()); assertEquals(SimpleRemoteBean.class, desc...
public static int scan(final UnsafeBuffer termBuffer, final int termOffset, final int limitOffset) { int offset = termOffset; while (offset < limitOffset) { final int frameLength = frameLengthVolatile(termBuffer, offset); if (frameLength <= 0) { ...
@Test void shouldScanEmptyBuffer() { final int offset = 0; final int limit = termBuffer.capacity(); final int newOffset = TermBlockScanner.scan(termBuffer, offset, limit); assertEquals(offset, newOffset); }
@Override public byte[] createIV() throws NoSuchAlgorithmException { KeyGenerator keygen = KeyGenerator.getInstance("AES"); keygen.init(128); return keygen.generateKey().getEncoded(); }
@Test public void shouldGenerateA16ByteIV() throws NoSuchAlgorithmException { ProductionIVProvider ivProvider = new ProductionIVProvider(); byte[] iv = ivProvider.createIV(); assertThat(iv).hasSize(16); }
public static boolean containsGender( @NonNull CharSequence text, @NonNull JavaEmojiUtils.Gender gender) { return JavaEmojiUtils.containsGender(text, gender); }
@Test public void testContainsGenderGeneral() { Assert.assertFalse(JavaEmojiUtils.containsGender("\uD83E\uDDD4")); Assert.assertTrue(JavaEmojiUtils.containsGender("\uD83E\uDDD4\u200D♀")); Assert.assertTrue(JavaEmojiUtils.containsGender("\uD83E\uDDD4\uD83C\uDFFB\u200D♀")); Assert.assertFalse(JavaEmojiU...
public static int compare(Object o1, Object o2) { return o1.getClass() != o2.getClass() && o1 instanceof Number && o2 instanceof Number ? asBigDecimal((Number)o1).compareTo(asBigDecimal((Number)o2)) : ((Comparable) o1).compareTo(o2); }
@Test public void compareWithString() { assertThat(OperatorUtils.compare("ABC", "AAA")).isPositive(); assertThat(OperatorUtils.compare("ABC", "ABC")).isZero(); assertThat(OperatorUtils.compare("ABC", "XYZ")).isNegative(); }
public static <P> Matcher<P> or(Iterable<? extends Matcher<P>> matchers) { return or(toArray(matchers)); }
@Test void or_single() { Matcher<Boolean> one = Boolean::booleanValue; assertThat(or(one)).isSameAs(one); }
public static int getHeartbeat(URL url) { String configuredHeartbeat = System.getProperty(Constants.HEARTBEAT_CONFIG_KEY); int defaultHeartbeat = Constants.DEFAULT_HEARTBEAT; if (StringUtils.isNotEmpty(configuredHeartbeat)) { try { defaultHeartbeat = Integer.parseInt(...
@Test void testConfiguredHeartbeat() { System.setProperty(Constants.HEARTBEAT_CONFIG_KEY, "200"); URL url = URL.valueOf("dubbo://127.0.0.1:12345"); Assertions.assertEquals(200, UrlUtils.getHeartbeat(url)); System.clearProperty(Constants.HEARTBEAT_CONFIG_KEY); }
@SuppressWarnings("unused") // Part of required API. public void execute( final ConfiguredStatement<InsertValues> statement, final SessionProperties sessionProperties, final KsqlExecutionContext executionContext, final ServiceContext serviceContext ) { final InsertValues insertValues = s...
@Test public void shouldHandleFullRow() { // Given: final ConfiguredStatement<InsertValues> statement = givenInsertValues( allColumnNames(SCHEMA), ImmutableList.of( new StringLiteral("key"), new StringLiteral("str"), new LongLiteral(2L) ) ); ...
public static String byteToBits(byte b) { return "" + (byte) ((b >> 7) & 0x01) + (byte) ((b >> 6) & 0x1) + (byte) ((b >> 5) & 0x01) + (byte) ((b >> 4) & 0x1) + (byte) ((b >> 3) & 0x01) + (byte) ((b >> 2) & 0x1) + (byte) ((b >> 1) & 0x01) + (byte) ((b >> 0) & 0x1);...
@Test public void byteToBits() { byte b = 0x35; // 0011 0101 Assert.assertEquals(CodecUtils.byteToBits(b), "00110101"); }
public static Optional<JobResourceRequirements> readFromJobGraph(JobGraph jobGraph) throws IOException { try { return Optional.ofNullable( InstantiationUtil.readObjectFromConfig( jobGraph.getJobConfiguration(), J...
@Test void testReadNonExistentResourceRequirementsFromJobGraph() throws IOException { assertThat(JobResourceRequirements.readFromJobGraph(JobGraphTestUtils.emptyJobGraph())) .isEmpty(); }
@Override public String name() { return NAME; }
@Test void testName() { assertEquals("Hessian", hessianSerializer.name()); }
protected int getMapCompletionEvents() throws IOException, InterruptedException { int numNewMaps = 0; TaskCompletionEvent events[] = null; do { MapTaskCompletionEventsUpdate update = umbilical.getMapCompletionEvents( (org.apache.hadoop.mapred.JobID)reduce.getJobID()...
@Test public void testConsecutiveFetch() throws IOException, InterruptedException { final int MAX_EVENTS_TO_FETCH = 100; TaskAttemptID tid = new TaskAttemptID("12345", 1, TaskType.REDUCE, 1, 1); TaskUmbilicalProtocol umbilical = mock(TaskUmbilicalProtocol.class); when(umbilical.getMapCompletion...
String getServiceLabelValue() { return serviceLabelValue; }
@Test public void emptyProperties() { // given Map<String, Comparable> properties = createProperties(); properties.put(SERVICE_LABEL_NAME.key(), " "); String serviceLabelValue = "service-label-value"; properties.put(SERVICE_LABEL_VALUE.key(), serviceLabelValue); prop...
public static String getNormalisedPartitionValue(String partitionValue, String type) { LOG.debug("Converting '" + partitionValue + "' to type: '" + type + "'."); if (type.equalsIgnoreCase("tinyint") || type.equalsIgnoreCase("smallint") || type.equalsIgnoreCase("int")){ return Integer.toString(In...
@Test public void testConversionToSignificantNumericTypes() { assertEquals("1", MetaStoreServerUtils.getNormalisedPartitionValue("0001", "tinyint")); assertEquals("1", MetaStoreServerUtils.getNormalisedPartitionValue("0001", "smallint")); assertEquals("10", MetaStoreServerUtils.getNormalisedPartitionValue...
@Override public <T extends Notification<?>> Flowable<T> subscribe( Request request, String unsubscribeMethod, Class<T> responseType) { // We can't use usual Observer since we can call "onError" // before first client is subscribed and we need to // preserve it BehaviorSu...
@Test public void testSendUnsubscribeRequest() throws Exception { CountDownLatch unsubscribed = new CountDownLatch(1); runAsync( () -> { Flowable<NewHeadsNotification> flowable = subscribeToEvents(); flowable.subscribe().dispose(); ...
public String forDisplay(List<ConfigurationProperty> propertiesToDisplay) { ArrayList<String> list = new ArrayList<>(); for (ConfigurationProperty property : propertiesToDisplay) { if (!property.isSecure()) { list.add(format("%s=%s", property.getConfigurationKey().getName().t...
@Test void shouldNotGetValuesOfSecureKeysInConfigForDisplay() { ConfigurationProperty property1 = new ConfigurationProperty(new ConfigurationKey("key1"), new ConfigurationValue("value1"), null, null); ConfigurationProperty property2 = new ConfigurationProperty(new ConfigurationKey("key2"), new Confi...
@PostMapping("/refresh-token") public CustomResponse<TokenResponse> refreshToken(@RequestBody @Valid final TokenRefreshRequest tokenRefreshRequest) { log.info("UserController | refreshToken"); final Token token = refreshTokenService.refreshToken(tokenRefreshRequest); final TokenResponse toke...
@Test void givenLoginRequest_WhenLoginForUser_ThenReturnToken() throws Exception { // Given LoginRequest loginRequest = LoginRequest.builder() .email("admin@example.com") .password("password") .build(); Token mockToken = Token.builder() ...
public Coin parse(String str) throws NumberFormatException { return Coin.valueOf(parseValue(str, Coin.SMALLEST_UNIT_EXPONENT)); }
@Test(expected = NumberFormatException.class) public void parseInvalidHugeNumber() { NO_CODE.parse("99999999999999999999"); }
@Override public Health checkNode() { return nodeHealthChecks.stream() .map(NodeHealthCheck::check) .reduce(Health.GREEN, HealthReducer::merge); }
@Test public void checkNode_returns_GREEN_status_if_only_GREEN_statuses_returned_by_NodeHealthCheck() { List<Health.Status> statuses = IntStream.range(1, 1 + random.nextInt(20)).mapToObj(i -> GREEN).toList(); HealthCheckerImpl underTest = newNodeHealthCheckerImpl(statuses.stream()); assertThat(underTest....
public static int standardErrorToBuckets(double maxStandardError) { checkCondition(maxStandardError >= LOWEST_MAX_STANDARD_ERROR && maxStandardError <= HIGHEST_MAX_STANDARD_ERROR, INVALID_FUNCTION_ARGUMENT, "Max standard error must be in [%s, %s]: %s", LOWEST_MAX_STANDARD_ERR...
@Test public void testStandardErrorToBucketsBounds() { try { // Lower bound standardErrorToBuckets(0.0040624); fail(); } catch (PrestoException e) { assertEquals(e.getErrorCode(), INVALID_FUNCTION_ARGUMENT.toErrorCode()); } ...
private boolean parseValuesAndFilterPartition( String partitionName, List<HudiColumnHandle> partitionColumns, List<Type> partitionColumnTypes, TupleDomain<ColumnHandle> constraintSummary) { if (constraintSummary.isNone()) { return false; } ...
@Test public void testParseValuesAndFilterPartition() { ConnectorSession session = new TestingConnectorSession( new HiveSessionProperties( new HiveClientConfig().setMaxBucketsForGroupedExecution(100), new OrcFileWriterConfig(), ...
@ProcessElement public void processElement(OutputReceiver<InitialPipelineState> receiver) throws IOException { LOG.info(daoFactory.getStreamTableDebugString()); LOG.info(daoFactory.getMetadataTableDebugString()); LOG.info("ChangeStreamName: " + daoFactory.getChangeStreamName()); boolean resume = fals...
@Test public void testInitializeResumeWithDNP() throws IOException { Instant resumeTime = Instant.now().minus(Duration.standardSeconds(10000)); metadataTableDao.updateDetectNewPartitionWatermark(resumeTime); dataClient.mutateRow( RowMutation.create( tableId, metadat...
public static String[] tokenizeToStringArray(String str, String delimiters, boolean trimTokens, boolean ignoreEmptyTokens) { if (str == null) { return EMPTY_STRING_ARRAY; } StringTokenizer st = new StringTokenizer(str, delimiters); List<String> t...
@Test void testTokenizeToStringArray() { // Test case 1: Empty string String str1 = ""; String delimiters1 = ","; boolean trimTokens1 = true; boolean ignoreEmptyTokens1 = false; String[] expected1 = new String[0]; String[] result1 = StringUtils.tokenizeToStrin...
public MessageExt viewMessage(String topic, String msgId) throws RemotingException, MQBrokerException, InterruptedException, MQClientException { return this.mQClientFactory.getMQAdminImpl().viewMessage(topic, msgId); }
@Test public void testViewMessage() throws InterruptedException, MQClientException, MQBrokerException, RemotingException { assertNull(defaultMQPushConsumerImpl.viewMessage(defaultTopic, createMessageExt().getMsgId())); }
@Override public Object read(final PostgreSQLPacketPayload payload, final int parameterValueLength) { byte[] bytes = new byte[parameterValueLength]; payload.getByteBuf().readBytes(bytes); return ARRAY_PARAMETER_DECODER.decodeInt8Array(bytes, '{' != bytes[0]); }
@Test void assertRead() { String parameterValue = "{\"11\",\"12\"}"; int expectedLength = 4 + parameterValue.length(); ByteBuf byteBuf = ByteBufTestUtils.createByteBuf(expectedLength); byteBuf.writeInt(parameterValue.length()); byteBuf.writeCharSequence(parameterValue, Standa...
static DynamicState stateMachineStep(DynamicState dynamicState, StaticState staticState) throws Exception { LOG.debug("STATE {}", dynamicState.state); switch (dynamicState.state) { case EMPTY: return handleEmpty(dynamicState, staticState); case RUNNING: ...
@Test public void testErrorHandlingWhenLocalizationFails() throws Exception { try (SimulatedTime ignored = new SimulatedTime(1010)) { int port = 8080; String topoId = "NEW"; List<ExecutorInfo> execList = mkExecutorInfoList(1, 2, 3, 4, 5); LocalAssignment newAs...
public Optional<User> login(String nameOrEmail, String password) { if (nameOrEmail == null || password == null) { return Optional.empty(); } User user = userDAO.findByName(nameOrEmail); if (user == null) { user = userDAO.findByEmail(nameOrEmail); } if (user != null && !user.isDisabled()) { boolean...
@Test void callingLoginShouldNotReturnUserObjectOnUnsuccessfulAuthentication() { Mockito.when(userDAO.findByName("test")).thenReturn(normalUser); Mockito.when(passwordEncryptionService.authenticate(Mockito.anyString(), Mockito.any(byte[].class), Mockito.any(byte[].class))) .thenReturn(false); Optional<User>...
@Override public Optional<ReadError> read(DbFileSources.Line.Builder lineBuilder) { if (readError == null) { try { processSymbols(lineBuilder); } catch (RangeOffsetConverter.RangeOffsetConverterException e) { readError = new ReadError(Data.SYMBOLS, lineBuilder.getLine()); LOG.w...
@Test public void display_file_key_in_warning_when_range_offset_converter_throw_RangeOffsetConverterException() { TextRange declaration = newTextRange(LINE_1, LINE_1, OFFSET_1, OFFSET_3); doThrow(RangeOffsetConverter.RangeOffsetConverterException.class).when(rangeOffsetConverter).offsetToString(declaration, L...
public static void validateJarOnClient(SubmitJobParameters parameterObject) throws IOException { if (parameterObject.isJarOnMember()) { throw new JetException("SubmitJobParameters is configured for jar on member"); } Path jarPath = parameterObject.getJarPath(); validateJarPa...
@Test public void noSuchFileException() { SubmitJobParameters parameterObject = SubmitJobParameters.withJarOnClient(); parameterObject.setJarPath(Paths.get("nosuchfile.jar")); assertThatThrownBy(() -> SubmitJobParametersValidator.validateJarOnClient(parameterObject)) .isInsta...
public static AS2SignedDataGenerator createSigningGenerator( AS2SignatureAlgorithm signingAlgorithm, Certificate[] certificateChain, PrivateKey privateKey) throws HttpException { ObjectHelper.notNull(certificateChain, "certificateChain"); if (certificateChain.length == 0 || !(cer...
@Test public void createSigningGeneratorTest() throws Exception { AS2SignedDataGenerator gen = SigningUtils.createSigningGenerator(AS2SignatureAlgorithm.SHA1WITHRSA, new Certificate[] { signingCert }, signingKP.getPrivate()); CMSProcessableByteArray sData = new CMSProcessableByteArra...
@Operation(summary = "Get single organization") @GetMapping(value = "name/{name}", produces = "application/json") @ResponseBody public Organization getByName(@PathVariable("name") String name) { return organizationService.getOrganizationByName(name); }
@Test public void getOrganizationByName() { when(organizationServiceMock.getOrganizationByName(anyString())).thenReturn(newOrganization()); Organization result = controllerMock.getByName("test"); assertEquals(newOrganization().getName(), result.getName()); verify(organizationServic...
@Override public Set<GPUInfo> retrieveResourceInfo(long gpuAmount) throws Exception { Preconditions.checkArgument( gpuAmount > 0, "The gpuAmount should be positive when retrieving the GPU resource information."); final Set<GPUInfo> gpuResources = new HashSet<>(); ...
@Test void testGPUDriverWithInvalidAmount() throws Exception { final int gpuAmount = -1; final Configuration config = new Configuration(); config.set(GPUDriverOptions.DISCOVERY_SCRIPT_PATH, TESTING_DISCOVERY_SCRIPT_PATH); final GPUDriver gpuDriver = new GPUDriver(config); as...
public static void requireNotNull(final Object obj, final String name) { if (obj == null) { throw new NullPointerException(name + " must not be null"); } }
@Test(expectedExceptions = NullPointerException.class, expectedExceptionsMessageRegExp = ".*foo.*") public void testNotNullWithNull() { ArgumentUtil.requireNotNull(null, "foo"); }
public void execute() { execute(LOG); }
@Test public void should_not_fail_if_no_language_on_project() { QProfileVerifier profileLogger = new QProfileVerifier(store, profiles); profileLogger.execute(); }
@Override public void doFilter(HttpRequest request, HttpResponse response, FilterChain filterChain) throws IOException { boolean isAuthenticated = authenticate(request, response); response.setContentType(MediaTypes.JSON); try (JsonWriter jsonWriter = JsonWriter.of(response.getWriter())) { jsonWrite...
@Test public void doFilter_whenDefaultForceAuthentication_shouldReturnFalse() throws Exception { underTest.doFilter(request, response, chain); verifyResponseIsFalse(); }
public String normalizeNamespace(String appId, String namespaceName) { AppNamespace appNamespace = appNamespaceServiceWithCache.findByAppIdAndNamespace(appId, namespaceName); if (appNamespace != null) { return appNamespace.getName(); } appNamespace = appNamespaceServiceWithCache.findPublicNamespa...
@Test public void testNormalizeNamespaceWithPublicNamespace() throws Exception { String someAppId = "someAppId"; String someNamespaceName = "someNamespaceName"; String someNormalizedNamespaceName = "someNormalizedNamespaceName"; AppNamespace someAppNamespace = mock(AppNamespace.class); when(someA...
public static NotificationDispatcherMetadata newMetadata() { return METADATA; }
@Test public void reportFailures_notification_is_enable_at_project_level() { NotificationDispatcherMetadata metadata = ReportAnalysisFailureNotificationHandler.newMetadata(); assertThat(metadata.getProperty(PER_PROJECT_NOTIFICATION)).isEqualTo("true"); }
@Operation(summary = "Check connection", description = "Check connection for hosts") @PostMapping("/check-connection") public ResponseEntity<Boolean> checkConnection( @PathVariable Long clusterId, @RequestBody @Validated HostnamesReq hostnamesReq) { return ResponseEntity.success(hostService....
@Test void checkConnectionReturnsSuccess() { Long clusterId = 1L; HostnamesReq hostnamesReq = new HostnamesReq(); hostnamesReq.setHostnames(Arrays.asList("host1", "host2")); when(hostService.checkConnection(hostnamesReq.getHostnames())).thenReturn(true); ResponseEntity<Boole...
protected abstract void stealTheItem(String target);
@Test void testStealTheItem() { assertEquals(0, appender.getLogSize()); this.method.stealTheItem(this.expectedTarget); assertEquals(this.expectedStealMethod, appender.getLastMessage()); assertEquals(1, appender.getLogSize()); }
public static <T> void concat(T[] sourceFirst, T[] sourceSecond, T[] dest) { System.arraycopy(sourceFirst, 0, dest, 0, sourceFirst.length); System.arraycopy(sourceSecond, 0, dest, sourceFirst.length, sourceSecond.length); }
@Test public void concat() { Integer[] first = new Integer[]{1, 2, 3}; Integer[] second = new Integer[]{4}; Integer[] concatenated = new Integer[4]; ArrayUtils.concat(first, second, concatenated); assertEquals(4, concatenated.length); assertEquals(Integer.valueOf(1), ...
public ConfigEvaluatorBuilder setSecurityManager(SecurityManager manager) { evaluatorBuilder.setSecurityManager(manager); return this; }
@Test public void setSecurityManager() { var builder = ConfigEvaluatorBuilder.preconfigured(); assertThat(builder.getAllowedModules()).isEqualTo(SecurityManagers.defaultAllowedModules); assertThat(builder.getAllowedResources()).isEqualTo(SecurityManagers.defaultAllowedResources); var manager = ...
@Override public double getStdDev() { // two-pass algorithm for variance, avoids numeric overflow if (values.length <= 1) { return 0; } final double mean = getMean(); double variance = 0; for (int i = 0; i < values.length; i++) { final doubl...
@Test public void calculatesAStdDevOfZeroForAnEmptySnapshot() { final Snapshot emptySnapshot = new WeightedSnapshot( weightedArray(new long[]{}, new double[]{})); assertThat(emptySnapshot.getStdDev()) .isZero(); }
@Override public int compareTo( MonetDbVersion mDbVersion ) { int result = majorVersion.compareTo( mDbVersion.majorVersion ); if ( result != 0 ) { return result; } result = minorVersion.compareTo( mDbVersion.minorVersion ); if ( result != 0 ) { return result; } result = patch...
@Test public void testCompareVersions_NoPatch() throws Exception { String dbVersionBigger = "11.18"; String dbVersion = "11.17.17"; assertEquals( 1, new MonetDbVersion( dbVersionBigger ).compareTo( new MonetDbVersion( dbVersion ) ) ); }
public MetricName metricInstance(MetricNameTemplate template, String... keyValue) { return metricInstance(template, MetricsUtils.getTags(keyValue)); }
@Test public void testMetricInstances() { MetricName n1 = metrics.metricInstance(SampleMetrics.METRIC1, "key1", "value1", "key2", "value2"); Map<String, String> tags = new HashMap<>(); tags.put("key1", "value1"); tags.put("key2", "value2"); MetricName n2 = metrics.metricInsta...
@Override public void execute(ComputationStep.Context context) { PostMeasuresComputationCheck.Context extensionContext = new ContextImpl(); for (PostMeasuresComputationCheck extension : extensions) { extension.onCheck(extensionContext); } }
@Test public void fail_if_an_extension_throws_an_exception() { PostMeasuresComputationCheck check1 = mock(PostMeasuresComputationCheck.class); PostMeasuresComputationCheck check2 = mock(PostMeasuresComputationCheck.class); doThrow(new IllegalStateException("BOOM")).when(check2).onCheck(any(Context.class))...
public Stream openWithOffsetInJsonPointer(InputStream in, String offsetInJsonPointer) throws IOException { return this.delegate.openWithOffsetInJsonPointer(in, offsetInJsonPointer); }
@Test public void testParseMultipleJsonsWithPointer() throws Exception { final JsonParser parser = new JsonParser(); final String multipleJsons = "{\"a\": {\"b\": 1}}{\"a\": {\"b\": 2}}"; try (JsonParser.Stream stream = parser.openWithOffsetInJsonPointer(toInputStream(multipleJsons), "/a/b")...
public long position() { if (isClosed) { return finalPosition; } return subscriberPosition.get(); }
@Test void shouldNotAdvancePastEndOfTerm() { final Image image = createImage(); final long expectedPosition = TERM_BUFFER_LENGTH - 32; position.setOrdered(expectedPosition); assertThat(image.position(), is(expectedPosition)); assertThrows(IllegalArgumentException.class,...
@Override public List<Service> getServiceDefinitions() throws MockRepositoryImportException { List<Service> result = new ArrayList<>(); // Build a new service. Service service = new Service(); JsonNode metadataNode = spec.get("metadata"); if (metadataNode == null) { log.error...
@Test void testAPIMetadataImport() { MetadataImporter importer = null; try { importer = new MetadataImporter( "target/test-classes/io/github/microcks/util/metadata/hello-grpc-v1-metadata.yml"); } catch (IOException ioe) { fail("Exception should not be thrown"); ...
public boolean usesBuckets( @NonNull VFSConnectionDetails details ) throws KettleException { return details.hasBuckets() && getResolvedRootPath( details ) == null; }
@Test public void testUsesBucketsReturnsFalseIfHasBucketsAndRootPath() throws KettleException { when( vfsConnectionDetails.hasBuckets() ).thenReturn( true ); assertFalse( vfsConnectionManagerHelper.usesBuckets( vfsConnectionDetails ) ); }
public int appendIndex(final long logIndex, final int position, final byte logType) { this.writeLock.lock(); try { assert (logIndex > getLastLogIndex()); final byte[] writeData = encodeData(toRelativeOffset(logIndex), position, logType); return doAppend(logIndex, writ...
@Test public void testAppendIndex() { this.offsetIndex.appendIndex(appendEntry0.getOffset(), appendEntry0.getPosition(), segmentIndex); this.offsetIndex.appendIndex(appendEntry1.getOffset(), appendEntry1.getPosition(), segmentIndex); this.offsetIndex.appendIndex(appendEntry2.getOffset(), app...
private void ensureRecordingLogCoherent( final long leadershipTermId, final long termBaseLogPosition, final long logPosition, final long nowNs) { ensureRecordingLogCoherent( ctx, consensusModuleAgent.logRecordingId(), initialLogLeadershipTe...
@Test void shouldThrowNonZeroLogPositionAndNullRecordingIdSpecified() { Election.ensureRecordingLogCoherent(ctx, NULL_POSITION, 0, 0, 0, 0, 0, 1); Election.ensureRecordingLogCoherent(ctx, NULL_POSITION, 0, 0, 0, 0, 1000, 1); verifyNoInteractions(recordingLog); }
public int getIdentityFromOrdinal(int fromOrdinal) { int hashCode = HashCodes.hashInt(fromOrdinal); int bucket = hashCode & (fromOrdinalsMap.length - 1); while(fromOrdinalsMap[bucket] != -1L) { if((int)fromOrdinalsMap[bucket] == fromOrdinal) { if((fromOrdinalsMap[bu...
@Test public void testFromIdentityOrdinals() { Assert.assertEquals(1, map.getIdentityFromOrdinal(1)); Assert.assertEquals(4, map.getIdentityFromOrdinal(2)); Assert.assertEquals(7, map.getIdentityFromOrdinal(3)); Assert.assertEquals(5025, map.getIdentityFromOrdinal(100)); Asse...
public static JsonNode transferToJsonNode(Object obj) { return mapper.valueToTree(obj); }
@Test void testTransferToJsonNode() { JsonNode jsonNode1 = JacksonUtils.transferToJsonNode(Collections.singletonMap("key", "value")); assertEquals("value", jsonNode1.get("key").asText()); JsonNode jsonNode2 = JacksonUtils.transferToJsonNode(new TestOfAtomicObject()); assertE...
public boolean sync() throws IOException { if (!preSyncCheck()) { return false; } if (!getAllDiffs()) { return false; } List<Path> sourcePaths = context.getSourcePaths(); final Path sourceDir = sourcePaths.get(0); final Path targetDir = context.getTargetPath(); final FileSy...
@Test public void testSyncWithCurrent() throws Exception { final DistCpOptions options = new DistCpOptions.Builder( Collections.singletonList(source), target) .withSyncFolder(true) .withUseDiff("s1", ".") .build(); context = new DistCpContext(options); initData(source); ...
public Map<String, Parameter> generateMergedWorkflowParams( WorkflowInstance instance, RunRequest request) { Workflow workflow = instance.getRuntimeWorkflow(); Map<String, ParamDefinition> allParamDefs = new LinkedHashMap<>(); Map<String, ParamDefinition> defaultWorkflowParams = defaultParamMa...
@Test public void testRestartConfigRunChangedParamMerge() { Map<String, Object> meta = Collections.singletonMap(Constants.METADATA_SOURCE_KEY, "SYSTEM_DEFAULT"); LongParameter param = LongParameter.builder() .name("TARGET_RUN_DATE") .value(1000L) .evaluatedR...
public static Field p(String fieldName) { return SELECT_ALL_FROM_SOURCES_ALL.where(fieldName); }
@Test void contains_phrase_near_onear_equiv_empty_list_should_throw_illegal_argument_exception() { assertThrows(IllegalArgumentException.class, () -> Q.p("f1").containsPhrase(List.of()) .build()); assertThrows(IllegalArgumentException.class, () -> Q.p("f1").containsNear(List.of()) ...
@Override public void setUnixPermission(final Path file, final TransferStatus status) throws BackgroundException { try { Files.setPosixFilePermissions(session.toPath(file), PosixFilePermissions.fromString(status.getPermission().getSymbol())); } catch(IllegalArgumentException e) {...
@Test public void testSetUnixPermission() throws Exception { final LocalSession session = new LocalSession(new Host(new LocalProtocol(), new LocalProtocol().getDefaultHostname())); if(session.isPosixFilesystem()) { assertNotNull(session.open(new DisabledProxyFinder(), new DisabledHostKey...
public Counter getCounterByRequestId(CounterRequest request) { final String requestId = request.getId(); for (final Counter counter : counters) { if (counter.isRequestIdFromThisCounter(requestId)) { return counter; } } return null; }
@Test public void testGetCounterByRequestId() { final Counter counter = createCounter(); final Collector collector = new Collector("test collector3", Collections.singletonList(counter)); counter.addRequest("test request", 0, 0, 0, false, 1000); final CounterRequest request = counter.getRequests().get(0); ...
@Override public int totalSize() { return payload != null ? payload.length : 0; }
@Test public void totalSize_whenNonEmpty() { HeapData heapData = new HeapData(new byte[10]); assertEquals(10, heapData.totalSize()); }
static int toInteger(final JsonNode object) { if (object instanceof NumericNode) { return object.intValue(); } if (object instanceof TextNode) { try { return Integer.parseInt(object.textValue()); } catch (final NumberFormatException e) { throw failedStringCoercionException(...
@Test public void shouldNotIncludeValueInExceptionWhenFailingToInteger() { try { // When: JsonSerdeUtils.toInteger(JsonNodeFactory.instance.textNode("personal info: do not log me")); fail("Invalid test: should throw"); } catch (final Exception e) { assertThat(ExceptionUtils.getStackT...
public static ShowResultSet execute(ShowStmt statement, ConnectContext context) { return GlobalStateMgr.getCurrentState().getShowExecutor().showExecutorVisitor.visit(statement, context); }
@Test public void testShowBasicStatsMeta() throws Exception { new MockUp<AnalyzeMgr>() { @Mock public Map<AnalyzeMgr.StatsMetaKey, ExternalBasicStatsMeta> getExternalBasicStatsMetaMap() { Map<AnalyzeMgr.StatsMetaKey, ExternalBasicStatsMeta> map = new HashMap<>(); ...
@Override public boolean shouldWait() { RingbufferContainer ringbuffer = getRingBufferContainerOrNull(); if (resultSet == null) { resultSet = new ReadResultSetImpl<>(minSize, maxSize, getNodeEngine().getSerializationService(), filter); sequence = startSequence; } ...
@Test public void whenEnoughItemsAvailable() { long startSequence = ringbuffer.tailSequence() + 1; ReadManyOperation op = getReadManyOperation(startSequence, 1, 3, null); ringbuffer.add("item1"); ringbuffer.add("item2"); ringbuffer.add("item3"); ringbuffer.add("item4...
@Override public double d(String a, String b) { if (weight != null) return weightedEdit(a, b); else if (FKP == null || a.length() == 1 || b.length() == 1) return damerau ? damerau(a, b) : levenshtein(a, b); else return br(a, b); }
@Test public void testDamerauSpeedTest() { System.out.println("Advanced Damerau speed test"); EditDistance edit = new EditDistance(Math.max(H1N1.length(), H1N5.length()), true); for (int i = 0; i < 100; i++) { edit.d(H1N1, H1N5); } }
public boolean poll(Timer timer, boolean waitForJoinGroup) { maybeUpdateSubscriptionMetadata(); invokeCompletedOffsetCommitCallbacks(); if (subscriptions.hasAutoAssignedPartitions()) { if (protocol == null) { throw new IllegalStateException("User configured " + Cons...
@Test public void testAutoCommitAsyncWithUserAssignedType() { try (ConsumerCoordinator coordinator = buildCoordinator(rebalanceConfig, new Metrics(), assignors, true, subscriptions)) { subscriptions.assignFromUser(Collections.singleton(t1p)); // set timeout to 0 because we expect no ...
public void shutDownConnections() { this.heartbeatHandler.shutdown(); this.rmProxyRelayer.shutdown(); }
@Test(timeout = 10000) public void testShutDownConnections() throws YarnException, IOException, InterruptedException { launchUAM(attemptId); registerApplicationMaster( RegisterApplicationMasterRequest.newInstance(null, 0, null), attemptId); uam.shutDownConnections(); while (uam.isHeartbe...
public static Combine.BinaryCombineDoubleFn ofDoubles() { return new Max.MaxDoubleFn(); }
@Test public void testMaxDoubleFnNan() { testCombineFn( Max.ofDoubles(), Lists.newArrayList(Double.NaN, 2.0, 3.0, Double.POSITIVE_INFINITY), Double.NaN); }
public String toString() { StringBuilder sb = new StringBuilder(); sb.append("size(unknown):=") .append(this.getSize()) .append(", "); sb.append("signature(Compression type identifier):=") .append(new String(this.getSignature(), UTF_8)) ...
@Test public void testGetToString() { assertTrue( chmLzxcControlData.toString().contains(TestParameters.VP_CONTROL_DATA_SIGNATURE)); }
@Override protected boolean isInfinite(Integer number) { // Infinity never applies here because only types like Float and Double have Infinity return false; }
@Test void testIsInfinite() { IntegerSummaryAggregator ag = new IntegerSummaryAggregator(); // always false for Integer assertThat(ag.isInfinite(-1)).isFalse(); assertThat(ag.isInfinite(0)).isFalse(); assertThat(ag.isInfinite(23)).isFalse(); assertThat(ag.isInfinite(I...
void escape(String escapeChars, StringBuffer buf) { if ((pointer < patternLength)) { char next = pattern.charAt(pointer++); escapeUtil.escape(escapeChars, buf, next, pointer); } }
@Test public void testEscape() throws ScanException { { List<Token> tl = new TokenStream("\\%").tokenize(); List<Token> witness = new ArrayList<Token>(); witness.add(new Token(Token.LITERAL, "%")); assertEquals(witness, tl); } { Li...
public static Iterable<String> expandAtNFilepattern(String filepattern) { ImmutableList.Builder<String> builder = ImmutableList.builder(); Matcher match = AT_N_SPEC.matcher(filepattern); if (!match.find()) { builder.add(filepattern); } else { int numShards = Integer.parseInt(match.group("N")...
@Test public void testExpandAtNFilepatternHugeN() throws Exception { exception.expect(IllegalArgumentException.class); exception.expectMessage( "Unsupported number of shards: 2000000000 " + "in filepattern: gs://bucket/object@2000000000.ism"); Filepatterns.expandAtNFilepattern("gs://bu...
@Override public AppResponse process(Flow flow, ActivateWithCodeRequest request) throws FlowNotDefinedException, IOException, NoSuchAlgorithmException { Map<String, Object> result = digidClient.activateAccountWithCode(appSession.getAccountId(), request.getActivationCode()); if (result.get(lowerUnd...
@Test public void responseTestOK() throws FlowNotDefinedException, IOException, NoSuchAlgorithmException { //given when(digidClientMock.activateAccountWithCode(anyLong(), any())).thenReturn(Map.of( lowerUnderscore(STATUS), "OK", lowerUnderscore(ISSUER_TYPE), "type" ))...
public GsonBuilder newBuilder() { return new GsonBuilder(this); }
@Test public void testDefaultGsonNewBuilderModification() { Gson gson = new Gson(); GsonBuilder gsonBuilder = gson.newBuilder(); // Modifications of `gsonBuilder` should not affect `gson` object gsonBuilder.registerTypeAdapter( CustomClass1.class, new TypeAdapter<CustomClass1>() { ...
@Override public ConfigOperateResult insertOrUpdateTag(final ConfigInfo configInfo, final String tag, final String srcIp, final String srcUser) { if (findConfigInfo4TagState(configInfo.getDataId(), configInfo.getGroup(), configInfo.getTenant(), tag) == null) { return addConfigInfo4Ta...
@Test void testInsertOrUpdateTagOfUpdate() { String dataId = "dataId111222"; String group = "group"; String tenant = "tenant"; String appName = "appname1234"; String content = "c12345"; ConfigInfo configInfo = new ConfigInfo(dataId, group, tenant, appName, co...
public GenericException createInstallmentNotFoundException(int installmentId) { return GenericException.builder() .httpStatus(HttpStatus.NOT_FOUND) .logMessage(this.getClass().getName() + ".getCredit unpaid installment not found with installment id {0}", installmentId) ...
@Test void createInstallmentNotFoundException() { // Act GenericException exception = creditService.createInstallmentNotFoundException(1); // Assert assertEquals(HttpStatus.NOT_FOUND, exception.getHttpStatus()); assertEquals(ErrorCode.INSTALLMENT_NOT_FOUND, exception.getErro...
@Override public String generateSegmentName(int sequenceId, @Nullable Object minTimeValue, @Nullable Object maxTimeValue) { return _segmentName; }
@Test public void testWithMalFormedSegmentName() { assertEquals(new FixedSegmentNameGenerator("seg01").generateSegmentName(0, null, null), "seg01"); try { new FixedSegmentNameGenerator("seg*01").generateSegmentName(0, null, null); Assert.fail(); } catch (IllegalArgumentException e) { // ...
@Override public boolean add(FilteredBlock block) throws VerificationException, PrunedException { boolean success = super.add(block); if (success) { trackFilteredTransactions(block.getTransactionCount()); } return success; }
@Test public void unconnectedBlocks() throws Exception { Context.propagate(new Context(100, Coin.ZERO, false, true)); Block b1 = TESTNET.getGenesisBlock().createNextBlock(coinbaseTo); Block b2 = b1.createNextBlock(coinbaseTo); Block b3 = b2.createNextBlock(coinbaseTo); // Con...
@Override public double getMean() { if (values.length == 0) { return 0; } double sum = 0; for (int i = 0; i < values.length; i++) { sum += values[i] * normWeights[i]; } return sum; }
@Test public void calculatesAMeanOfZeroForAnEmptySnapshot() throws Exception { final Snapshot emptySnapshot = new WeightedSnapshot( WeightedArray(new long[]{}, new double[]{}) ); assertThat(emptySnapshot.getMean()) .isZero(); }
public static String cloudIdEncode(String... args) { final String joinedArgs = String.join("$", args); return Base64.getUrlEncoder().encodeToString(joinedArgs.getBytes()); }
@Test public void testThrowExceptionWhenKibanaSegmentSegmentIsUndefined() { String[] raw = new String[] {"us-east-1.aws.found.io", "my-elastic-cluster", "undefined"}; String encoded = CloudSettingId.cloudIdEncode(raw); Exception thrownException = assertThrows(org.jruby.exceptions.ArgumentEr...
static void validateCsvFormat(CSVFormat format) { String[] header = checkArgumentNotNull(format.getHeader(), "Illegal %s: header is required", CSVFormat.class); checkArgument(header.length > 0, "Illegal %s: header cannot be empty", CSVFormat.class); checkArgument( !format.getAllowMissingCo...
@Test public void givenCSVFormatWithHeaderContainingNull_throwsException() { CSVFormat format = csvFormat().withHeader(null, "bar"); String gotMessage = assertThrows( IllegalArgumentException.class, () -> CsvIOParseHelpers.validateCsvFormat(format)) .getMessage(); asser...
public SimpleAuthenticationConfig addUser(@Nonnull String username, @Nonnull String password, String... roles) { addUser(username, new UserDto(password, roles)); return self(); }
@Test public void testAddUser() { SimpleAuthenticationConfig c = new SimpleAuthenticationConfig(); c.addUser("user1", "password1"); c.addUser("user2", "password2", "role1"); c.addUser("user3", "password3", "role1", "role2", "role3"); assertEquals(3, c.getUsernames().size()); ...
public static double getSourceTablesSizeInBytes(PlanNode node, Context context) { return getSourceTablesSizeInBytes(node, context.getLookup(), context.getStatsProvider()); }
@Test public void testGetSourceTablesSizeInBytes() { PlanBuilder planBuilder = new PlanBuilder(tester.getSession(), new PlanNodeIdAllocator(), tester.getMetadata()); VariableReferenceExpression variable = planBuilder.variable("col"); VariableReferenceExpression sourceVariable1 = planBuil...
public void transitionTo(ClassicGroupState groupState) { assertValidTransition(groupState); previousState = state; state = groupState; currentStateTimestamp = Optional.of(time.milliseconds()); metrics.onClassicGroupStateTransition(previousState, state); }
@Test public void testStateTransitionMetrics() { // Confirm metrics is not updated when a new GenericGroup is created but only when the group transitions // its state. GroupCoordinatorMetricsShard metrics = mock(GroupCoordinatorMetricsShard.class); ClassicGroup group = new ClassicGro...
@Override public void connect() throws IllegalStateException, IOException { if (isConnected()) { throw new IllegalStateException("Already connected"); } try { connection = connectionFactory.newConnection(); } catch (TimeoutException e) { throw new...
@Test public void shouldNotConnectToGraphiteServerMoreThenOnce() throws Exception { graphite.connect(); try { graphite.connect(); failBecauseExceptionWasNotThrown(IllegalStateException.class); } catch (IllegalStateException e) { assertThat(e.getMessage())....
@POST @Path("/token") @Produces(MediaType.APPLICATION_JSON) public Response token( @FormParam("code") String code, @FormParam("grant_type") String grantType, @FormParam("redirect_uri") String redirectUri, @FormParam("client_id") String clientId, @FormParam("client_assertion_type") St...
@Test void token_badGrantType() { var tokenIssuer = mock(TokenIssuer.class); var authenticator = mock(ClientAuthenticator.class); var sut = new TokenEndpoint(tokenIssuer, authenticator); var clientId = "myapp"; var grantType = "yolo"; var code = "6238e4504332468aa0c12e300787fded"; wh...
public static Node build(final List<JoinInfo> joins) { Node root = null; for (final JoinInfo join : joins) { if (root == null) { root = new Leaf(join.getLeftSource()); } if (root.containsSource(join.getRightSource()) && root.containsSource(join.getLeftSource())) { throw new K...
@Test public void handlesRightThreeWayJoin() { // Given: when(j1.getLeftSource()).thenReturn(a); when(j1.getRightSource()).thenReturn(b); when(j2.getLeftSource()).thenReturn(c); when(j2.getRightSource()).thenReturn(a); when(j2.flip()).thenReturn(j2); final List<JoinInfo> joins = ImmutableL...
@Override public Optional<DiscreteResource> parent() { return id.parent().map(x -> Resources.discrete(x).resource()); }
@Test public void testThereIsParent() { DiscreteResource resource = Resources.discrete(D1, P1, VLAN1).resource(); DiscreteResource parent = Resources.discrete(D1, P1).resource(); assertThat(resource.parent(), is(Optional.of(parent))); }
public MetadataReportBuilder appendParameter(String key, String value) { this.parameters = appendParameter(this.parameters, key, value); return getThis(); }
@Test void appendParameter() { MetadataReportBuilder builder = new MetadataReportBuilder(); builder.appendParameter("default.num", "one").appendParameter("num", "ONE"); Map<String, String> parameters = builder.build().getParameters(); Assertions.assertTrue(parameters.containsKey("d...
@Override public V remove(K key) { return map.remove(key); }
@Test public void testRemove() { map.put(23, "value-23"); assertTrue(map.containsKey(23)); assertEquals("value-23", adapter.remove(23)); assertFalse(map.containsKey(23)); }
@Override public OAuth2CodeDO consumeAuthorizationCode(String code) { OAuth2CodeDO codeDO = oauth2CodeMapper.selectByCode(code); if (codeDO == null) { throw exception(OAUTH2_CODE_NOT_EXISTS); } if (DateUtils.isExpired(codeDO.getExpiresTime())) { throw exceptio...
@Test public void testConsumeAuthorizationCode_null() { // 调用,并断言 assertServiceException(() -> oauth2CodeService.consumeAuthorizationCode(randomString()), OAUTH2_CODE_NOT_EXISTS); }
public void setMemorySegment(MemorySegment memorySegment, int offset) { Preconditions.checkArgument(memorySegment != null, "MemorySegment can not be null."); Preconditions.checkArgument(offset >= 0, "Offset should be positive integer."); Preconditions.checkArgument( offset + byte...
@TestTemplate void verifyBitSetSize2() { assertThatThrownBy(() -> bitSet.setMemorySegment(null, 1)) .isInstanceOf(IllegalArgumentException.class); }
@Override public void doAfterResponse(String remoteAddr, RemotingCommand request, RemotingCommand response) { if (RequestCode.GET_ROUTEINFO_BY_TOPIC != request.getCode()) { return; } if (response == null || response.getBody() == null || ResponseCode.SUCCESS != response.getCode())...
@Test public void testDoAfterResponseWithNoResponse() { HashMap<String, String> extFields = new HashMap<>(); extFields.put(MixAll.ZONE_MODE, "true"); RemotingCommand request = RemotingCommand.createRequestCommand(105,null); request.setExtFields(extFields); zoneRouteRPCHook.do...
public ArgumentListBuilder addKeyValuePairsFromPropertyString(String prefix, String properties, VariableResolver<String> vr) throws IOException { return addKeyValuePairsFromPropertyString(prefix, properties, vr, null); }
@Test public void addKeyValuePairsFromPropertyString() throws IOException { final Map<String, String> map = new HashMap<>(); map.put("PATH", "C:\\Windows"); final VariableResolver<String> resolver = new VariableResolver.ByMap<>(map); final String properties = "my.path=$PATH"; ...
@VisibleForTesting static long calculateProcessingTimeTimerInterval(long watermarkInterval, long idleTimeout) { checkArgument(watermarkInterval > 0 || idleTimeout > 0); if (watermarkInterval <= 0) { return idleTimeout; } if (idleTimeout <= 0) { return watermar...
@Test public void testCalculateProcessingTimeTimerInterval() { assertThat(calculateProcessingTimeTimerInterval(5, 0)).isEqualTo(5); assertThat(calculateProcessingTimeTimerInterval(5, -1)).isEqualTo(5); assertThat(calculateProcessingTimeTimerInterval(0, 5)).isEqualTo(5); assertThat(c...
public PrepareEacResponse prepareEacRequestRestService(PrepareEacRequest request) { PrepareEacResponse response = new PrepareEacResponse(); EidSession session = initSession(request, null, response); if (session == null) return response; // 1.8 PA SOd sod = mapper.read(request.ge...
@Test void prepareEacRequestRestServiceTest() throws Exception { EidSession session = new EidSession(); PrepareEacRequest request = new PrepareEacRequest(); request.setHeader(createRequestHeader()); request.setDg14(Base64.decode("SSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSS...
@Override public void validateSmsCode(SmsCodeValidateReqDTO reqDTO) { validateSmsCode0(reqDTO.getMobile(), reqDTO.getCode(), reqDTO.getScene()); }
@Test public void validateSmsCode_notFound() { // 准备参数 SmsCodeValidateReqDTO reqDTO = randomPojo(SmsCodeValidateReqDTO.class, o -> { o.setMobile("15601691300"); o.setScene(randomEle(SmsSceneEnum.values()).getScene()); }); // mock 数据 SqlConstants.init(D...
public String transform() throws ScanException { StringBuilder stringBuilder = new StringBuilder(); compileNode(node, stringBuilder, new Stack<Node>()); return stringBuilder.toString(); }
@Test public void LOGBACK729() throws ScanException { String input = "${${k0}.jdbc.url}"; Node node = makeNode(input); NodeToStringTransformer nodeToStringTransformer = new NodeToStringTransformer(node, propertyContainer0); assertEquals("http://..", nodeToStringTransformer.transform()); }