focal_method
stringlengths
13
60.9k
test_case
stringlengths
25
109k
@VisibleForTesting static Row getRowConfig(ManagedConfig config, Schema transformSchema) { // May return an empty row (perhaps the underlying transform doesn't have any required // parameters) String yamlConfig = config.resolveUnderlyingConfig(); Map<String, Object> configMap = YamlUtils.yamlStringToM...
@Test public void testGetConfigRowFromYamlString() { String yamlString = "extra_string: abc\n" + "extra_integer: 123"; ManagedConfig config = ManagedConfig.builder() .setTransformIdentifier(TestSchemaTransformProvider.IDENTIFIER) .setConfig(yamlString) .build(); ...
public String getMethod(){ return method; }
@Test public void testPostRequestEncodings() throws Exception { String url = "http://localhost/matrix.html"; // A HTTP POST request, with encoding not known String contentEncoding = ""; String param1Value = "yes"; String param2Value = "0+5 -\u00c5%C3%85"; String param...
@Override public boolean execute() throws SQLException { return ExecuteTemplate.execute(this, (statement, args) -> statement.execute()); }
@Test public void testExecute() throws SQLException { preparedStatementProxy.execute(); }
public static String substringBetween(String str, String open, String close) { if (str == null || open == null || close == null) { return null; } int start = str.indexOf(open); if (start != INDEX_NOT_FOUND) { int end = str.indexOf(close, start + open.length()); ...
@Test void testSubstringBetween() { assertNull(StringUtils.substringBetween(null, "a", "b")); assertNull(StringUtils.substringBetween("a", null, "b")); assertNull(StringUtils.substringBetween("a", "b", null)); assertNull(StringUtils.substringBetween(StringUtils.EMPTY, StringUtils.EMP...
@Bean public DivideUpstreamDataHandler divideUpstreamDataHandler() { return new DivideUpstreamDataHandler(); }
@Test public void testDivideUpstreamDataHandler() { applicationContextRunner.run(context -> { DivideUpstreamDataHandler handler = context.getBean("divideUpstreamDataHandler", DivideUpstreamDataHandler.class); assertNotNull(handler); } ); }
@Override public boolean contains(final Object value) { return value instanceof Long l && contains(l.longValue()); }
@Test public void initiallyContainsNoElements() { for (int i = 0; i < 10000; i++) { assertFalse(set.contains(i)); } }
@Override public synchronized String toString() { if (parameters.isEmpty()) { return ""; } StringBuilder b = new StringBuilder(); char sep = '?'; for (String key : parameters.keySet()) { for (String value : parameters.get(key)) { b.appe...
@Test public void testEmptyConstructor() { QueryString qs = new QueryString(); Assert.assertEquals("", qs.toString()); }
@Override public GeneratedKeyInsertColumnToken generateSQLToken(final InsertStatementContext insertStatementContext) { Optional<GeneratedKeyContext> generatedKey = insertStatementContext.getGeneratedKeyContext(); Preconditions.checkState(generatedKey.isPresent()); Optional<InsertColumnsSegme...
@Test void assertGenerateSQLToken() { GeneratedKeyContext generatedKeyContext = mock(GeneratedKeyContext.class); final String testColumnName = "TEST_COLUMN_NAME"; when(generatedKeyContext.getColumnName()).thenReturn(testColumnName); InsertStatementContext insertStatementContext = moc...
public Optional<Measure> toMeasure(@Nullable ScannerReport.Measure batchMeasure, Metric metric) { Objects.requireNonNull(metric); if (batchMeasure == null) { return Optional.empty(); } Measure.NewMeasureBuilder builder = Measure.newMeasureBuilder(); switch (metric.getType().getValueType()) { ...
@Test public void toMeasure_maps_alert_properties_in_dto_for_String_Metric() { ScannerReport.Measure batchMeasure = ScannerReport.Measure.newBuilder() .setStringValue(StringValue.newBuilder().setValue(SOME_DATA)) .build(); Optional<Measure> measure = underTest.toMeasure(batchMeasure, SOME_STRING_...
protected Map<String, List<Field>> parsePkValues(TableRecords records) { return parsePkValues(records.getRows(), records.getTableMeta().getPrimaryKeyOnlyName()); }
@Test public void testParsePK() { TableMeta tableMeta = Mockito.mock(TableMeta.class); Mockito.when(tableMeta.getPrimaryKeyOnlyName()).thenReturn(Collections.singletonList("id")); Mockito.when(tableMeta.getTableName()).thenReturn("table_name"); TableRecords beforeImage = new TableRe...
public void lazyRefresh(String includesFile, String excludesFile) throws IOException { refreshInternal(includesFile, excludesFile, true); }
@Test public void testLazyRefresh() throws IOException { FileWriter efw = new FileWriter(excludesFile); FileWriter ifw = new FileWriter(includesFile); efw.write("host1\n"); efw.write("host2\n"); efw.close(); ifw.write("host3\n"); ifw.write("host4\n"); ifw.close(); HostsFileReader...
@Override public VoidOutput run(RunContext runContext) throws Exception { String renderedNamespace = runContext.render(this.namespace); String renderedKey = runContext.render(this.key); Object renderedValue = runContext.renderTyped(this.value); KVStore kvStore = runContext.namespac...
@Test void shouldSetKVGivenSameNamespace() throws Exception { // Given RunContext runContext = this.runContextFactory.of(Map.of( "flow", Map.of("namespace", "io.kestra.test"), "inputs", Map.of( "key", TEST_KEY, "value", "test-value" ...
@Subscribe public void onChatMessage(ChatMessage event) { if (event.getType() == ChatMessageType.GAMEMESSAGE || event.getType() == ChatMessageType.SPAM) { String message = Text.removeTags(event.getMessage()); Matcher dodgyCheckMatcher = DODGY_CHECK_PATTERN.matcher(message); Matcher dodgyProtectMatcher = ...
@Test public void testBloodEssenceActivate() { ChatMessage chatMessage = new ChatMessage(null, ChatMessageType.GAMEMESSAGE, "", ACTIVATE_BLOOD_ESSENCE, "", 0); itemChargePlugin.onChatMessage(chatMessage); verify(configManager).setRSProfileConfiguration(ItemChargeConfig.GROUP, ItemChargeConfig.KEY_BLOOD_ESSENCE,...
public static boolean isEstablishedAtAltitude(Track track, Instant queryTime, Duration duration) { TimeWindow window = TimeWindow.of(queryTime.minus(duration), queryTime); NavigableSet<Point> recentPoints = (NavigableSet<Point>) track.subset(window); if (recentPoints.isEmpty()) { re...
@Test public void isEstablishedAtAltitude_providesCorrectAnswer() { Track track = makeTrackFromNopData(getResourceFile("Track2.txt")); Duration fiveSeconds = Duration.ofSeconds(5); assertThat( isEstablishedAtAltitude(track, track.startTime(), fiveSeconds), is(false...
@BuildStep AdditionalBeanBuildItem produce(Capabilities capabilities, JobRunrBuildTimeConfiguration jobRunrBuildTimeConfiguration) { Set<Class<?>> additionalBeans = new HashSet<>(); additionalBeans.add(JobRunrProducer.class); additionalBeans.add(JobRunrStarter.class); additionalBeans...
@Test void jobRunrProducerUsesJSONBIfCapabilityPresent() { Mockito.reset(capabilities); lenient().when(capabilities.isPresent(Capability.JSONB)).thenReturn(true); final AdditionalBeanBuildItem additionalBeanBuildItem = jobRunrExtensionProcessor.produce(capabilities, jobRunrBuildTimeConfigura...
@ConstantFunction(name = "bitxor", argTypes = {LARGEINT, LARGEINT}, returnType = LARGEINT) public static ConstantOperator bitxorLargeInt(ConstantOperator first, ConstantOperator second) { return ConstantOperator.createLargeInt(first.getLargeInt().xor(second.getLargeInt())); }
@Test public void bitxorLargeInt() { assertEquals("0", ScalarOperatorFunctions.bitxorLargeInt(O_LI_100, O_LI_100).getLargeInt().toString()); }
@Override public String builder(final String paramName, final ServerWebExchange exchange) { return HostAddressUtils.acquireIp(exchange); }
@Test public void testBuilderWithNullParamName() { assertEquals(testHost, ipParameterData.builder(null, exchange)); }
@Override public String toString() { return this.toJSONString(0); }
@Test public void setEntryTest() { final HashMap<String, String> of = MapUtil.of("test", "testValue"); final Set<Map.Entry<String, String>> entries = of.entrySet(); final Map.Entry<String, String> next = entries.iterator().next(); final JSONObject jsonObject = JSONUtil.parseObj(next); assertEquals("{\"test\...
protected boolean isLoggerSafe(ILoggingEvent event) { for (String safeLogger : SAFE_LOGGERS) { if (event.getLoggerName().startsWith(safeLogger)) { return true; } } return false; }
@Test void isLoggerSafeShouldReturnTrueWhenLoggerNameStartsWithSafeLogger() { ILoggingEvent event = mock(ILoggingEvent.class); when(event.getLoggerName()).thenReturn("org.springframework.boot.autoconfigure.example.Logger"); CRLFLogConverter converter = new CRLFLogConverter(); boolea...
@Nullable public static Result parse(String url) { return parse(url, true); }
@Test public void testParse() { GalleryPageUrlParser.Result result = GalleryPageUrlParser.parse(url, strict); if (isNull) { assertNull(result); } else { assertEquals(gid, result.gid); assertEquals(pToken, result.pToken); assertEquals(page, result.page); } }
@Override public void upgrade() { Optional<IndexSetTemplate> defaultIndexSetTemplate = indexSetDefaultTemplateService.getDefaultIndexSetTemplate(); if (defaultIndexSetTemplate.isEmpty()) { IndexSetsDefaultConfiguration legacyDefaultConfig = clusterConfigService.get(IndexSetsDefaultConfig...
@Test void testNoDefaultTemplateAndLegacyConfigExists() { mockElasticConfig(); IndexSetTemplateConfig defaultConfiguration = defaultConfigurationFactory.create(); underTest.upgrade(); verify(indexSetDefaultTemplateService).createAndSaveDefault(createTemplate(defaultConfiguration));...
@Override public boolean equals(Object o) { if (this == o) { return true; } else if (o == null || getClass() != o.getClass()) { return false; } else { SimplifiedReconciliation reconciliation = (SimplifiedReconciliation) o; return this.kind.equ...
@Test public void testEquals() { SimplifiedReconciliation r1 = new SimplifiedReconciliation("kind", "my-namespace", "my-name", "watch"); SimplifiedReconciliation r2 = new SimplifiedReconciliation("kind", "my-namespace", "my-name", "timer"); SimplifiedReconciliation r3 = new SimplifiedReconci...
boolean shouldRetry(GetQueryExecutionResponse getQueryExecutionResponse) { String stateChangeReason = getQueryExecutionResponse.queryExecution().status().stateChangeReason(); if (this.retry.contains("never")) { LOG.trace("AWS Athena start query execution detected error ({}), marked as not r...
@Test public void shouldRetryReturnsTrueForGenericInternalError() { Athena2QueryHelper helper = athena2QueryHelperWithRetry("retryable"); assertTrue(helper.shouldRetry(newGetQueryExecutionResponse(QueryExecutionState.FAILED, "GENERIC_INTERNAL_ERROR"))); }
public static boolean anyUnSet(MemoryBuffer bitmapBuffer, int baseOffset, int valueCount) { final int sizeInBytes = (valueCount + 7) / 8; // If value count is not a multiple of 8, then calculate number of used bits in the last byte final int remainder = valueCount % 8; final int sizeInBytesMinus1 = siz...
@Test public void anyUnSet() { int valueCount = 10; MemoryBuffer buffer = MemoryUtils.buffer(valueCount); int i = 0; BitUtils.set(buffer, 0, i++); BitUtils.set(buffer, 0, i++); BitUtils.set(buffer, 0, i++); BitUtils.set(buffer, 0, i++); BitUtils.set(buffer, 0, i++); BitUtils.set(bu...
public static void validateMaterializedViewPartitionColumns( SemiTransactionalHiveMetastore metastore, MetastoreContext metastoreContext, Table viewTable, MaterializedViewDefinition viewDefinition) { SchemaTableName viewName = new SchemaTableName(viewTable.get...
@Test(expectedExceptions = PrestoException.class, expectedExceptionsMessageRegExp = "Materialized view schema.table must have at least one column directly defined by a base table column.") public void testValidateMaterializedViewPartitionColumnsEmptyBaseColumnMap() { TestingSemiTransactionalHiveMetastor...
public static String escapeString(String identifier) { return "'" + identifier.replace("\\", "\\\\").replace("'", "\\'") + "'"; }
@Test public void testEscapeStringEmpty() { assertEquals("''", SingleStoreUtil.escapeString("")); }
public static byte[] toLH(int n) { byte[] b = new byte[4]; b[0] = (byte) (n & 0xff); b[1] = (byte) (n >> 8 & 0xff); b[2] = (byte) (n >> 16 & 0xff); b[3] = (byte) (n >> 24 & 0xff); return b; }
@Test public void toLHInputZeroOutput4() { // Arrange final int n = 0; // Act final byte[] actual = RegisterSlaveCommandPacket.toLH(n); // Assert result Assert.assertArrayEquals(new byte[] { (byte) 0, (byte) 0, (byte) 0, (byte) 0 }, actual); }
@Override public WriteTxnMarkersRequest.Builder buildBatchedRequest( int brokerId, Set<TopicPartition> topicPartitions ) { validateTopicPartitions(topicPartitions); WriteTxnMarkersRequestData.WritableTxnMarker marker = new WriteTxnMarkersRequestData.WritableTxnMarker() ...
@Test public void testValidBuildRequestCall() { AbortTransactionHandler handler = new AbortTransactionHandler(abortSpec, logContext); WriteTxnMarkersRequest.Builder request = handler.buildBatchedRequest(1, singleton(topicPartition)); assertEquals(1, request.data.markers().size()); W...
@Override public ConsumerBuilder<T> patternAutoDiscoveryPeriod(int periodInMinutes) { checkArgument(periodInMinutes >= 0, "periodInMinutes needs to be >= 0"); patternAutoDiscoveryPeriod(periodInMinutes, TimeUnit.MINUTES); return this; }
@Test(expectedExceptions = IllegalArgumentException.class) public void testConsumerBuilderImplWhenPatternAutoDiscoveryPeriodPeriodInMinutesIsNegative() { consumerBuilderImpl.patternAutoDiscoveryPeriod(-1); }
public static Integer jqInteger(String value, String expression) { return H2Functions.jq(value, expression, JsonNode::asInt); }
@Test public void jqInteger() { Integer jqString = H2Functions.jqInteger("{\"a\": 2147483647}", ".a"); assertThat(jqString, is(2147483647)); }
public static HazelcastInstance newHazelcastInstance(Config config) { if (config == null) { config = Config.load(); } return newHazelcastInstance( config, config.getInstanceName(), new DefaultNodeContext() ); }
@Test public void fixedNameGeneratedIfPropertyNotDefined() { Config config = new Config(); hazelcastInstance = HazelcastInstanceFactory.newHazelcastInstance(config); String name = hazelcastInstance.getName(); assertNotNull(name); assertNotContains(name, "_hzInstance_"); ...
@Override public AtomicValue<Long> compareAndSet(Long expectedValue, Long newValue) throws Exception { return new AtomicLong(value.compareAndSet(valueToBytes(expectedValue), valueToBytes(newValue))); }
@Test public void testCompareAndSet() throws Exception { final CuratorFramework client = CuratorFrameworkFactory.newClient(server.getConnectString(), new RetryOneTime(1)); client.start(); try { final AtomicBoolean doIncrement = new AtomicBoolean(false); ...
@SuppressWarnings("unchecked") @Override public void received(Channel channel, Object message) throws RemotingException { if (message instanceof MultiMessage) { MultiMessage list = (MultiMessage) message; for (Object obj : list) { try { handler...
@Test void test() throws Exception { ChannelHandler handler = Mockito.mock(ChannelHandler.class); Channel channel = Mockito.mock(Channel.class); MultiMessageHandler multiMessageHandler = new MultiMessageHandler(handler); MultiMessage multiMessage = MultiMessage.createFromArray("test...
@Override public boolean alterOffsets(Map<String, String> connectorConfig, Map<Map<String, ?>, Map<String, ?>> offsets) { for (Map.Entry<Map<String, ?>, Map<String, ?>> offsetEntry : offsets.entrySet()) { Map<String, ?> sourceOffset = offsetEntry.getValue(); if (sourceOffset == null)...
@Test public void testAlterOffsetsIncorrectOffsetKey() { MirrorCheckpointConnector connector = new MirrorCheckpointConnector(); Map<Map<String, ?>, Map<String, ?>> offsets = Collections.singletonMap( sourcePartition("consumer-app-5", "t1", 2), Collections.singletonMa...
@Override public void store(Measure newMeasure) { saveMeasure(newMeasure.inputComponent(), (DefaultMeasure<?>) newMeasure); }
@Test public void should_save_file_measure() { DefaultInputFile file = new TestInputFileBuilder("foo", "src/Foo.php") .build(); underTest.store(new DefaultMeasure() .on(file) .forMetric(CoreMetrics.NCLOC) .withValue(10)); ScannerReport.Measure m = reportReader.readComponentMeasur...
public BlockingDirectBinaryEncoder(OutputStream out) { super(out); this.buffers = new ArrayList<>(); this.stashedBuffers = new ArrayDeque<>(); this.blockItemCounts = new ArrayDeque<>(); }
@Test void blockingDirectBinaryEncoder() throws IOException, NoSuchAlgorithmException { ByteArrayOutputStream baos = new ByteArrayOutputStream(); BinaryEncoder encoder = EncoderFactory.get().blockingDirectBinaryEncoder(baos, null); // This is needed because there is no BlockingDirectBinaryEncoder // ...
@SuppressWarnings("DataFlowIssue") public static CommandExecutor newInstance(final MySQLCommandPacketType commandPacketType, final CommandPacket commandPacket, final ConnectionSession connectionSession) throws SQLException { if (commandPacket instanceof SQLReceivedPacket) { log.debug("Execute pa...
@Test void assertNewInstanceWithComQuit() throws SQLException { assertThat(MySQLCommandExecutorFactory.newInstance(MySQLCommandPacketType.COM_QUIT, mock(CommandPacket.class), connectionSession), instanceOf(MySQLComQuitExecutor.class)); }
public static String[] splitSafeQuote(String input, char separator) { return splitSafeQuote(input, separator, true, false); }
@Test public void testSplitBeanParametersTrim() throws Exception { String[] arr = StringQuoteHelper.splitSafeQuote("String.class ${body}, String.class Mars", ',', true, true); Assertions.assertEquals(2, arr.length); Assertions.assertEquals("String.class ${body}", arr[0]); Assertions....
@Override public Optional<DatabaseAdminExecutor> create(final SQLStatementContext sqlStatementContext) { SQLStatement sqlStatement = sqlStatementContext.getSqlStatement(); if (sqlStatement instanceof ShowFunctionStatusStatement) { return Optional.of(new ShowFunctionStatusExecutor((ShowFu...
@Test void assertCreateWithSelectStatementForTransactionReadOnly() { initProxyContext(Collections.emptyMap()); MySQLSelectStatement selectStatement = mock(MySQLSelectStatement.class); when(selectStatement.getFrom()).thenReturn(Optional.empty()); ProjectionsSegment projectionsSegment ...
public ForComputation forComputation(String computation) { return new ForComputation(computation); }
@Test public void testMultipleKeys() throws Exception { TestStateTag tag = new TestStateTag("tag1"); WindmillStateCache.ForKeyAndFamily keyCache1 = cache .forComputation("comp1") .forKey(computationKey("comp1", "key1", SHARDING_KEY), 0L, 0L) .forFamily(STATE_FAMILY...
public static List<KiePMMLFieldOperatorValue> getConstraintEntriesFromXOrCompoundPredicate(final CompoundPredicate compoundPredicate, final Map<String, KiePMMLOriginalTypeGeneratedType> fieldTypeMap) { if (!CompoundPredicate.BooleanOperator.XOR.equals(compoundPredicate.getBooleanOperator())) { throw...
@Test void getConstraintEntriesFromXOrCompoundPredicate() { CompoundPredicate compoundPredicate = new CompoundPredicate(); compoundPredicate.setBooleanOperator(CompoundPredicate.BooleanOperator.XOR); List<Predicate> predicates = IntStream.range(0, 2).mapToObj(index -> simpleP...
@Override public ModelMBean assemble(Object obj, ObjectName name) throws JMException { ModelMBeanInfo mbi = null; // use the default provided mbean which has been annotated with JMX annotations LOGGER.trace("Assembling MBeanInfo for: {} from @ManagedResource object: {}", name, obj); ...
@Test public void testHappyPath() throws MalformedObjectNameException, JMException { TestMbean testMbean = new TestMbean(); ModelMBean mbean = defaultManagementMBeanAssembler.assemble(testMbean, new ObjectName("org.flowable.jmx.Mbeans:type=something")); assertThat(mbean).isNotNull(); ...
@VisibleForTesting String buildBody(Stream stream, AlertCondition.CheckResult checkResult, List<Message> backlog) { final String template; if (pluginConfig == null || pluginConfig.getString("body") == null) { template = bodyTemplate; } else { template = pluginConfig.g...
@Test public void defaultBodyTemplateDoesNotShowBacklogIfBacklogIsEmpty() throws Exception { FormattedEmailAlertSender emailAlertSender = new FormattedEmailAlertSender(new EmailConfiguration(), mockNotificationService, nodeId, templateEngine, emailFactory); Stream stream = mock(Stream.class); ...
@Override public InputStream getInputStream(final int columnIndex, final String type) throws SQLException { return mergedResult.getInputStream(columnIndex, type); }
@Test void assertGetInputStream() throws SQLException { InputStream inputStream = mock(InputStream.class); when(mergedResult.getInputStream(1, "asc")).thenReturn(inputStream); assertThat(new MaskMergedResult(mock(MaskRule.class), mock(SelectStatementContext.class), mergedResult).getInputStre...
public void clear() { for (int i = 0; i < sections.length; i++) { sections[i].clear(); } }
@Test public void testClear() { ConcurrentLongHashMap<String> map = ConcurrentLongHashMap.<String>newBuilder() .expectedItems(2) .concurrencyLevel(1) .autoShrink(true) .mapIdleFactor(0.25f) .build(); assertTrue(map.capac...
@Override public void initialize(String name, Map<String, String> properties) { String uri = properties.get(CatalogProperties.URI); Preconditions.checkArgument(null != uri, "JDBC connection URI is required"); try { // We'll ensure the expected JDBC driver implementation class is initialized through ...
@Test public void testInitializeNullClient() { assertThatExceptionOfType(IllegalArgumentException.class) .isThrownBy( () -> catalog.initialize(TEST_CATALOG_NAME, null, fakeFileIOFactory, properties)) .withMessageContaining("snowflakeClient must be non-null"); }
@Nullable @Override public byte[] chunk(@NonNull final byte[] message, @IntRange(from = 0) final int index, @IntRange(from = 20) final int maxLength) { final int offset = index * maxLength; final int length = Math.min(maxLength, message.length - offset); if (length <= 0) return null; final by...
@Test public void chunk_end() { final int MTU = 23; final DefaultMtuSplitter splitter = new DefaultMtuSplitter(); final byte[] result = splitter.chunk(text.getBytes(), 200, MTU - 3); assertNull(result); }
@Override public Map<String, Optional<HivePartitionDataInfo>> getPartitionDataInfos() { Map<String, Optional<HivePartitionDataInfo>> partitionDataInfos = Maps.newHashMap(); List<String> partitionNameToFetch = partitionNames; if (partitionLimit >= 0 && partitionLimit < partitionNames.size()) ...
@Test public void testGetPartitionDataInfos(@Mocked MetadataMgr metadataMgr) { List<RemoteFileInfo> remoteFileInfos = createRemoteFileInfos(4); new Expectations() { { GlobalStateMgr.getCurrentState().getMetadataMgr(); result = metadataMgr; ...
public void writeProcessInformations(List<ProcessInformations> processInformations) throws IOException { try { document.open(); addParagraph(getString("Processus"), "processes.png"); new PdfProcessInformationsReport(processInformations, document).toPdf(); } catch (final DocumentException e) { throw c...
@Test public void testWriteProcessInformations() throws IOException { final ByteArrayOutputStream output = new ByteArrayOutputStream(); PdfOtherReport pdfOtherReport = new PdfOtherReport(TEST_APP, output); pdfOtherReport.writeProcessInformations(ProcessInformations.buildProcessInformations( getClass().getRe...
@Override public boolean isSatisfied(int index, TradingRecord tradingRecord) { ZonedDateTime dateTime = timeIndicator.getValue(index); LocalTime localTime = dateTime.toLocalTime(); final boolean satisfied = timeRanges.stream() .anyMatch( timeRange -> !...
@Test public void isSatisfiedForBuy() { final DateTimeFormatter dtf = DateTimeFormatter.ISO_ZONED_DATE_TIME; DateTimeIndicator dateTimeIndicator = new DateTimeIndicator( new MockBarSeries(numFunction, new double[] { 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100 }, ...
public void setFilePaths(String... filePaths) { Path[] paths = new Path[filePaths.length]; for (int i = 0; i < paths.length; i++) { paths[i] = new Path(filePaths[i]); } setFilePaths(paths); }
@Test void testMultiPathSetOnSinglePathIF2() { final DummyFileInputFormat format = new DummyFileInputFormat(); final String myPath = "/an/imaginary/path"; final String myPath2 = "/an/imaginary/path2"; // format.setFilePaths(new Path(myPath), new Path(myPath2)); assertThatThr...
public OffsetRange[] getNextOffsetRanges(Option<String> lastCheckpointStr, long sourceLimit, HoodieIngestionMetrics metrics) { // Come up with final set of OffsetRanges to read (account for new partitions, limit number of events) long maxEventsToReadFromKafka = getLongWithAltKeys(props, KafkaSourceConfig.MAX_EV...
@Test public void testGetNextOffsetRangesFromSingleOffsetCheckpointNotApplicable() { testUtils.createTopic(testTopicName, 2); KafkaOffsetGen kafkaOffsetGen = new KafkaOffsetGen(getConsumerConfigs("latest", KAFKA_CHECKPOINT_TYPE_SINGLE_OFFSET)); // incorrect number of partitions => exception (number of pa...
public static <T> AsSingleton<T> asSingleton() { return new AsSingleton<>(); }
@Test @Category(ValidatesRunner.class) public void testDiscardingNonSingletonSideInput() throws Exception { PCollection<Integer> oneTwoThree = pipeline.apply(Create.of(1, 2, 3)); final PCollectionView<Integer> view = oneTwoThree .apply(Window.<Integer>configure().discardingFiredPanes())...
public Flux<TopicMessageEventDTO> loadMessages(KafkaCluster cluster, String topic, ConsumerPosition consumerPosition, @Nullable String query, MessageFilterTypeDTO filterQuer...
@Test void loadMessagesReturnsExceptionWhenTopicNotFound() { StepVerifier.create(messagesService .loadMessages(cluster, NON_EXISTING_TOPIC, null, null, null, 1, null, "String", "String")) .expectError(TopicNotFoundException.class) .verify(); }
public boolean ifHasZero(int... nums) { LOGGER.info("Arithmetic check zero {}", VERSION); return !source.ifNonZero(nums); }
@Test void testIfHasZero() { assertTrue(arithmetic.ifHasZero(-1, 0, 1)); }
public byte[] getNextTag() { byte[] tagBytes = null; if (tagPool != null) { tagBytes = tagPool.pollFirst(); } if (tagBytes == null) { long tag = nextTagId++; int size = encodingSize(tag); tagBytes = new byte[size]; for (int ...
@Test public void testTagValueMatchesParsedArray() throws IOException { AmqpTransferTagGenerator tagGen = new AmqpTransferTagGenerator(false); for (int i = 0; i < Short.MAX_VALUE; ++i) { byte[] tag = tagGen.getNextTag(); ByteArrayInputStream bais = new ByteArrayInputStream(...
@Override public long getMin() { if (values.length == 0) { return 0; } return values[0]; }
@Test public void calculatesAMinOfZeroForAnEmptySnapshot() throws Exception { final Snapshot emptySnapshot = new UniformSnapshot(new long[]{ }); assertThat(emptySnapshot.getMin()) .isZero(); }
public List<PluginRoleConfig> getPluginRoleConfigs() { return filterRolesBy(PluginRoleConfig.class); }
@Test public void getPluginRoleConfigsShouldReturnOnlyPluginRoles() { Role admin = new RoleConfig(new CaseInsensitiveString("admin")); Role view = new RoleConfig(new CaseInsensitiveString("view")); Role blackbird = new PluginRoleConfig("blackbird", "foo"); Role spacetiger = new Plugi...
@InvokeOnHeader(Web3jConstants.ETH_SEND_TRANSACTION) void ethSendTransaction(Message message) throws IOException { String fromAddress = message.getHeader(Web3jConstants.FROM_ADDRESS, configuration::getFromAddress, String.class); String toAddress = message.getHeader(Web3jConstants.TO_ADDRESS, configu...
@Test public void ethSendTransactionTest() throws Exception { EthSendTransaction response = Mockito.mock(EthSendTransaction.class); Mockito.when(mockWeb3j.ethSendTransaction(any())).thenReturn(request); Mockito.when(request.send()).thenReturn(response); Mockito.when(response.getTrans...
public Object evaluate(final ProcessingDTO processingDTO, final List<Object> paramValues) { final List<KiePMMLNameValue> kiePMMLNameValues = new ArrayList<>(); if (parameterFields != null) { if (paramValues == null || paramValues.size() < parameterFields.size()) { ...
@Test void evaluateEmptyParamValues() { assertThatExceptionOfType(IllegalArgumentException.class).isThrownBy(() -> { final KiePMMLParameterField parameterField1 = KiePMMLParameterField.builder(PARAM_1, Collections.emptyList ()).build(); final KiePMMLParameterField...
public static boolean equal(Comparable lhs, Comparable rhs) { assert lhs != null; if (rhs == null) { return false; } if (lhs.getClass() == rhs.getClass()) { return lhs.equals(rhs); } if (lhs instanceof Number lhsNumber && rhs instanceof Number r...
@Test public void testEqual() { assertFalse(equal(1, null)); assertFalse(equal(1, 2)); assertFalse(equal(1, 1.1)); assertFalse(equal("foo", "bar")); assertFalse(equal("foo", 1)); assertFalse(equal(1.0, "foo")); assertFalse(equal(1.0, "1.0")); assertTr...
public StepExpression createExpression(StepDefinition stepDefinition) { List<ParameterInfo> parameterInfos = stepDefinition.parameterInfos(); if (parameterInfos.isEmpty()) { return createExpression( stepDefinition.getPattern(), stepDefinitionDoesNotTakeAnyPar...
@Test void creates_a_step_expression() { StepDefinition stepDefinition = new StubStepDefinition("Given a step"); StepExpression expression = stepExpressionFactory.createExpression(stepDefinition); assertThat(expression.getSource(), is("Given a step")); assertThat(expression.getExpres...
public static <T> AsIterable<T> asIterable() { return new AsIterable<>(); }
@Test @Category(ValidatesRunner.class) public void testIterableSideInputIsImmutable() { final PCollectionView<Iterable<Integer>> view = pipeline.apply("CreateSideInput", Create.of(11)).apply(View.asIterable()); PCollection<Integer> output = pipeline .apply("CreateMainInput", Cr...
@Override public List<String> choices() { if (commandLine.getArguments() == null) { return Collections.emptyList(); } List<String> argList = Lists.newArrayList(); String argOne = null; if (argList.size() > 1) { argOne = argList.get(1); } ...
@Test public void testCommandCompleter() { VplsCommandCompleter commandCompleter = new VplsCommandCompleter(); List<String> choices = commandCompleter.choices(); List<String> expected = VplsCommandEnum.toStringList(); assertEquals(expected, choices); }
public String format(Date then) { if (then == null) then = now(); Duration d = approximateDuration(then); return format(d); }
@Test public void testMonthsAgo() throws Exception { PrettyTime t = new PrettyTime(now); Assert.assertEquals("3 months ago", t.format(now.minusMonths(3))); }
public Optional<Measure> toMeasure(@Nullable ScannerReport.Measure batchMeasure, Metric metric) { Objects.requireNonNull(metric); if (batchMeasure == null) { return Optional.empty(); } Measure.NewMeasureBuilder builder = Measure.newMeasureBuilder(); switch (metric.getType().getValueType()) { ...
@Test public void toMeasure_returns_no_value_if_dto_has_no_value_for_String_Metric() { Optional<Measure> measure = underTest.toMeasure(EMPTY_BATCH_MEASURE, SOME_STRING_METRIC); assertThat(measure).isPresent(); assertThat(measure.get().getValueType()).isEqualTo(Measure.ValueType.NO_VALUE); }
@Override public synchronized void connect() throws AlluxioStatusException { if (mConnected) { return; } disconnect(); Preconditions.checkState(!mClosed, "Client is closed, will not try to connect."); IOException lastConnectFailure = null; RetryPolicy retryPolicy = mRetryPolicySupplier....
@Test public void connectFailToDetermineMasterAddress() throws Exception { alluxio.Client client = new BaseTestClient() { @Override public synchronized InetSocketAddress getRemoteSockAddress() throws UnavailableException { throw new UnavailableException("Failed to determine master address"); ...
@Override public TListMaterializedViewStatusResult listMaterializedViewStatus(TGetTablesParams params) throws TException { LOG.debug("get list table request: {}", params); PatternMatcher matcher = null; boolean caseSensitive = CaseSensibility.TABLE.getCaseSensibility(); if (params.i...
@Test public void testGetSpecialColumnForSyncMv() throws Exception { starRocksAssert.withDatabase("test_table").useDatabase("test_table") .withTable("CREATE TABLE `base1` (\n" + "event_day DATE,\n" + "department_id int(11) NOT NULL COMMENT \"\"...
public static <T> Map<String, T> translateDeprecatedConfigs(Map<String, T> configs, String[][] aliasGroups) { return translateDeprecatedConfigs(configs, Stream.of(aliasGroups) .collect(Collectors.toMap(x -> x[0], x -> Stream.of(x).skip(1).collect(Collectors.toList())))); }
@Test public void testAllowNullOverride() { Map<String, String> config = new HashMap<>(); config.put("foo.bar.deprecated", "baz"); config.put("foo.bar", null); Map<String, String> newConfig = ConfigUtils.translateDeprecatedConfigs(config, new String[][]{ {"foo.bar", "foo....
@Override public void setRampDownPercent(long rampDownPercent) { Validate.isTrue((rampDownPercent >= 0) && (rampDownPercent < 100), "rampDownPercent must be a value between 0 and 99"); this.rampDownPercent = rampDownPercent; }
@Test(expected = IllegalArgumentException.class) public void testSetRampDownPercent_lessThan0() { sampler.setRampDownPercent(-1); }
@Override public void writeChar(final int v) throws IOException { ensureAvailable(CHAR_SIZE_IN_BYTES); MEM.putChar(buffer, ARRAY_BYTE_BASE_OFFSET + pos, (char) v); pos += CHAR_SIZE_IN_BYTES; }
@Test public void testWriteCharForPositionV() throws Exception { char expected = 100; out.writeChar(2, expected); char actual = Bits.readChar(out.buffer, 2, ByteOrder.nativeOrder() == ByteOrder.BIG_ENDIAN); assertEquals(expected, actual); }
@Udf public Long trunc(@UdfParameter final Long val) { return val; }
@Test public void shouldHandleNullValues() { assertThat(udf.trunc((Integer) null), is((Long) null)); assertThat(udf.trunc((Long) null), is((Long) null)); assertThat(udf.trunc((Double) null), is((Long) null)); assertThat(udf.trunc((Double) null), is((Long) null)); assertThat(udf.trunc((BigDecimal) ...
@Override public Float convert(String source) { return isNotEmpty(source) ? valueOf(source) : null; }
@Test void testConvert() { assertEquals(Float.valueOf("1.0"), converter.convert("1.0")); assertNull(converter.convert(null)); assertThrows(NumberFormatException.class, () -> { converter.convert("ttt"); }); }
public static Writer createWriter(Configuration conf, Writer.Option... opts ) throws IOException { Writer.CompressionOption compressionOption = Options.getOption(Writer.CompressionOption.class, opts); CompressionType kind; if (compressionOption != null) { kin...
@Test public void testSerializationAvailability() throws IOException { Configuration conf = new Configuration(); Path path = new Path(GenericTestUtils.getTempPath( "serializationAvailability")); // Check if any serializers aren't found. try { SequenceFile.createWriter( conf, ...
public KeltnerChannelMiddleIndicator(BarSeries series, int barCountEMA) { this(new TypicalPriceIndicator(series), barCountEMA); }
@Test public void keltnerChannelMiddleIndicatorTest() { KeltnerChannelMiddleIndicator km = new KeltnerChannelMiddleIndicator(new ClosePriceIndicator(data), 14); assertNumEquals(11764.23, km.getValue(13)); assertNumEquals(11793.0687, km.getValue(14)); assertNumEquals(11817.6182, km.g...
protected void clearGroup(ReceiptHandleGroupKey key) { if (key == null) { return; } ProxyConfig proxyConfig = ConfigurationManager.getProxyConfig(); ReceiptHandleGroup handleGroup = receiptHandleGroupMap.remove(key); if (handleGroup == null) { return; ...
@Test public void testClearGroup() { Channel channel = PROXY_CONTEXT.getVal(ContextVariable.CHANNEL); receiptHandleManager.addReceiptHandle(PROXY_CONTEXT, channel, GROUP, MSG_ID, messageReceiptHandle); receiptHandleManager.clearGroup(new ReceiptHandleGroupKey(channel, GROUP)); Subscr...
@Override public void deleteDiyPage(Long id) { // 校验存在 validateDiyPageExists(id); // 删除 diyPageMapper.deleteById(id); }
@Test public void testDeleteDiyPage_success() { // mock 数据 DiyPageDO dbDiyPage = randomPojo(DiyPageDO.class); diyPageMapper.insert(dbDiyPage);// @Sql: 先插入出一条存在的数据 // 准备参数 Long id = dbDiyPage.getId(); // 调用 diyPageService.deleteDiyPage(id); // 校验数据不存在了...
@Override public List<Type> getColumnTypes() { return columnTypes; }
@Test public void testGetColumnTypes() { RecordSet recordSet = new ExampleRecordSet(new ExampleSplit("test", "schema", "table", dataUri), ImmutableList.of( new ExampleColumnHandle("test", "text", createUnboundedVarcharType(), 0), new ExampleColumnHandle("test", "value", B...
@Override public GetDataStream getDataStream() { return windmillStreamFactory.createGetDataStream( dispatcherClient.getWindmillServiceStub(), throttleTimers.getDataThrottleTimer()); }
@Test public void testStreamingGetDataHeartbeatsAsHeartbeatRequests() throws Exception { // This server records the heartbeats observed but doesn't respond. final List<ComputationHeartbeatRequest> receivedHeartbeats = new ArrayList<>(); serviceRegistry.addService( new CloudWindmillServiceV1Alpha1...
public String getDatabase() { return database; }
@Test public void testGetDefaultSessionDatabase() { UserProperty userProperty = new UserProperty(); String defaultSessionDatabase = userProperty.getDatabase(); Assert.assertEquals("", defaultSessionDatabase); }
@Override protected double maintain() { if ( ! nodeRepository().nodes().isWorking()) return 0.0; // Don't need to maintain spare capacity in dynamically provisioned zones; can provision more on demand. if (nodeRepository().zone().cloud().dynamicProvisioning()) return 1.0; NodeList ...
@Test public void testTwoSpares() { var tester = new SpareCapacityMaintainerTester(); tester.addHosts(3, new NodeResources(10, 100, 1000, 1)); tester.addNodes(0, 1, new NodeResources(10, 100, 1000, 1), 0); tester.maintainer.maintain(); assertEquals(0, tester.deployer.activati...
@Override public void write(AvroKey<T> record, NullWritable ignore) throws IOException { mAvroFileWriter.append(record.datum()); }
@Test void write() throws IOException { Schema writerSchema = Schema.create(Schema.Type.INT); GenericData dataModel = new ReflectData(); CodecFactory compressionCodec = CodecFactory.nullCodec(); ByteArrayOutputStream outputStream = new ByteArrayOutputStream(); TaskAttemptContext context = mock(Tas...
@Override public void updatePod(Pod pod) { checkNotNull(pod, ERR_NULL_POD); checkArgument(!Strings.isNullOrEmpty(pod.getMetadata().getUid()), ERR_NULL_POD_UID); k8sPodStore.updatePod(pod); log.info(String.format(MSG_POD, pod.getMetadata().getName(), MSG_UPDATED)); ...
@Test(expected = IllegalArgumentException.class) public void testUpdateUnregisteredPod() { target.updatePod(POD); }
@Override public SmsTemplateRespDTO getSmsTemplate(String apiTemplateId) throws Throwable { // 1. 构建请求 // 参考链接 https://cloud.tencent.com/document/product/382/52067 TreeMap<String, Object> body = new TreeMap<>(); body.put("International", INTERNATIONAL_CHINA); body.put("Templa...
@Test public void testGetSmsTemplate() throws Throwable { try (MockedStatic<HttpUtils> httpUtilsMockedStatic = mockStatic(HttpUtils.class)) { // 准备参数 String apiTemplateId = "1122"; // mock 方法 httpUtilsMockedStatic.when(() -> HttpUtils.post(anyString(), anyMap...
@Override public Result invoke(Invocation invocation) throws RpcException { if (invocation instanceof RpcInvocation) { ((RpcInvocation) invocation).setInvoker(this); } String mock = getUrl().getMethodParameter(invocation.getMethodName(), MOCK_KEY); if (StringUtils.isBlan...
@Test void testInvokeThrowsRpcException3() { URL url = URL.valueOf("remote://1.2.3.4/" + String.class.getName()); url = url.addParameter(MOCK_KEY, "throw"); MockInvoker mockInvoker = new MockInvoker(url, String.class); RpcInvocation invocation = new RpcInvocation(); invocati...
public double getNormalizedEditDistance(String source, String target) { ImmutableList<String> sourceTerms = NamingConventions.splitToLowercaseTerms(source); ImmutableList<String> targetTerms = NamingConventions.splitToLowercaseTerms(target); // costMatrix[s][t] is the edit distance between source term s a...
@Test public void getNormalizedEditDistance_returnsMatch_withPermutedTerms() { TermEditDistance termEditDistance = new TermEditDistance(); String sourceIdentifier = "fooBarBaz"; String targetIdentifier = "bazFooBar"; double distance = termEditDistance.getNormalizedEditDistance(sourceIdentifie...
@Override public synchronized void putTargetState(String connector, TargetState state) { ConnectorState connectorState = connectors.get(connector); if (connectorState == null) throw new IllegalArgumentException("No connector `" + connector + "` configured"); TargetState prevStat...
@Test public void testPutTargetState() { // Can't write target state for non-existent connector assertThrows(IllegalArgumentException.class, () -> configStore.putTargetState(CONNECTOR_IDS.get(0), TargetState.PAUSED)); configStore.putConnectorConfig(CONNECTOR_IDS.get(0), SAMPLE_CONFIGS.get(0...
public Future<KafkaCluster> prepareKafkaCluster( Kafka kafkaCr, List<KafkaNodePool> nodePools, Map<String, Storage> oldStorage, Map<String, List<String>> currentPods, KafkaVersionChange versionChange, KafkaStatus kafkaStatus, boolean tr...
@Test public void testExistingClusterWithMixedNodesKRaft(VertxTestContext context) { ResourceOperatorSupplier supplier = ResourceUtils.supplierWithMocks(false); KafkaStatus kafkaStatus = new KafkaStatus(); KafkaClusterCreator creator = new KafkaClusterCreator(vertx, RECONCILIATION, CO_CONFI...
@SafeVarargs public static <K, V> Map<K, V> ofEntries(Map.Entry<K, V>... entries) { final Map<K, V> map = new HashMap<>(); for (Map.Entry<K, V> pair : entries) { map.put(pair.getKey(), pair.getValue()); } return map; }
@Test public void ofEntriesTest(){ final Map<String, Integer> map = MapUtil.ofEntries(MapUtil.entry("a", 1), MapUtil.entry("b", 2)); assertEquals(2, map.size()); assertEquals(Integer.valueOf(1), map.get("a")); assertEquals(Integer.valueOf(2), map.get("b")); }
@Override public void isNotEqualTo(@Nullable Object expected) { super.isNotEqualTo(expected); }
@Test public void isNotEqualTo_WithoutToleranceParameter_Success_Longer() { assertThat(array(2.2d, 3.3d)).isNotEqualTo(array(2.2d, 3.3d, 4.4d)); }
public static String quantityToRSDecimalStack(int quantity) { return quantityToRSDecimalStack(quantity, false); }
@Test public void quantityToRSDecimalStackSize() { assertEquals("0", QuantityFormatter.quantityToRSDecimalStack(0)); assertEquals("8500", QuantityFormatter.quantityToRSDecimalStack(8_500)); assertEquals("10K", QuantityFormatter.quantityToRSDecimalStack(10_000)); assertEquals("21.7K", QuantityFormatter.quantit...
public RemotingCommand viewMessageById(ChannelHandlerContext ctx, RemotingCommand request) throws RemotingCommandException { final RemotingCommand response = RemotingCommand.createResponseCommand(null); final ViewMessageRequestHeader requestHeader = (ViewMessageRequestHeader) request...
@Test public void testViewMessageById() throws RemotingCommandException { ViewMessageRequestHeader viewMessageRequestHeader = new ViewMessageRequestHeader(); viewMessageRequestHeader.setTopic("topic"); viewMessageRequestHeader.setOffset(0L); RemotingCommand request = RemotingCommand....
@Override public void write(final Path file, final Distribution distribution, final LoginCallback prompt) throws BackgroundException { final Path container = containerService.getContainer(file); try { String suffix = "index.html"; if(StringUtils.isNotBlank(distribution.getInd...
@Test public void testWrite() throws Exception { final DistributionConfiguration configuration = new GoogleStorageWebsiteDistributionConfiguration(session); final Path bucket = new Path(new AsciiRandomStringService().random().toLowerCase(Locale.ROOT), EnumSet.of(Path.Type.directory, Path.Type.volume...
public void createIndex(DBObject keys, DBObject options) { delegate.createIndex(new BasicDBObject(keys.toMap()), toIndexOptions(options)); }
@Test void createIndex() { final var collection = jacksonCollection("simple", Simple.class); collection.createIndex(new BasicDBObject("name", 1)); collection.createIndex(new BasicDBObject("_id", 1).append("name", 1)); assertThat(mongoCollection("simple").listIndexes()).containsExactl...
@Override public KTable<Windowed<K>, V> aggregate(final Initializer<V> initializer, final Merger<? super K, V> sessionMerger) { return aggregate(initializer, sessionMerger, Materialized.with(null, null)); }
@Test public void sessionWindowAggregateTest() { final KTable<Windowed<String>, String> customers = groupedStream.cogroup(MockAggregator.TOSTRING_ADDER) .windowedBy(SessionWindows.with(ofMillis(500))) .aggregate(MockInitializer.STRING_INIT, sessionMerger, Materialized.with(Se...
@Override public Optional<RedirectionAction> getRedirectionAction(final CallContext ctx) { val webContext = ctx.webContext(); var computeLoginUrl = configuration.computeFinalLoginUrl(webContext); val computedCallbackUrl = client.computeFinalCallbackUrl(webContext); val renew = conf...
@Test public void testRedirect() { val builder = newBuilder(new CasConfiguration()); val action = builder.getRedirectionAction(new CallContext(MockWebContext.create(), new MockSessionStore())).get(); assertTrue(action instanceof FoundAction); assertEquals(LOGIN_URL + "?service=http%3...
public String geomap() { return get(GEOMAP, null); }
@Test(expected = InvalidFieldException.class) public void cantSetGeoIfSpritesAreSet() { cfg = cfgFromJson(tmpNode(SPRITES)); cfg.geomap("map-name"); }
public static @Nullable Duration fromCloudDuration(String duration) { Matcher matcher = DURATION_PATTERN.matcher(duration); if (!matcher.matches()) { return null; } long millis = Long.parseLong(matcher.group(1)) * 1000; String frac = matcher.group(2); if (frac != null) { long fracs =...
@Test public void fromCloudDurationShouldParseDurationStrings() { assertEquals(Duration.millis(4000), fromCloudDuration("4s")); assertEquals(Duration.millis(4001), fromCloudDuration("4.001s")); assertEquals(Duration.millis(4001), fromCloudDuration("4.001000s")); assertEquals(Duration.millis(4001), fro...
@Override public boolean betterThan(Num criterionValue1, Num criterionValue2) { return criterionValue1.isGreaterThan(criterionValue2); }
@Test public void betterThan() { AnalysisCriterion criterion = getCriterion(true); assertTrue(criterion.betterThan(numOf(2.0), numOf(1.5))); assertFalse(criterion.betterThan(numOf(1.5), numOf(2.0))); }
public static SqlDecimal toSqlDecimal(final SqlType type) { switch (type.baseType()) { case DECIMAL: return (SqlDecimal) type; case INTEGER: return SqlTypes.INT_UPCAST_TO_DECIMAL; case BIGINT: return SqlTypes.BIGINT_UPCAST_TO_DECIMAL; default: throw new KsqlException( "C...
@Test public void shouldConvertLongToSqlDecimal() { // When: final SqlDecimal decimal = DecimalUtil.toSqlDecimal(SqlTypes.BIGINT); // Then: assertThat(decimal, is(SqlTypes.decimal(19, 0))); }