Use AssertJ’s exception assertions rather than fail
Closes gh-15761
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2012-2017 the original author or authors.
|
||||
* Copyright 2012-2019 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -27,7 +27,7 @@ import org.springframework.boot.cli.command.grab.GrabCommand;
|
||||
import org.springframework.util.FileSystemUtils;
|
||||
|
||||
import static org.assertj.core.api.Assertions.assertThat;
|
||||
import static org.junit.Assert.fail;
|
||||
import static org.assertj.core.api.Assertions.assertThatExceptionOfType;
|
||||
|
||||
/**
|
||||
* Integration tests for {@link GrabCommand}
|
||||
@@ -64,14 +64,10 @@ public class GrabCommandIntegrationTests {
|
||||
|
||||
@Test
|
||||
public void duplicateDependencyManagementBomAnnotationsProducesAnError() {
|
||||
try {
|
||||
this.cli.grab("duplicateDependencyManagementBom.groovy");
|
||||
fail();
|
||||
}
|
||||
catch (Exception ex) {
|
||||
assertThat(ex.getMessage())
|
||||
.contains("Duplicate @DependencyManagementBom annotation");
|
||||
}
|
||||
assertThatExceptionOfType(Exception.class)
|
||||
.isThrownBy(
|
||||
() -> this.cli.grab("duplicateDependencyManagementBom.groovy"))
|
||||
.withMessageContaining("Duplicate @DependencyManagementBom annotation");
|
||||
}
|
||||
|
||||
@Test
|
||||
|
||||
Reference in New Issue
Block a user