diff options
author | Harald Musum <musum@yahoo-inc.com> | 2017-06-09 12:33:27 +0200 |
---|---|---|
committer | Harald Musum <musum@yahoo-inc.com> | 2017-06-09 12:33:27 +0200 |
commit | 2edba3d455d44a08b4ad0483f0aa31e1aa5747f3 (patch) | |
tree | 5fd1abcb0eb0309f6d8a27d6405af8b55839348a /config | |
parent | 89b7b95346eacff1dfedf03828de888043dfd940 (diff) |
Rewrite test so that it works even when running as root
Diffstat (limited to 'config')
-rw-r--r-- | config/src/test/java/com/yahoo/config/subscription/impl/FileConfigSubscriptionTest.java | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/config/src/test/java/com/yahoo/config/subscription/impl/FileConfigSubscriptionTest.java b/config/src/test/java/com/yahoo/config/subscription/impl/FileConfigSubscriptionTest.java index ce9323f0ec7..850c875cae4 100644 --- a/config/src/test/java/com/yahoo/config/subscription/impl/FileConfigSubscriptionTest.java +++ b/config/src/test/java/com/yahoo/config/subscription/impl/FileConfigSubscriptionTest.java @@ -1,7 +1,6 @@ // Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. package com.yahoo.config.subscription.impl; -import com.yahoo.config.ConfigurationRuntimeException; import com.yahoo.foo.SimpletypesConfig; import com.yahoo.foo.TestReferenceConfig; import com.yahoo.config.subscription.ConfigSubscriber; @@ -15,6 +14,7 @@ import org.junit.Test; import java.io.File; import java.io.FileWriter; import java.io.IOException; +import java.nio.file.Files; import static org.hamcrest.CoreMatchers.is; import static org.junit.Assert.assertFalse; @@ -89,7 +89,7 @@ public class FileConfigSubscriptionTest { assertThat(sub.config.configId(), is(cfgId)); } - @Test(expected = ConfigurationRuntimeException.class) + @Test(expected = IllegalArgumentException.class) public void require_that_bad_file_throws_exception() throws IOException { // A little trick to ensure that we can create the subscriber, but that we get an error when reading. writeConfig("intval", "23"); @@ -99,7 +99,7 @@ public class FileConfigSubscriptionTest { subscriber, TEST_TYPES_FILE); sub.reload(1); - assertTrue(TEST_TYPES_FILE.setReadable(false)); + Files.delete(TEST_TYPES_FILE.toPath()); // delete file so the below statement throws exception sub.nextConfig(0); } } |