diff options
author | janakr <janakr@google.com> | 2017-10-12 03:42:37 +0200 |
---|---|---|
committer | Marcel Hlopko <hlopko@google.com> | 2017-10-12 10:17:14 +0200 |
commit | 8601d4a357f8c1618fb6a8144ea93736f24d973a (patch) | |
tree | 4804047242e1013cb300dc4d594ac05faa31154b /src/test/java/com/google/devtools/build/lib/unix/ProcMeminfoParserTest.java | |
parent | 3c9ef6e814f5028817a3fc77d016edeee06d3642 (diff) |
Throw a checked exception if there's an error reading /proc/meminfo, and handle it properly.
PiperOrigin-RevId: 171906091
Diffstat (limited to 'src/test/java/com/google/devtools/build/lib/unix/ProcMeminfoParserTest.java')
-rw-r--r-- | src/test/java/com/google/devtools/build/lib/unix/ProcMeminfoParserTest.java | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/src/test/java/com/google/devtools/build/lib/unix/ProcMeminfoParserTest.java b/src/test/java/com/google/devtools/build/lib/unix/ProcMeminfoParserTest.java index d597d10e3e..244a32b401 100644 --- a/src/test/java/com/google/devtools/build/lib/unix/ProcMeminfoParserTest.java +++ b/src/test/java/com/google/devtools/build/lib/unix/ProcMeminfoParserTest.java @@ -16,7 +16,6 @@ package com.google.devtools.build.lib.unix; import static com.google.common.truth.Truth.assertThat; import static com.google.devtools.build.lib.testutil.MoreAsserts.assertThrows; - import com.google.devtools.build.lib.util.StringUtilities; import com.google.devtools.build.lib.vfs.util.FsApparatus; import java.io.IOException; @@ -33,7 +32,7 @@ public class ProcMeminfoParserTest { private FsApparatus scratch = FsApparatus.newNative(); @Test - public void memInfo() throws IOException { + public void memInfo() throws IOException, ProcMeminfoParser.KeywordNotFoundException { String meminfoContent = StringUtilities.joinLines( "MemTotal: 3091732 kB", "MemFree: 2167344 kB", @@ -77,9 +76,9 @@ public class ProcMeminfoParserTest { assertThat(memInfo.getFreeRamKb()).isEqualTo(14717640); assertThat(memInfo.getRamKb("Cached")).isEqualTo(509940); assertThat(memInfo.getTotalKb()).isEqualTo(3091732); - assertThrows(IllegalArgumentException.class, + assertThrows(ProcMeminfoParser.KeywordNotFoundException.class, () -> memInfo.getRamKb("Bogus")); - assertThrows(IllegalArgumentException.class, + assertThrows(ProcMeminfoParser.KeywordNotFoundException.class, () -> memInfo.getRamKb("Bogus2")); } } |