我在使用JUnit执行统一测试时遇到问题。该应用程序由Spring Boot和具有JDK 8版本的Java组成。当我运行测试时,它显示错误“使用JUnit启动测试时加载ApplicationContext时出错”
package com.dev.loyaltyservice.loyalty.transaction.unit;
import com.dev.loyaltyservice.loyalty.transaction.domain.ActivityType;
import com.dev.loyaltyservice.loyalty.transaction.infrastructure.dataproviders.bus.ActivityIdentificationSelector;
import com.dev.loyaltyservice.loyalty.transaction.infrastructure.dataproviders.bus.response.OriginInfo;
import org.junit.Assert;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.test.context.junit4.SpringRunner;
import java.math.BigDecimal;
@RunWith(SpringRunner.class)
@SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT)
public class ActivityIdentifierTest {
private static final String identificationCustom1 = "123124";
private static final String identificationCustom2 = "AABBCC00";
private static final BigDecimal total = new BigDecimal(1);
private static final BigDecimal totalRefunds = new BigDecimal(-1);
@Test
public void it_should_return_custom1_value_when_is_refund_tpv() {
String activityIdentifierCustom1 = "123124";
OriginInfo.Activity activity = new OriginInfo.Activity(
"",
totalRefunds, "", 0, 0, 0, 0, activityIdentifierCustom1, null);
String actualIdentification = ActivityIdentificationSelector.getIdentificationFrom(ActivityType.REFUND_TPV, activity);
Assert.assertEquals(identificationCustom1, actualIdentification);
}
@Test
public void it_should_return_custom2_value_when_is_refund_web() {
String activityIdentifierCustom1 = "1231241";
String activityIdentifierCustom2 = "AABBCC00";
OriginInfo.Activity activity = new OriginInfo.Activity(
"",
totalRefunds, "", 0, 0, 0, 0, activityIdentifierCustom1, activityIdentifierCustom2);
String actualIdentification = ActivityIdentificationSelector.getIdentificationFrom(ActivityType.REFUND_WEB, activity);
Assert.assertEquals(identificationCustom2, actualIdentification);
}
}
向我显示的错误如下:执行测试时发生错误??有人知道发生了什么吗?
非常感谢您,