谁能告诉我如何使用断言抛出几个异常?
\n\n例如,这是一个类:
\n\n protected void checkViolation(Set<ConstraintViolation<EcritureComptable>> vViolations) throws FunctionalException {\n if (!vViolations.isEmpty()) {\n throw new FunctionalException("L\'\xc3\xa9criture comptable ne respecte pas les r\xc3\xa8gles de gestion.",\n new ConstraintViolationException(\n "L\'\xc3\xa9criture comptable ne respecte pas les contraintes de validation",\n vViolations));\n }\n}\nRun Code Online (Sandbox Code Playgroud)\n\n和我的测试方法:
\n\n @Test\nvoid checkViolation(){\n comptabiliteManager = spy(ComptabiliteManagerImpl.class);\n when(vViolations.isEmpty()).thenReturn(false);\n\n assertThrows( ConstraintViolationException.class, () ->comptabiliteManager.checkViolation(vViolations), "a string should be provided!");\n}\nRun Code Online (Sandbox Code Playgroud)\n\n我想匹配该方法并完全抛出ConstraintViolationException和FunctionException
\n\n任何想法?
\n\n谢谢
\n看来我们目前无法将无穷大作为区间。
在尝试时:
SELECT 'infinity'::interval;`
我们得到
SQL Error [22007]: ERROR: invalid input syntax for type interval: "infinity"
Run Code Online (Sandbox Code Playgroud)
如何指定间隔的最大值?
我尝试比较 2 个无限时间戳
SELECT ('-infinity'::timestamp + '1 day'::INTERVAL)::timestamp without time zone at time zone 'UTC'
- 'infinity'::timestamp without time zone at time zone 'UTC';
Run Code Online (Sandbox Code Playgroud)
但现在得到
SQL Error [22008]: ERROR: cannot subtract infinite timestamps
Run Code Online (Sandbox Code Playgroud)
任何想法?
我想分析一个日志文件。它有几个操作,每个操作包含一组子操作。我想提取按操作分组的子操作数。这在 sql 中很容易,但我在 bash 中陷入困境。
这是该文件的简化版本:
[21:30:21.538Z #a9a.012 DEBUG - - ] c.h.c.w.j.JobTrackingWorkerReporter: Reporting bulk completion: Partition: tenant-xla; Job: ingestion-4759-9-13-41; Tasks: [ingestion-4759-9-13-41.1.43, ingestion-4759-9-13-41.1.44, ingestion-4759-9-13-41.1.41]
otherlogs stuff ...
[21:31:21.538Z #a9a.012 DEBUG - - ] c.h.c.w.j.JobTrackingWorkerReporter: Reporting bulk completion: Partition: tenant-xla; Job: ingestion-4757-10-17-4; Tasks: [ingestion-4757-10-17-4.1.2, ingestion-4757-10-17-4.1.1, ingestion-4757-10-17-4.1.3, ingestion-4757-10-17-4.1.4]
otherlogs stuff ...
[21:31:21.690Z #a9a.012 DEBUG - - ] c.h.c.w.j.JobTrackingWorkerReporter: Reporting bulk completion: Partition: tenant-xla; Job: ingestion-4757-10-18-3; Tasks: [ingestion-4757-10-18-3.1.137, ingestion-4757-10-18-3.1.139, ingestion-4757-10-18-3.1.138, ingestion-4757-10-18-3.1.140, ingestion-4757-10-18-3.1.136, ingestion-4757-10-18-3.1.141]
Run Code Online (Sandbox Code Playgroud)
每个操作都是点之前的部分,其余部分属于任何子操作。
我正在寻找类似以下的结果,例如,我可以将其存储在文件中:
operationName suboperationCount
ingestion-4757-10-18-3 3
ingestion-4757-10-18-4 4
ingestion-4757-10-18-3 6 …Run Code Online (Sandbox Code Playgroud)