diff options
author | Henning Baldersheim <balder@yahoo-inc.com> | 2021-12-19 14:53:12 +0100 |
---|---|---|
committer | Henning Baldersheim <balder@yahoo-inc.com> | 2021-12-19 14:53:12 +0100 |
commit | 13a4da6277ac96d88b88d53075b91d9d0035f7cf (patch) | |
tree | 683550356630610f6c639ab8486ea1a67115a326 /config-application-package/src/test/java/com/yahoo/config | |
parent | 87ed9372267b3e73714b6f0130b86eb29d3e23d7 (diff) |
Simplify testing by sticking to assertEquals/True/False
Diffstat (limited to 'config-application-package/src/test/java/com/yahoo/config')
-rw-r--r-- | config-application-package/src/test/java/com/yahoo/config/model/application/provider/FilesApplicationPackageTest.java | 15 |
1 files changed, 7 insertions, 8 deletions
diff --git a/config-application-package/src/test/java/com/yahoo/config/model/application/provider/FilesApplicationPackageTest.java b/config-application-package/src/test/java/com/yahoo/config/model/application/provider/FilesApplicationPackageTest.java index 2a70799ab3d..ec68ed73864 100644 --- a/config-application-package/src/test/java/com/yahoo/config/model/application/provider/FilesApplicationPackageTest.java +++ b/config-application-package/src/test/java/com/yahoo/config/model/application/provider/FilesApplicationPackageTest.java @@ -9,7 +9,6 @@ import com.yahoo.config.provision.Zone; import com.yahoo.io.IOUtils; import org.junit.Rule; import org.junit.Test; -import org.junit.rules.ExpectedException; import org.junit.rules.TemporaryFolder; import java.io.File; @@ -17,10 +16,10 @@ import java.io.FileReader; import java.io.IOException; import java.nio.file.Files; -import static org.hamcrest.CoreMatchers.containsString; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertFalse; import static org.junit.Assert.assertTrue; +import static org.junit.Assert.fail; /** * @author Ulf Lilleengen @@ -30,9 +29,6 @@ public class FilesApplicationPackageTest { @Rule public TemporaryFolder temporaryFolder = new TemporaryFolder(); - @Rule - public ExpectedException expectedException = ExpectedException.none(); - @Test public void testPreprocessing() throws IOException { File appDir = temporaryFolder.newFolder(); @@ -112,9 +108,12 @@ public class FilesApplicationPackageTest { IOUtils.copyDirectory(new File("src/test/resources/multienvapp"), appDir); Files.delete(new File(appDir, "services.xml").toPath()); FilesApplicationPackage app = FilesApplicationPackage.fromFile(appDir); - expectedException.expect(IllegalArgumentException.class); - expectedException.expectMessage(containsString("services.xml in application package is empty")); - app.preprocess(new Zone(Environment.dev, RegionName.defaultName()), new BaseDeployLogger()); + try { + app.preprocess(new Zone(Environment.dev, RegionName.defaultName()), new BaseDeployLogger()); + fail(); + } catch (IllegalArgumentException e) { + assertTrue(e.getMessage().contains("services.xml in application package is empty")); + } } } |