我无法运行我的测试,因为测试在此语句中出现红色波浪形错误行,decorator.decorate(new EncoderColumnDecorator())要求我使用 try/catch 或添加 throws。这是错误信息。

当我已经有一个“预期”属性时,为什么我必须放置 try/catch 或 throws 异常
我的单元测试:
@Test(expected=DecoratorException.class)
public void testDecorate_exception() {
decorator.decorate(new EncoderColumnDecorator()); -----Error in this line
}
Run Code Online (Sandbox Code Playgroud)
测试方法
@Override
public String decorate(Object arg0) throws DecoratorException {
try{
//some code
}
}catch(Exception e){
throw new DecoratorException();
}
return arg0;
}
}
Run Code Online (Sandbox Code Playgroud) 我有 2 个链接,如下所示。当我第一次点击任何一个时,它会导航到它,但是当我之后点击第二个链接时,url 会更改,但它不会导航到它。
<li><a routerLink="/order/buyer" >Buyer</a></li>
<li><a routerLink="/order/seller">Seller</a></li>
Run Code Online (Sandbox Code Playgroud)
这些是我的路由配置:
app.routing.module.ts
const routes: Routes = [
{
path: '',
pathMatch: 'full',
component: RootComponent,
},
{
path: '',
children: [
{
path: 'order',
loadChildren: './order/order.module#OrderModule',
}
]
}
Run Code Online (Sandbox Code Playgroud)
订单.module.ts
export const ROUTES: Routes = [
{
path: ':orderParty/:id',
component: OrderDetailComponent,
canDeactivate: [OrderDetailGuardService]
},
{
path: ':orderParty',
component: OrderListComponent
}
];
Run Code Online (Sandbox Code Playgroud)
尝试了几件事,在那里,但没有奏效。我注意到的是在第二次点击时,'OrderListComponent' 的 ngOnInit() 没有被调用。
javascript single-page-application angular-ui-router angular
我需要创建一个java.util.EnumerationFruit对象,以便在测试期间将其传递给此方法.这是遗留代码,我无法更改方法签名.
public void get(Enumeration<Fruit> fruits){}
Run Code Online (Sandbox Code Playgroud)
我的水果班:
public class Fruit{
String name;
//getters and setters
}
Run Code Online (Sandbox Code Playgroud)
如何创建Enumeration of Fruit对象?
我有 3 个 javax.persistence.EntityManagerFactory 的 bean。
@Bean
public LocalContainerEntityManagerFactoryBean entityManagerFactory() {
//Make this the default bean
}
Run Code Online (Sandbox Code Playgroud)
这是我得到的例外。
No qualifying bean of type 'javax.persistence.EntityManagerFactory' available: expected single matching bean but found 3
Run Code Online (Sandbox Code Playgroud)
当有多个相同类型的 bean 时,如何使上述 bean 成为默认 bean?
java ×3
angular ×1
enumeration ×1
exception ×1
hibernate ×1
javascript ×1
jpa ×1
junit ×1
junit4 ×1
legacy ×1
spring ×1
unit-testing ×1