最近,我们将Weld升级到3.0.3.Final(与Wildfly 12中的版本一起使用)。现在,weld-junit5 1.3.1.Final(最新版本)会引发异常
java.lang.NoSuchMethodError: javax.enterprise.inject.spi.AfterBeanDiscovery.addBean()Ljavax/enterprise/inject/spi/configurator/BeanConfigurator;
我们在依赖关系管理中添加了weld-se-core:
<dependencyManagement>
<dependencies>
<dependency>
<groupId>org.jboss.weld.se</groupId>
<artifactId>weld-se-core</artifactId>
<version>3.0.3.Final</version>
<scope>test</scope>
</dependency>
</dependencies>
</dependencyManagement>
这否决了默认的weld-se-core 2.4.8.Final版本,该版本在weld-junit5中定义。但是似乎焊接junit5取决于焊接2.x的结构
weld-junit5在其github页面上指出了焊接3的支持,但没有描述如何使用它。我在weld-junit5的POM中发现了这一点:
<profile>
<id>weld3</id>
<activation>
<activeByDefault>false</activeByDefault>
<property>
<name>env.WELD_JUNIT_PROFILE</name>
<value>weld3</value>
</property>
</activation>
<dependencies>
<dependency>
<groupId>org.jboss.weld.module</groupId>
<artifactId>weld-ejb</artifactId>
<version>${version.weld}</version>
<scope>test</scope>
</dependency>
</dependencies>
</profile>
但是我没有激活此配置文件。
如何解决?
答案 0 :(得分:0)
使用Mockito.when(myHelper.getDataAsList("test1", true).thenReturn(new ArrayList<>(Arrays.asList("Age")));
代替SELECT * FROM ints;
+---+
| i |
+---+
| 0 |
| 1 |
| 2 |
| 3 |
| 4 |
| 5 |
| 6 |
| 7 |
| 8 |
| 9 |
+---+
SELECT * FROM bad_schema;
+------+--------+----------------+
| name | number | hobby |
+------+--------+----------------+
| Alex | 2, 3 | Game, Shopping |
+------+--------+----------------+
CREATE TABLE better_schema AS
SELECT DISTINCT name
, SUBSTRING_INDEX(SUBSTRING_INDEX(number,',',i+1),',',-1) + 0 number
, TRIM(SUBSTRING_INDEX(SUBSTRING_INDEX(hobby,',',i+1),',',-1)) hobby
FROM bad_schema
, ints;
SELECT * FROM better_schema;
+------+--------+----------+
| name | number | hobby |
+------+--------+----------+
| Alex | 2 | Game |
| Alex | 3 | Shopping |
+------+--------+----------+
可以工作。