diff options
author | kak <kak@google.com> | 2014-08-04 11:15:09 -0700 |
---|---|---|
committer | Colin Decker <cgdecker@google.com> | 2014-11-05 17:09:46 -0500 |
commit | d63729b61e7575a89d6939f547e795957960e678 (patch) | |
tree | 71e9443fed7ce50cf4aa2fdb812e8cc5954b6429 /jimfs/src/test/java | |
parent | 8172c31fd43806d5908fd152d98a44cdd6576669 (diff) | |
download | jimfs-d63729b61e7575a89d6939f547e795957960e678.tar.gz |
Migrate from Truth.ASSERT to Truth.assert_ or Truth.assertThat.
-------------
Created by MOE: http://code.google.com/p/moe-java
MOE_MIGRATED_REVID=72563991
Diffstat (limited to 'jimfs/src/test/java')
28 files changed, 764 insertions, 763 deletions
diff --git a/jimfs/src/test/java/com/google/common/jimfs/AbstractAttributeProviderTest.java b/jimfs/src/test/java/com/google/common/jimfs/AbstractAttributeProviderTest.java index 684a276..ab68ab4 100644 --- a/jimfs/src/test/java/com/google/common/jimfs/AbstractAttributeProviderTest.java +++ b/jimfs/src/test/java/com/google/common/jimfs/AbstractAttributeProviderTest.java @@ -16,7 +16,7 @@ package com.google.common.jimfs; -import static com.google.common.truth.Truth.ASSERT; +import static com.google.common.truth.Truth.assertThat; import static org.junit.Assert.fail; import com.google.common.collect.ImmutableMap; @@ -93,7 +93,7 @@ public abstract class AbstractAttributeProviderTest<P extends AttributeProvider> protected void assertSupportsAll(String... attributes) { for (String attribute : attributes) { - ASSERT.that(provider.supports(attribute)).isTrue(); + assertThat(provider.supports(attribute)).isTrue(); } } @@ -103,7 +103,7 @@ public abstract class AbstractAttributeProviderTest<P extends AttributeProvider> String attribute = entry.getKey(); Object value = entry.getValue(); - ASSERT.that(provider.get(file, attribute)).isEqualTo(value); + assertThat(provider.get(file, attribute)).isEqualTo(value); } } @@ -117,7 +117,7 @@ public abstract class AbstractAttributeProviderTest<P extends AttributeProvider> protected void assertSetAndGetSucceeds(String attribute, Object value, boolean create) { provider.set(file, provider.name(), attribute, value, create); - ASSERT.that(provider.get(file, attribute)).isEqualTo(value); + assertThat(provider.get(file, attribute)).isEqualTo(value); } @SuppressWarnings("EmptyCatchBlock") diff --git a/jimfs/src/test/java/com/google/common/jimfs/AbstractJimfsIntegrationTest.java b/jimfs/src/test/java/com/google/common/jimfs/AbstractJimfsIntegrationTest.java index 1a9f5e9..8778ccb 100644 --- a/jimfs/src/test/java/com/google/common/jimfs/AbstractJimfsIntegrationTest.java +++ b/jimfs/src/test/java/com/google/common/jimfs/AbstractJimfsIntegrationTest.java @@ -17,7 +17,7 @@ package com.google.common.jimfs; import static com.google.common.jimfs.PathSubject.paths; -import static com.google.common.truth.Truth.ASSERT; +import static com.google.common.truth.Truth.assert_; import org.junit.After; import org.junit.Before; @@ -67,7 +67,7 @@ public abstract class AbstractJimfsIntegrationTest { } protected static PathSubject assertThat(Path path, LinkOption... options) { - PathSubject subject = ASSERT.about(paths()).that(path); + PathSubject subject = assert_().about(paths()).that(path); if (options.length != 0) { subject = subject.noFollowLinks(); } @@ -98,24 +98,24 @@ public abstract class AbstractJimfsIntegrationTest { public void assertAccessTimeChanged() throws IOException { FileTime t = attrs().lastAccessTime(); - ASSERT.that(t).isNotEqualTo(accessTime); + assert_().that(t).isNotEqualTo(accessTime); accessTime = t; } public void assertAccessTimeDidNotChange() throws IOException { FileTime t = attrs().lastAccessTime(); - ASSERT.that(t).isEqualTo(accessTime); + assert_().that(t).isEqualTo(accessTime); } public void assertModifiedTimeChanged() throws IOException { FileTime t = attrs().lastModifiedTime(); - ASSERT.that(t).isNotEqualTo(modifiedTime); + assert_().that(t).isNotEqualTo(modifiedTime); modifiedTime = t; } public void assertModifiedTimeDidNotChange() throws IOException { FileTime t = attrs().lastModifiedTime(); - ASSERT.that(t).isEqualTo(modifiedTime); + assert_().that(t).isEqualTo(modifiedTime); } } } diff --git a/jimfs/src/test/java/com/google/common/jimfs/AbstractWatchServiceTest.java b/jimfs/src/test/java/com/google/common/jimfs/AbstractWatchServiceTest.java index bae0e47..0362ac7 100644 --- a/jimfs/src/test/java/com/google/common/jimfs/AbstractWatchServiceTest.java +++ b/jimfs/src/test/java/com/google/common/jimfs/AbstractWatchServiceTest.java @@ -18,7 +18,7 @@ package com.google.common.jimfs; import static com.google.common.jimfs.AbstractWatchService.Key.State.READY; import static com.google.common.jimfs.AbstractWatchService.Key.State.SIGNALLED; -import static com.google.common.truth.Truth.ASSERT; +import static com.google.common.truth.Truth.assertThat; import static java.nio.file.StandardWatchEventKinds.ENTRY_CREATE; import static java.nio.file.StandardWatchEventKinds.ENTRY_DELETE; import static java.nio.file.StandardWatchEventKinds.ENTRY_MODIFY; @@ -61,23 +61,23 @@ public class AbstractWatchServiceTest { @Test public void testNewWatcher() throws IOException { - ASSERT.that(watcher.isOpen()).isTrue(); - ASSERT.that(watcher.poll()).isNull(); - ASSERT.that(watcher.queuedKeys()).isEmpty(); + assertThat(watcher.isOpen()).isTrue(); + assertThat(watcher.poll()).isNull(); + assertThat(watcher.queuedKeys()).isEmpty(); watcher.close(); - ASSERT.that(watcher.isOpen()).isFalse(); + assertThat(watcher.isOpen()).isFalse(); } @Test public void testRegister() throws IOException { Watchable watchable = new StubWatchable(); AbstractWatchService.Key key = watcher.register(watchable, ImmutableSet.of(ENTRY_CREATE)); - ASSERT.that(key.isValid()).isTrue(); - ASSERT.that(key.pollEvents()).isEmpty(); - ASSERT.that(key.subscribesTo(ENTRY_CREATE)).isTrue(); - ASSERT.that(key.subscribesTo(ENTRY_DELETE)).isFalse(); - ASSERT.that(key.watchable()).isEqualTo(watchable); - ASSERT.that(key.state()).isEqualTo(READY); + assertThat(key.isValid()).isTrue(); + assertThat(key.pollEvents()).isEmpty(); + assertThat(key.subscribesTo(ENTRY_CREATE)).isTrue(); + assertThat(key.subscribesTo(ENTRY_DELETE)).isFalse(); + assertThat(key.watchable()).isEqualTo(watchable); + assertThat(key.state()).isEqualTo(READY); } @Test @@ -90,17 +90,17 @@ public class AbstractWatchServiceTest { key.post(event); key.signal(); - ASSERT.that(watcher.queuedKeys()).has().exactly(key); + assertThat(watcher.queuedKeys()).has().exactly(key); WatchKey retrievedKey = watcher.poll(); - ASSERT.that(retrievedKey).isEqualTo(key); + assertThat(retrievedKey).isEqualTo(key); List<WatchEvent<?>> events = retrievedKey.pollEvents(); - ASSERT.that(events.size()).is(1); - ASSERT.that(events.get(0)).isEqualTo(event); + assertThat(events.size()).is(1); + assertThat(events.get(0)).isEqualTo(event); // polling should have removed all events - ASSERT.that(retrievedKey.pollEvents()).isEmpty(); + assertThat(retrievedKey.pollEvents()).isEmpty(); } @Test @@ -110,36 +110,36 @@ public class AbstractWatchServiceTest { AbstractWatchService.Event<Path> event = new AbstractWatchService.Event<>(ENTRY_CREATE, 1, null); - ASSERT.that(key.state()).isEqualTo(READY); + assertThat(key.state()).isEqualTo(READY); key.post(event); key.signal(); - ASSERT.that(key.state()).isEqualTo(SIGNALLED); + assertThat(key.state()).isEqualTo(SIGNALLED); AbstractWatchService.Event<Path> event2 = new AbstractWatchService.Event<>(ENTRY_CREATE, 1, null); key.post(event2); - ASSERT.that(key.state()).isEqualTo(SIGNALLED); + assertThat(key.state()).isEqualTo(SIGNALLED); // key was not queued twice - ASSERT.that(watcher.queuedKeys()).has().exactly(key); - ASSERT.that(watcher.poll().pollEvents()).has().exactly(event, event2); + assertThat(watcher.queuedKeys()).has().exactly(key); + assertThat(watcher.poll().pollEvents()).has().exactly(event, event2); - ASSERT.that(watcher.poll()).isNull(); + assertThat(watcher.poll()).isNull(); key.post(event); // still not added to queue; already signalled - ASSERT.that(watcher.poll()).isNull(); - ASSERT.that(key.pollEvents()).has().exactly(event); + assertThat(watcher.poll()).isNull(); + assertThat(key.pollEvents()).has().exactly(event); key.reset(); - ASSERT.that(key.state()).isEqualTo(READY); + assertThat(key.state()).isEqualTo(READY); key.post(event2); key.signal(); // now that it's reset it can be requeued - ASSERT.that(watcher.poll()).isEqualTo(key); + assertThat(watcher.poll()).isEqualTo(key); } @Test @@ -150,16 +150,16 @@ public class AbstractWatchServiceTest { key.signal(); key = (AbstractWatchService.Key) watcher.poll(); - ASSERT.that(watcher.queuedKeys()).isEmpty(); + assertThat(watcher.queuedKeys()).isEmpty(); - ASSERT.that(key.pollEvents().size()).is(1); + assertThat(key.pollEvents().size()).is(1); key.post(new AbstractWatchService.Event<>(ENTRY_CREATE, 1, null)); - ASSERT.that(watcher.queuedKeys()).isEmpty(); + assertThat(watcher.queuedKeys()).isEmpty(); key.reset(); - ASSERT.that(key.state()).isEqualTo(SIGNALLED); - ASSERT.that(watcher.queuedKeys().size()).is(1); + assertThat(key.state()).isEqualTo(SIGNALLED); + assertThat(watcher.queuedKeys().size()).is(1); } @Test @@ -173,14 +173,14 @@ public class AbstractWatchServiceTest { List<WatchEvent<?>> events = key.pollEvents(); - ASSERT.that(events.size()).is(AbstractWatchService.Key.MAX_QUEUE_SIZE + 1); + assertThat(events.size()).is(AbstractWatchService.Key.MAX_QUEUE_SIZE + 1); for (int i = 0; i < AbstractWatchService.Key.MAX_QUEUE_SIZE; i++) { - ASSERT.that(events.get(i).kind()).isEqualTo(ENTRY_CREATE); + assertThat(events.get(i).kind()).isEqualTo(ENTRY_CREATE); } WatchEvent<?> lastEvent = events.get(AbstractWatchService.Key.MAX_QUEUE_SIZE); - ASSERT.that(lastEvent.kind()).isEqualTo(OVERFLOW); - ASSERT.that(lastEvent.count()).is(10); + assertThat(lastEvent.kind()).isEqualTo(OVERFLOW); + assertThat(lastEvent.count()).is(10); } @Test @@ -189,7 +189,7 @@ public class AbstractWatchServiceTest { new StubWatchable(), ImmutableSet.of(ENTRY_CREATE)); key.signal(); key.cancel(); - ASSERT.that(key.reset()).isFalse(); + assertThat(key.reset()).isFalse(); } @Test @@ -199,15 +199,15 @@ public class AbstractWatchServiceTest { AbstractWatchService.Key key2 = watcher.register( new StubWatchable(), ImmutableSet.of(ENTRY_MODIFY)); - ASSERT.that(key1.isValid()).isTrue(); - ASSERT.that(key2.isValid()).isTrue(); + assertThat(key1.isValid()).isTrue(); + assertThat(key2.isValid()).isTrue(); watcher.close(); - ASSERT.that(key1.isValid()).isFalse(); - ASSERT.that(key2.isValid()).isFalse(); - ASSERT.that(key1.reset()).isFalse(); - ASSERT.that(key2.reset()).isFalse(); + assertThat(key1.isValid()).isFalse(); + assertThat(key2.isValid()).isFalse(); + assertThat(key1.reset()).isFalse(); + assertThat(key2.reset()).isFalse(); try { watcher.poll(); diff --git a/jimfs/src/test/java/com/google/common/jimfs/AclAttributeProviderTest.java b/jimfs/src/test/java/com/google/common/jimfs/AclAttributeProviderTest.java index e39d2dc..f675c52 100644 --- a/jimfs/src/test/java/com/google/common/jimfs/AclAttributeProviderTest.java +++ b/jimfs/src/test/java/com/google/common/jimfs/AclAttributeProviderTest.java @@ -17,7 +17,7 @@ package com.google.common.jimfs; import static com.google.common.jimfs.UserLookupService.createUserPrincipal; -import static com.google.common.truth.Truth.ASSERT; +import static com.google.common.truth.Truth.assertThat; import static java.nio.file.attribute.AclEntryFlag.DIRECTORY_INHERIT; import static java.nio.file.attribute.AclEntryPermission.APPEND_DATA; import static java.nio.file.attribute.AclEntryPermission.DELETE; @@ -83,7 +83,7 @@ public class AclAttributeProviderTest extends AbstractAttributeProviderTest<AclA @Test public void testInitialAttributes() { - ASSERT.that(provider.get(file, "acl")).isEqualTo(defaultAcl); + assertThat(provider.get(file, "acl")).isEqualTo(defaultAcl); } @Test @@ -101,16 +101,16 @@ public class AclAttributeProviderTest extends AbstractAttributeProviderTest<AclA "owner", new OwnerAttributeProvider().view(fileLookup(), NO_INHERITED_VIEWS))); assertNotNull(view); - ASSERT.that(view.name()).isEqualTo("acl"); + assertThat(view.name()).isEqualTo("acl"); - ASSERT.that(view.getAcl()).isEqualTo(defaultAcl); + assertThat(view.getAcl()).isEqualTo(defaultAcl); view.setAcl(ImmutableList.<AclEntry>of()); view.setOwner(FOO); - ASSERT.that(view.getAcl()).isEqualTo(ImmutableList.<AclEntry>of()); - ASSERT.that(view.getOwner()).isEqualTo(FOO); + assertThat(view.getAcl()).isEqualTo(ImmutableList.<AclEntry>of()); + assertThat(view.getOwner()).isEqualTo(FOO); - ASSERT.that(file.getAttribute("acl", "acl")).isEqualTo(ImmutableList.<AclEntry>of()); + assertThat(file.getAttribute("acl", "acl")).isEqualTo(ImmutableList.<AclEntry>of()); } } diff --git a/jimfs/src/test/java/com/google/common/jimfs/AttributeServiceTest.java b/jimfs/src/test/java/com/google/common/jimfs/AttributeServiceTest.java index 3f5c115..c6b8d43 100644 --- a/jimfs/src/test/java/com/google/common/jimfs/AttributeServiceTest.java +++ b/jimfs/src/test/java/com/google/common/jimfs/AttributeServiceTest.java @@ -16,7 +16,7 @@ package com.google.common.jimfs; -import static com.google.common.truth.Truth.ASSERT; +import static com.google.common.truth.Truth.assertThat; import static org.junit.Assert.fail; import com.google.common.collect.ImmutableMap; @@ -56,15 +56,15 @@ public class AttributeServiceTest { @Test public void testSupportedFileAttributeViews() { - ASSERT.that(service.supportedFileAttributeViews()).isEqualTo( + assertThat(service.supportedFileAttributeViews()).isEqualTo( ImmutableSet.of("basic", "test", "owner")); } @Test public void testSupportsFileAttributeView() { - ASSERT.that(service.supportsFileAttributeView(BasicFileAttributeView.class)).isTrue(); - ASSERT.that(service.supportsFileAttributeView(TestAttributeView.class)).isTrue(); - ASSERT.that(service.supportsFileAttributeView(PosixFileAttributeView.class)).isFalse(); + assertThat(service.supportsFileAttributeView(BasicFileAttributeView.class)).isTrue(); + assertThat(service.supportsFileAttributeView(TestAttributeView.class)).isTrue(); + assertThat(service.supportsFileAttributeView(PosixFileAttributeView.class)).isFalse(); } @Test @@ -72,12 +72,12 @@ public class AttributeServiceTest { File file = Directory.create(0); service.setInitialAttributes(file); - ASSERT.that(file.getAttributeNames("test")).has().exactly("bar", "baz"); - ASSERT.that(file.getAttributeNames("owner")).has().exactly("owner"); + assertThat(file.getAttributeNames("test")).has().exactly("bar", "baz"); + assertThat(file.getAttributeNames("owner")).has().exactly("owner"); - ASSERT.that(service.getAttribute(file, "basic:lastModifiedTime")).isA(FileTime.class); - ASSERT.that(file.getAttribute("test", "bar")).isEqualTo(0L); - ASSERT.that(file.getAttribute("test", "baz")).isEqualTo(1); + assertThat(service.getAttribute(file, "basic:lastModifiedTime")).isA(FileTime.class); + assertThat(file.getAttribute("test", "bar")).isEqualTo(0L); + assertThat(file.getAttribute("test", "baz")).isEqualTo(1); } @Test @@ -85,19 +85,19 @@ public class AttributeServiceTest { File file = Directory.create(0); service.setInitialAttributes(file); - ASSERT.that(service.getAttribute(file, "test:foo")).isEqualTo("hello"); - ASSERT.that(service.getAttribute(file, "test", "foo")).isEqualTo("hello"); - ASSERT.that(service.getAttribute(file, "basic:isRegularFile")).isEqualTo(false); - ASSERT.that(service.getAttribute(file, "isDirectory")).isEqualTo(true); - ASSERT.that(service.getAttribute(file, "test:baz")).isEqualTo(1); + assertThat(service.getAttribute(file, "test:foo")).isEqualTo("hello"); + assertThat(service.getAttribute(file, "test", "foo")).isEqualTo("hello"); + assertThat(service.getAttribute(file, "basic:isRegularFile")).isEqualTo(false); + assertThat(service.getAttribute(file, "isDirectory")).isEqualTo(true); + assertThat(service.getAttribute(file, "test:baz")).isEqualTo(1); } @Test public void testGetAttribute_fromInheritedProvider() { File file = Directory.create(0); - ASSERT.that(service.getAttribute(file, "test:isRegularFile")).isEqualTo(false); - ASSERT.that(service.getAttribute(file, "test:isDirectory")).isEqualTo(true); - ASSERT.that(service.getAttribute(file, "test", "fileKey")).isEqualTo(0); + assertThat(service.getAttribute(file, "test:isRegularFile")).isEqualTo(false); + assertThat(service.getAttribute(file, "test:isDirectory")).isEqualTo(true); + assertThat(service.getAttribute(file, "test", "fileKey")).isEqualTo(0); } @Test @@ -121,18 +121,18 @@ public class AttributeServiceTest { public void testSetAttribute() { File file = Directory.create(0); service.setAttribute(file, "test:bar", 10L, false); - ASSERT.that(file.getAttribute("test", "bar")).isEqualTo(10L); + assertThat(file.getAttribute("test", "bar")).isEqualTo(10L); service.setAttribute(file, "test:baz", 100, false); - ASSERT.that(file.getAttribute("test", "baz")).isEqualTo(100); + assertThat(file.getAttribute("test", "baz")).isEqualTo(100); } @Test public void testSetAttribute_forInheritedProvider() { File file = Directory.create(0); service.setAttribute(file, "test:lastModifiedTime", FileTime.fromMillis(0), false); - ASSERT.that(file.getAttribute("test", "lastModifiedTime")).isNull(); - ASSERT.that(service.getAttribute(file, "basic:lastModifiedTime")).isEqualTo( + assertThat(file.getAttribute("test", "lastModifiedTime")).isNull(); + assertThat(service.getAttribute(file, "basic:lastModifiedTime")).isEqualTo( FileTime.fromMillis(0)); } @@ -140,17 +140,17 @@ public class AttributeServiceTest { public void testSetAttribute_withAlternateAcceptedType() { File file = Directory.create(0); service.setAttribute(file, "test:bar", 10F, false); - ASSERT.that(file.getAttribute("test", "bar")).isEqualTo(10L); + assertThat(file.getAttribute("test", "bar")).isEqualTo(10L); service.setAttribute(file, "test:bar", BigInteger.valueOf(123), false); - ASSERT.that(file.getAttribute("test", "bar")).isEqualTo(123L); + assertThat(file.getAttribute("test", "bar")).isEqualTo(123L); } @Test public void testSetAttribute_onCreate() { File file = Directory.create(0); service.setInitialAttributes(file, new BasicFileAttribute<>("test:baz", 123)); - ASSERT.that(file.getAttribute("test", "baz")).isEqualTo(123); + assertThat(file.getAttribute("test", "baz")).isEqualTo(123); } @Test @@ -171,7 +171,7 @@ public class AttributeServiceTest { } catch (IllegalArgumentException expected) { } - ASSERT.that(file.getAttribute("test", "baz")).isEqualTo(1); + assertThat(file.getAttribute("test", "baz")).isEqualTo(1); } @Test @@ -184,7 +184,7 @@ public class AttributeServiceTest { } catch (IllegalArgumentException expected) { } - ASSERT.that(file.getAttribute("test", "bar")).isEqualTo(0L); + assertThat(file.getAttribute("test", "bar")).isEqualTo(0L); } @Test @@ -197,7 +197,7 @@ public class AttributeServiceTest { } catch (NullPointerException expected) { } - ASSERT.that(file.getAttribute("test", "bar")).isEqualTo(0L); + assertThat(file.getAttribute("test", "bar")).isEqualTo(0L); } @Test @@ -209,7 +209,7 @@ public class AttributeServiceTest { } catch (IllegalArgumentException expected) { } - ASSERT.that(file.getAttribute("test", "foo")).isNull(); + assertThat(file.getAttribute("test", "foo")).isNull(); } @Test @@ -242,16 +242,16 @@ public class AttributeServiceTest { } }; - ASSERT.that(service.getFileAttributeView(fileLookup, TestAttributeView.class)) + assertThat(service.getFileAttributeView(fileLookup, TestAttributeView.class)) .isNotNull(); - ASSERT.that(service.getFileAttributeView(fileLookup, BasicFileAttributeView.class)) + assertThat(service.getFileAttributeView(fileLookup, BasicFileAttributeView.class)) .isNotNull(); TestAttributes attrs = service.getFileAttributeView(fileLookup, TestAttributeView.class).readAttributes(); - ASSERT.that(attrs.foo()).isEqualTo("hello"); - ASSERT.that(attrs.bar()).is(0); - ASSERT.that(attrs.baz()).is(1); + assertThat(attrs.foo()).isEqualTo("hello"); + assertThat(attrs.bar()).is(0); + assertThat(attrs.baz()).is(1); } @Test @@ -263,7 +263,7 @@ public class AttributeServiceTest { return file; } }; - ASSERT.that(service.getFileAttributeView(fileLookup, PosixFileAttributeView.class)) + assertThat(service.getFileAttributeView(fileLookup, PosixFileAttributeView.class)) .isNull(); } @@ -273,7 +273,7 @@ public class AttributeServiceTest { service.setInitialAttributes(file); ImmutableMap<String, Object> map = service.readAttributes(file, "test:foo,bar,baz"); - ASSERT.that(map).isEqualTo( + assertThat(map).isEqualTo( ImmutableMap.of( "foo", "hello", "bar", 0L, @@ -282,7 +282,7 @@ public class AttributeServiceTest { FileTime time = (FileTime) service.getAttribute(file, "basic:creationTime"); map = service.readAttributes(file, "test:*"); - ASSERT.that(map).isEqualTo( + assertThat(map).isEqualTo( ImmutableMap.<String, Object>builder() .put("foo", "hello") .put("bar", 0L) @@ -299,7 +299,7 @@ public class AttributeServiceTest { .build()); map = service.readAttributes(file, "basic:*"); - ASSERT.that(map).isEqualTo( + assertThat(map).isEqualTo( ImmutableMap.<String, Object>builder() .put("fileKey", 0) .put("isDirectory", true) @@ -320,14 +320,14 @@ public class AttributeServiceTest { service.readAttributes(file, "basic:fileKey,isOther,*,creationTime"); fail(); } catch (IllegalArgumentException expected) { - ASSERT.that(expected.getMessage()).contains("invalid attributes"); + assertThat(expected.getMessage()).contains("invalid attributes"); } try { service.readAttributes(file, "basic:fileKey,isOther,foo"); fail(); } catch (IllegalArgumentException expected) { - ASSERT.that(expected.getMessage()).contains("invalid attribute"); + assertThat(expected.getMessage()).contains("invalid attribute"); } } @@ -337,17 +337,17 @@ public class AttributeServiceTest { service.setInitialAttributes(file); BasicFileAttributes basicAttrs = service.readAttributes(file, BasicFileAttributes.class); - ASSERT.that(basicAttrs.fileKey()).isEqualTo(0); - ASSERT.that(basicAttrs.isDirectory()).isTrue(); - ASSERT.that(basicAttrs.isRegularFile()).isFalse(); + assertThat(basicAttrs.fileKey()).isEqualTo(0); + assertThat(basicAttrs.isDirectory()).isTrue(); + assertThat(basicAttrs.isRegularFile()).isFalse(); TestAttributes testAttrs = service.readAttributes(file, TestAttributes.class); - ASSERT.that(testAttrs.foo()).isEqualTo("hello"); - ASSERT.that(testAttrs.bar()).is(0); - ASSERT.that(testAttrs.baz()).is(1); + assertThat(testAttrs.foo()).isEqualTo("hello"); + assertThat(testAttrs.bar()).is(0); + assertThat(testAttrs.baz()).is(1); file.setAttribute("test", "baz", 100); - ASSERT.that(service.readAttributes(file, TestAttributes.class).baz()).is(100); + assertThat(service.readAttributes(file, TestAttributes.class).baz()).is(100); } @Test @@ -367,28 +367,28 @@ public class AttributeServiceTest { service.getAttribute(file, ":bar"); fail(); } catch (IllegalArgumentException expected) { - ASSERT.that(expected.getMessage()).contains("attribute format"); + assertThat(expected.getMessage()).contains("attribute format"); } try { service.getAttribute(file, "test:"); fail(); } catch (IllegalArgumentException expected) { - ASSERT.that(expected.getMessage()).contains("attribute format"); + assertThat(expected.getMessage()).contains("attribute format"); } try { service.getAttribute(file, "basic:test:isDirectory"); fail(); } catch (IllegalArgumentException expected) { - ASSERT.that(expected.getMessage()).contains("attribute format"); + assertThat(expected.getMessage()).contains("attribute format"); } try { service.getAttribute(file, "basic:fileKey,size"); fail(); } catch (IllegalArgumentException expected) { - ASSERT.that(expected.getMessage()).contains("single attribute"); + assertThat(expected.getMessage()).contains("single attribute"); } } } diff --git a/jimfs/src/test/java/com/google/common/jimfs/BasicAttributeProviderTest.java b/jimfs/src/test/java/com/google/common/jimfs/BasicAttributeProviderTest.java index 1f43c4a..b32213e 100644 --- a/jimfs/src/test/java/com/google/common/jimfs/BasicAttributeProviderTest.java +++ b/jimfs/src/test/java/com/google/common/jimfs/BasicAttributeProviderTest.java @@ -16,7 +16,7 @@ package com.google.common.jimfs; -import static com.google.common.truth.Truth.ASSERT; +import static com.google.common.truth.Truth.assertThat; import com.google.common.collect.ImmutableMap; import com.google.common.collect.ImmutableSet; @@ -59,9 +59,9 @@ public class BasicAttributeProviderTest extends @Test public void testInitialAttributes() { long time = file.getCreationTime(); - ASSERT.that(time).isNotEqualTo(0L); - ASSERT.that(time).isEqualTo(file.getLastAccessTime()); - ASSERT.that(time).isEqualTo(file.getLastModifiedTime()); + assertThat(time).isNotEqualTo(0L); + assertThat(time).isEqualTo(file.getLastAccessTime()); + assertThat(time).isEqualTo(file.getLastModifiedTime()); assertContainsAll(file, ImmutableMap.<String, Object>builder() @@ -108,37 +108,37 @@ public class BasicAttributeProviderTest extends public void testView() throws IOException { BasicFileAttributeView view = provider.view(fileLookup(), NO_INHERITED_VIEWS); - ASSERT.that(view).isNotNull(); - ASSERT.that(view.name()).isEqualTo("basic"); + assertThat(view).isNotNull(); + assertThat(view.name()).isEqualTo("basic"); BasicFileAttributes attrs = view.readAttributes(); - ASSERT.that(attrs.fileKey()).isEqualTo(0); + assertThat(attrs.fileKey()).isEqualTo(0); FileTime time = attrs.creationTime(); - ASSERT.that(attrs.lastAccessTime()).isEqualTo(time); - ASSERT.that(attrs.lastModifiedTime()).isEqualTo(time); + assertThat(attrs.lastAccessTime()).isEqualTo(time); + assertThat(attrs.lastModifiedTime()).isEqualTo(time); view.setTimes(null, null, null); attrs = view.readAttributes(); - ASSERT.that(attrs.creationTime()).isEqualTo(time); - ASSERT.that(attrs.lastAccessTime()).isEqualTo(time); - ASSERT.that(attrs.lastModifiedTime()).isEqualTo(time); + assertThat(attrs.creationTime()).isEqualTo(time); + assertThat(attrs.lastAccessTime()).isEqualTo(time); + assertThat(attrs.lastModifiedTime()).isEqualTo(time); view.setTimes(FileTime.fromMillis(0L), null, null); attrs = view.readAttributes(); - ASSERT.that(attrs.creationTime()).isEqualTo(time); - ASSERT.that(attrs.lastAccessTime()).isEqualTo(time); - ASSERT.that(attrs.lastModifiedTime()).isEqualTo(FileTime.fromMillis(0L)); + assertThat(attrs.creationTime()).isEqualTo(time); + assertThat(attrs.lastAccessTime()).isEqualTo(time); + assertThat(attrs.lastModifiedTime()).isEqualTo(FileTime.fromMillis(0L)); } @Test public void testAttributes() { BasicFileAttributes attrs = provider.readAttributes(file); - ASSERT.that(attrs.fileKey()).isEqualTo(0); - ASSERT.that(attrs.isDirectory()).isTrue(); - ASSERT.that(attrs.isRegularFile()).isFalse(); - ASSERT.that(attrs.creationTime()).isNotNull(); + assertThat(attrs.fileKey()).isEqualTo(0); + assertThat(attrs.isDirectory()).isTrue(); + assertThat(attrs.isRegularFile()).isFalse(); + assertThat(attrs.creationTime()).isNotNull(); } } diff --git a/jimfs/src/test/java/com/google/common/jimfs/ConfigurationTest.java b/jimfs/src/test/java/com/google/common/jimfs/ConfigurationTest.java index 425e716..f13c44e 100644 --- a/jimfs/src/test/java/com/google/common/jimfs/ConfigurationTest.java +++ b/jimfs/src/test/java/com/google/common/jimfs/ConfigurationTest.java @@ -20,7 +20,7 @@ import static com.google.common.jimfs.PathNormalization.CASE_FOLD_ASCII; import static com.google.common.jimfs.PathNormalization.CASE_FOLD_UNICODE; import static com.google.common.jimfs.PathNormalization.NFC; import static com.google.common.jimfs.PathNormalization.NFD; -import static com.google.common.truth.Truth.ASSERT; +import static com.google.common.truth.Truth.assertThat; import static org.junit.Assert.fail; import com.google.common.collect.ImmutableList; @@ -49,29 +49,29 @@ public class ConfigurationTest { public void testDefaultUnixConfiguration() { Configuration config = Configuration.unix(); - ASSERT.that(config.pathType).isEqualTo(PathType.unix()); - ASSERT.that(config.roots).has().exactly("/"); - ASSERT.that(config.workingDirectory).isEqualTo("/work"); - ASSERT.that(config.nameCanonicalNormalization).isEmpty(); - ASSERT.that(config.nameDisplayNormalization).isEmpty(); - ASSERT.that(config.pathEqualityUsesCanonicalForm).isFalse(); - ASSERT.that(config.blockSize).is(8192); - ASSERT.that(config.maxSize).isEqualTo(4L * 1024 * 1024 * 1024); - ASSERT.that(config.maxCacheSize).is(-1); - ASSERT.that(config.attributeViews).has().exactly("basic"); - ASSERT.that(config.attributeProviders).isEmpty(); - ASSERT.that(config.defaultAttributeValues).isEmpty(); + assertThat(config.pathType).isEqualTo(PathType.unix()); + assertThat(config.roots).has().exactly("/"); + assertThat(config.workingDirectory).isEqualTo("/work"); + assertThat(config.nameCanonicalNormalization).isEmpty(); + assertThat(config.nameDisplayNormalization).isEmpty(); + assertThat(config.pathEqualityUsesCanonicalForm).isFalse(); + assertThat(config.blockSize).is(8192); + assertThat(config.maxSize).isEqualTo(4L * 1024 * 1024 * 1024); + assertThat(config.maxCacheSize).is(-1); + assertThat(config.attributeViews).has().exactly("basic"); + assertThat(config.attributeProviders).isEmpty(); + assertThat(config.defaultAttributeValues).isEmpty(); } @Test public void testFileSystemForDefaultUnixConfiguration() throws IOException { FileSystem fs = Jimfs.newFileSystem(Configuration.unix()); - ASSERT.that(fs.getRootDirectories()).iteratesAs(ImmutableList.of(fs.getPath("/"))); - ASSERT.that(fs.getPath("").toRealPath()).isEqualTo(fs.getPath("/work")); - ASSERT.that(Iterables.getOnlyElement(fs.getFileStores()).getTotalSpace()).isEqualTo( + assertThat(fs.getRootDirectories()).iteratesAs(ImmutableList.of(fs.getPath("/"))); + assertThat(fs.getPath("").toRealPath()).isEqualTo(fs.getPath("/work")); + assertThat(Iterables.getOnlyElement(fs.getFileStores()).getTotalSpace()).isEqualTo( 4L * 1024 * 1024 * 1024); - ASSERT.that(fs.supportedFileAttributeViews()).has().exactly("basic"); + assertThat(fs.supportedFileAttributeViews()).has().exactly("basic"); Files.createFile(fs.getPath("/foo")); Files.createFile(fs.getPath("/FOO")); @@ -81,29 +81,29 @@ public class ConfigurationTest { public void testDefaultOsXConfiguration() { Configuration config = Configuration.osX(); - ASSERT.that(config.pathType).isEqualTo(PathType.unix()); - ASSERT.that(config.roots).has().exactly("/"); - ASSERT.that(config.workingDirectory).isEqualTo("/work"); - ASSERT.that(config.nameCanonicalNormalization).has().exactly(NFD, CASE_FOLD_ASCII); - ASSERT.that(config.nameDisplayNormalization).has().exactly(NFC); - ASSERT.that(config.pathEqualityUsesCanonicalForm).isFalse(); - ASSERT.that(config.blockSize).is(8192); - ASSERT.that(config.maxSize).isEqualTo(4L * 1024 * 1024 * 1024); - ASSERT.that(config.maxCacheSize).is(-1); - ASSERT.that(config.attributeViews).has().exactly("basic"); - ASSERT.that(config.attributeProviders).isEmpty(); - ASSERT.that(config.defaultAttributeValues).isEmpty(); + assertThat(config.pathType).isEqualTo(PathType.unix()); + assertThat(config.roots).has().exactly("/"); + assertThat(config.workingDirectory).isEqualTo("/work"); + assertThat(config.nameCanonicalNormalization).has().exactly(NFD, CASE_FOLD_ASCII); + assertThat(config.nameDisplayNormalization).has().exactly(NFC); + assertThat(config.pathEqualityUsesCanonicalForm).isFalse(); + assertThat(config.blockSize).is(8192); + assertThat(config.maxSize).isEqualTo(4L * 1024 * 1024 * 1024); + assertThat(config.maxCacheSize).is(-1); + assertThat(config.attributeViews).has().exactly("basic"); + assertThat(config.attributeProviders).isEmpty(); + assertThat(config.defaultAttributeValues).isEmpty(); } @Test public void testFileSystemForDefaultOsXConfiguration() throws IOException { FileSystem fs = Jimfs.newFileSystem(Configuration.osX()); - ASSERT.that(fs.getRootDirectories()).iteratesAs(ImmutableList.of(fs.getPath("/"))); - ASSERT.that(fs.getPath("").toRealPath()).isEqualTo(fs.getPath("/work")); - ASSERT.that(Iterables.getOnlyElement(fs.getFileStores()).getTotalSpace()).isEqualTo( + assertThat(fs.getRootDirectories()).iteratesAs(ImmutableList.of(fs.getPath("/"))); + assertThat(fs.getPath("").toRealPath()).isEqualTo(fs.getPath("/work")); + assertThat(Iterables.getOnlyElement(fs.getFileStores()).getTotalSpace()).isEqualTo( 4L * 1024 * 1024 * 1024); - ASSERT.that(fs.supportedFileAttributeViews()).has().exactly("basic"); + assertThat(fs.supportedFileAttributeViews()).has().exactly("basic"); Files.createFile(fs.getPath("/foo")); @@ -118,29 +118,29 @@ public class ConfigurationTest { public void testDefaultWindowsConfiguration() { Configuration config = Configuration.windows(); - ASSERT.that(config.pathType).isEqualTo(PathType.windows()); - ASSERT.that(config.roots).has().exactly("C:\\"); - ASSERT.that(config.workingDirectory).isEqualTo("C:\\work"); - ASSERT.that(config.nameCanonicalNormalization).has().exactly(CASE_FOLD_ASCII); - ASSERT.that(config.nameDisplayNormalization).isEmpty(); - ASSERT.that(config.pathEqualityUsesCanonicalForm).isTrue(); - ASSERT.that(config.blockSize).is(8192); - ASSERT.that(config.maxSize).isEqualTo(4L * 1024 * 1024 * 1024); - ASSERT.that(config.maxCacheSize).is(-1); - ASSERT.that(config.attributeViews).has().exactly("basic"); - ASSERT.that(config.attributeProviders).isEmpty(); - ASSERT.that(config.defaultAttributeValues).isEmpty(); + assertThat(config.pathType).isEqualTo(PathType.windows()); + assertThat(config.roots).has().exactly("C:\\"); + assertThat(config.workingDirectory).isEqualTo("C:\\work"); + assertThat(config.nameCanonicalNormalization).has().exactly(CASE_FOLD_ASCII); + assertThat(config.nameDisplayNormalization).isEmpty(); + assertThat(config.pathEqualityUsesCanonicalForm).isTrue(); + assertThat(config.blockSize).is(8192); + assertThat(config.maxSize).isEqualTo(4L * 1024 * 1024 * 1024); + assertThat(config.maxCacheSize).is(-1); + assertThat(config.attributeViews).has().exactly("basic"); + assertThat(config.attributeProviders).isEmpty(); + assertThat(config.defaultAttributeValues).isEmpty(); } @Test public void testFileSystemForDefaultWindowsConfiguration() throws IOException { FileSystem fs = Jimfs.newFileSystem(Configuration.windows()); - ASSERT.that(fs.getRootDirectories()).iteratesAs(ImmutableList.of(fs.getPath("C:\\"))); - ASSERT.that(fs.getPath("").toRealPath()).isEqualTo(fs.getPath("C:\\work")); - ASSERT.that(Iterables.getOnlyElement(fs.getFileStores()).getTotalSpace()).isEqualTo( + assertThat(fs.getRootDirectories()).iteratesAs(ImmutableList.of(fs.getPath("C:\\"))); + assertThat(fs.getPath("").toRealPath()).isEqualTo(fs.getPath("C:\\work")); + assertThat(Iterables.getOnlyElement(fs.getFileStores()).getTotalSpace()).isEqualTo( 4L * 1024 * 1024 * 1024); - ASSERT.that(fs.supportedFileAttributeViews()).has().exactly("basic"); + assertThat(fs.supportedFileAttributeViews()).has().exactly("basic"); Files.createFile(fs.getPath("C:\\foo")); @@ -170,18 +170,18 @@ public class ConfigurationTest { "posix:permissions", PosixFilePermissions.fromString("---------")) .build(); - ASSERT.that(config.pathType).isEqualTo(PathType.unix()); - ASSERT.that(config.roots).has().exactly("/"); - ASSERT.that(config.workingDirectory).isEqualTo("/hello/world"); - ASSERT.that(config.nameCanonicalNormalization).has().exactly(NFD, CASE_FOLD_UNICODE); - ASSERT.that(config.nameDisplayNormalization).has().exactly(NFC); - ASSERT.that(config.pathEqualityUsesCanonicalForm).isTrue(); - ASSERT.that(config.blockSize).is(10); - ASSERT.that(config.maxSize).is(100); - ASSERT.that(config.maxCacheSize).is(50); - ASSERT.that(config.attributeViews).has().exactly("basic", "posix"); - ASSERT.that(config.attributeProviders).has().exactly(unixProvider); - ASSERT.that(config.defaultAttributeValues) + assertThat(config.pathType).isEqualTo(PathType.unix()); + assertThat(config.roots).has().exactly("/"); + assertThat(config.workingDirectory).isEqualTo("/hello/world"); + assertThat(config.nameCanonicalNormalization).has().exactly(NFD, CASE_FOLD_UNICODE); + assertThat(config.nameDisplayNormalization).has().exactly(NFC); + assertThat(config.pathEqualityUsesCanonicalForm).isTrue(); + assertThat(config.blockSize).is(10); + assertThat(config.maxSize).is(100); + assertThat(config.maxCacheSize).is(50); + assertThat(config.attributeViews).has().exactly("basic", "posix"); + assertThat(config.attributeProviders).has().exactly(unixProvider); + assertThat(config.defaultAttributeValues) .hasKey("posix:permissions").withValue(PosixFilePermissions.fromString("---------")); } @@ -203,14 +203,14 @@ public class ConfigurationTest { FileSystem fs = Jimfs.newFileSystem(config); - ASSERT.that(fs.getRootDirectories()).iteratesAs(ImmutableList.of(fs.getPath("/"))); - ASSERT.that(fs.getPath("").toRealPath()).isEqualTo(fs.getPath("/hello/world")); - ASSERT.that(Iterables.getOnlyElement(fs.getFileStores()).getTotalSpace()) + assertThat(fs.getRootDirectories()).iteratesAs(ImmutableList.of(fs.getPath("/"))); + assertThat(fs.getPath("").toRealPath()).isEqualTo(fs.getPath("/hello/world")); + assertThat(Iterables.getOnlyElement(fs.getFileStores()).getTotalSpace()) .is(100); - ASSERT.that(fs.supportedFileAttributeViews()).has().exactly("basic", "owner", "posix", "unix"); + assertThat(fs.supportedFileAttributeViews()).has().exactly("basic", "owner", "posix", "unix"); Files.createFile(fs.getPath("/foo")); - ASSERT.that(Files.getAttribute(fs.getPath("/foo"), "posix:permissions")).isEqualTo( + assertThat(Files.getAttribute(fs.getPath("/foo"), "posix:permissions")).isEqualTo( PosixFilePermissions.fromString("---------")); try { @@ -227,18 +227,18 @@ public class ConfigurationTest { .setAttributeViews("basic", "posix") .build(); - ASSERT.that(config.pathType).isEqualTo(PathType.unix()); - ASSERT.that(config.roots).has().exactly("/"); - ASSERT.that(config.workingDirectory).isEqualTo("/hello/world"); - ASSERT.that(config.nameCanonicalNormalization).isEmpty(); - ASSERT.that(config.nameDisplayNormalization).isEmpty(); - ASSERT.that(config.pathEqualityUsesCanonicalForm).isFalse(); - ASSERT.that(config.blockSize).is(8192); - ASSERT.that(config.maxSize).isEqualTo(4L * 1024 * 1024 * 1024); - ASSERT.that(config.maxCacheSize).is(-1); - ASSERT.that(config.attributeViews).has().exactly("basic", "posix"); - ASSERT.that(config.attributeProviders).isEmpty(); - ASSERT.that(config.defaultAttributeValues).isEmpty(); + assertThat(config.pathType).isEqualTo(PathType.unix()); + assertThat(config.roots).has().exactly("/"); + assertThat(config.workingDirectory).isEqualTo("/hello/world"); + assertThat(config.nameCanonicalNormalization).isEmpty(); + assertThat(config.nameDisplayNormalization).isEmpty(); + assertThat(config.pathEqualityUsesCanonicalForm).isFalse(); + assertThat(config.blockSize).is(8192); + assertThat(config.maxSize).isEqualTo(4L * 1024 * 1024 * 1024); + assertThat(config.maxCacheSize).is(-1); + assertThat(config.attributeViews).has().exactly("basic", "posix"); + assertThat(config.attributeProviders).isEmpty(); + assertThat(config.defaultAttributeValues).isEmpty(); } @Test diff --git a/jimfs/src/test/java/com/google/common/jimfs/DirectoryTest.java b/jimfs/src/test/java/com/google/common/jimfs/DirectoryTest.java index e1529e7..f7db823 100644 --- a/jimfs/src/test/java/com/google/common/jimfs/DirectoryTest.java +++ b/jimfs/src/test/java/com/google/common/jimfs/DirectoryTest.java @@ -19,7 +19,7 @@ package com.google.common.jimfs; import static com.google.common.jimfs.Name.PARENT; import static com.google.common.jimfs.Name.SELF; import static com.google.common.jimfs.TestUtils.regularFile; -import static com.google.common.truth.Truth.ASSERT; +import static com.google.common.truth.Truth.assertThat; import static org.junit.Assert.fail; import com.google.common.base.Functions; @@ -58,37 +58,37 @@ public class DirectoryTest { @Test public void testRootDirectory() { - ASSERT.that(root.entryCount()).is(3); // two for parent/self, one for dir - ASSERT.that(root.isEmpty()).isFalse(); - ASSERT.that(root.entryInParent()).isEqualTo(entry(root, "/", root)); - ASSERT.that(root.entryInParent().name()).isEqualTo(Name.simple("/")); + assertThat(root.entryCount()).is(3); // two for parent/self, one for dir + assertThat(root.isEmpty()).isFalse(); + assertThat(root.entryInParent()).isEqualTo(entry(root, "/", root)); + assertThat(root.entryInParent().name()).isEqualTo(Name.simple("/")); assertParentAndSelf(root, root, root); } @Test public void testEmptyDirectory() { - ASSERT.that(dir.entryCount()).is(2); - ASSERT.that(dir.isEmpty()).isTrue(); + assertThat(dir.entryCount()).is(2); + assertThat(dir.isEmpty()).isTrue(); assertParentAndSelf(dir, root, dir); } @Test public void testGet() { - ASSERT.that(root.get(Name.simple("foo"))).isEqualTo(entry(root, "foo", dir)); - ASSERT.that(dir.get(Name.simple("foo"))).isNull(); - ASSERT.that(root.get(Name.simple("Foo"))).isNull(); + assertThat(root.get(Name.simple("foo"))).isEqualTo(entry(root, "foo", dir)); + assertThat(dir.get(Name.simple("foo"))).isNull(); + assertThat(root.get(Name.simple("Foo"))).isNull(); } @Test public void testLink() { - ASSERT.that(dir.get(Name.simple("bar"))).isNull(); + assertThat(dir.get(Name.simple("bar"))).isNull(); File bar = Directory.create(2); dir.link(Name.simple("bar"), bar); - ASSERT.that(dir.get(Name.simple("bar"))).isEqualTo(entry(dir, "bar", bar)); + assertThat(dir.get(Name.simple("bar"))).isEqualTo(entry(dir, "bar", bar)); } @Test @@ -123,19 +123,19 @@ public class DirectoryTest { dir.link(barName, bar); DirectoryEntry expected = new DirectoryEntry(dir, barName, bar); - ASSERT.that(dir.get(caseInsensitive("bar"))).isEqualTo(expected); - ASSERT.that(dir.get(caseInsensitive("BAR"))).isEqualTo(expected); - ASSERT.that(dir.get(caseInsensitive("Bar"))).isEqualTo(expected); - ASSERT.that(dir.get(caseInsensitive("baR"))).isEqualTo(expected); + assertThat(dir.get(caseInsensitive("bar"))).isEqualTo(expected); + assertThat(dir.get(caseInsensitive("BAR"))).isEqualTo(expected); + assertThat(dir.get(caseInsensitive("Bar"))).isEqualTo(expected); + assertThat(dir.get(caseInsensitive("baR"))).isEqualTo(expected); } @Test public void testUnlink() { - ASSERT.that(root.get(Name.simple("foo"))).isNotNull(); + assertThat(root.get(Name.simple("foo"))).isNotNull(); root.unlink(Name.simple("foo")); - ASSERT.that(root.get(Name.simple("foo"))).isNull(); + assertThat(root.get(Name.simple("foo"))).isNull(); } @Test @@ -166,30 +166,30 @@ public class DirectoryTest { public void testUnlink_normalizingCaseInsensitive() { dir.link(caseInsensitive("bar"), Directory.create(2)); - ASSERT.that(dir.get(caseInsensitive("bar"))).isNotNull(); + assertThat(dir.get(caseInsensitive("bar"))).isNotNull(); dir.unlink(caseInsensitive("BAR")); - ASSERT.that(dir.get(caseInsensitive("bar"))).isNull(); + assertThat(dir.get(caseInsensitive("bar"))).isNull(); } @Test public void testLinkDirectory() { Directory newDir = Directory.create(10); - ASSERT.that(newDir.entryInParent()).isNull(); - ASSERT.that(newDir.get(Name.SELF).file()).isEqualTo(newDir); - ASSERT.that(newDir.get(Name.PARENT)).isNull(); - ASSERT.that(newDir.links()).is(1); + assertThat(newDir.entryInParent()).isNull(); + assertThat(newDir.get(Name.SELF).file()).isEqualTo(newDir); + assertThat(newDir.get(Name.PARENT)).isNull(); + assertThat(newDir.links()).is(1); dir.link(Name.simple("foo"), newDir); - ASSERT.that(newDir.entryInParent()).isEqualTo(entry(dir, "foo", newDir)); - ASSERT.that(newDir.parent()).isEqualTo(dir); - ASSERT.that(newDir.entryInParent().name()).isEqualTo(Name.simple("foo")); - ASSERT.that(newDir.get(Name.SELF)).isEqualTo(entry(newDir, ".", newDir)); - ASSERT.that(newDir.get(Name.PARENT)).isEqualTo(entry(newDir, "..", dir)); - ASSERT.that(newDir.links()).is(2); + assertThat(newDir.entryInParent()).isEqualTo(entry(dir, "foo", newDir)); + assertThat(newDir.parent()).isEqualTo(dir); + assertThat(newDir.entryInParent().name()).isEqualTo(Name.simple("foo")); + assertThat(newDir.get(Name.SELF)).isEqualTo(entry(newDir, ".", newDir)); + assertThat(newDir.get(Name.PARENT)).isEqualTo(entry(newDir, "..", dir)); + assertThat(newDir.links()).is(2); } @Test @@ -198,19 +198,19 @@ public class DirectoryTest { dir.link(Name.simple("foo"), newDir); - ASSERT.that(dir.links()).is(3); + assertThat(dir.links()).is(3); - ASSERT.that(newDir.entryInParent()).isEqualTo(entry(dir, "foo", newDir)); - ASSERT.that(newDir.links()).is(2); + assertThat(newDir.entryInParent()).isEqualTo(entry(dir, "foo", newDir)); + assertThat(newDir.links()).is(2); dir.unlink(Name.simple("foo")); - ASSERT.that(dir.links()).is(2); + assertThat(dir.links()).is(2); - ASSERT.that(newDir.entryInParent()).isEqualTo(entry(dir, "foo", newDir)); - ASSERT.that(newDir.get(Name.SELF).file()).isEqualTo(newDir); - ASSERT.that(newDir.get(Name.PARENT)).isEqualTo(entry(newDir, "..", dir)); - ASSERT.that(newDir.links()).is(1); + assertThat(newDir.entryInParent()).isEqualTo(entry(dir, "foo", newDir)); + assertThat(newDir.get(Name.SELF).file()).isEqualTo(newDir); + assertThat(newDir.get(Name.PARENT)).isEqualTo(entry(newDir, "..", dir)); + assertThat(newDir.links()).is(1); } @Test @@ -219,7 +219,7 @@ public class DirectoryTest { root.link(Name.simple("abc"), regularFile(10)); // does not include . or .. and is sorted by the name - ASSERT.that(root.snapshot()) + assertThat(root.snapshot()) .has().exactly(Name.simple("abc"), Name.simple("bar"), Name.simple("foo")); } @@ -234,7 +234,7 @@ public class DirectoryTest { // "FOO" comes before "bar" // if the order were based on the normalized, canonical form of the names ("foo" and "bar"), // "bar" would come first - ASSERT.that(strings).iteratesAs("FOO", "bar"); + assertThat(strings).iteratesAs("FOO", "bar"); } // Tests for internal hash table implementation @@ -243,28 +243,28 @@ public class DirectoryTest { @Test public void testInitialState() { - ASSERT.that(dir.entryCount()).is(2); - ASSERT.that(ImmutableSet.copyOf(dir)).has().exactly( + assertThat(dir.entryCount()).is(2); + assertThat(ImmutableSet.copyOf(dir)).has().exactly( new DirectoryEntry(dir, Name.SELF, dir), new DirectoryEntry(dir, Name.PARENT, root)); - ASSERT.that(dir.get(Name.simple("foo"))).isNull(); + assertThat(dir.get(Name.simple("foo"))).isNull(); } @Test public void testPutAndGet() { dir.put(entry("foo")); - ASSERT.that(dir.entryCount()).is(3); - ASSERT.that(ImmutableSet.copyOf(dir)).has().item(entry("foo")); - ASSERT.that(dir.get(Name.simple("foo"))).isEqualTo(entry("foo")); + assertThat(dir.entryCount()).is(3); + assertThat(ImmutableSet.copyOf(dir)).has().item(entry("foo")); + assertThat(dir.get(Name.simple("foo"))).isEqualTo(entry("foo")); dir.put(entry("bar")); - ASSERT.that(dir.entryCount()).is(4); - ASSERT.that(ImmutableSet.copyOf(dir)) + assertThat(dir.entryCount()).is(4); + assertThat(ImmutableSet.copyOf(dir)) .has().allOf(entry("foo"), entry("bar")); - ASSERT.that(dir.get(Name.simple("foo"))).isEqualTo(entry("foo")); - ASSERT.that(dir.get(Name.simple("bar"))).isEqualTo(entry("bar")); + assertThat(dir.get(Name.simple("foo"))).isEqualTo(entry("foo")); + assertThat(dir.get(Name.simple("bar"))).isEqualTo(entry("bar")); } @Test @@ -284,17 +284,17 @@ public class DirectoryTest { dir.remove(Name.simple("foo")); - ASSERT.that(dir.entryCount()).is(3); - ASSERT.that(ImmutableSet.copyOf(dir)).has().exactly( + assertThat(dir.entryCount()).is(3); + assertThat(ImmutableSet.copyOf(dir)).has().exactly( entry("bar"), new DirectoryEntry(dir, Name.SELF, dir), new DirectoryEntry(dir, Name.PARENT, root)); - ASSERT.that(dir.get(Name.simple("foo"))).isNull(); - ASSERT.that(dir.get(Name.simple("bar"))).isEqualTo(entry("bar")); + assertThat(dir.get(Name.simple("foo"))).isNull(); + assertThat(dir.get(Name.simple("bar"))).isEqualTo(entry("bar")); dir.remove(Name.simple("bar")); - ASSERT.that(dir.entryCount()).is(2); + assertThat(dir.entryCount()).is(2); dir.put(entry("bar")); dir.put(entry("foo")); // these should just succeeded @@ -314,10 +314,10 @@ public class DirectoryTest { dir.put(entry); entriesInDir.add(entry); - ASSERT.that(ImmutableSet.copyOf(dir)).isEqualTo(entriesInDir); + assertThat(ImmutableSet.copyOf(dir)).isEqualTo(entriesInDir); for (DirectoryEntry expected : entriesInDir) { - ASSERT.that(dir.get(expected.name())).isEqualTo(expected); + assertThat(dir.get(expected.name())).isEqualTo(expected); } } @@ -326,10 +326,10 @@ public class DirectoryTest { dir.remove(Name.simple(String.valueOf(i))); entriesInDir.remove(entry(String.valueOf(i))); - ASSERT.that(ImmutableSet.copyOf(dir)).isEqualTo(entriesInDir); + assertThat(ImmutableSet.copyOf(dir)).isEqualTo(entriesInDir); for (DirectoryEntry expected : entriesInDir) { - ASSERT.that(dir.get(expected.name())).isEqualTo(expected); + assertThat(dir.get(expected.name())).isEqualTo(expected); } } @@ -348,10 +348,10 @@ public class DirectoryTest { // for this one, only test that the end result is correct // takes too long to test at each iteration - ASSERT.that(ImmutableSet.copyOf(dir)).isEqualTo(entriesInDir); + assertThat(ImmutableSet.copyOf(dir)).isEqualTo(entriesInDir); for (DirectoryEntry expected : entriesInDir) { - ASSERT.that(dir.get(expected.name())).isEqualTo(expected); + assertThat(dir.get(expected.name())).isEqualTo(expected); } } @@ -364,11 +364,11 @@ public class DirectoryTest { } private static void assertParentAndSelf(Directory dir, File parent, File self) { - ASSERT.that(dir).isEqualTo(self); - ASSERT.that(dir.parent()).isEqualTo(parent); + assertThat(dir).isEqualTo(self); + assertThat(dir.parent()).isEqualTo(parent); - ASSERT.that(dir.get(PARENT)).isEqualTo(entry((Directory) self, "..", parent)); - ASSERT.that(dir.get(SELF)).isEqualTo(entry((Directory) self, ".", self)); + assertThat(dir.get(PARENT)).isEqualTo(entry((Directory) self, "..", parent)); + assertThat(dir.get(SELF)).isEqualTo(entry((Directory) self, ".", self)); } private static Name caseInsensitive(String name) { diff --git a/jimfs/src/test/java/com/google/common/jimfs/DosAttributeProviderTest.java b/jimfs/src/test/java/com/google/common/jimfs/DosAttributeProviderTest.java index 2aa5b42..6de2d2f 100644 --- a/jimfs/src/test/java/com/google/common/jimfs/DosAttributeProviderTest.java +++ b/jimfs/src/test/java/com/google/common/jimfs/DosAttributeProviderTest.java @@ -16,7 +16,7 @@ package com.google.common.jimfs; -import static com.google.common.truth.Truth.ASSERT; +import static com.google.common.truth.Truth.assertThat; import static org.junit.Assert.assertNotNull; import com.google.common.collect.ImmutableList; @@ -58,7 +58,7 @@ public class DosAttributeProviderTest extends AbstractAttributeProviderTest<DosA @Test public void testInitialAttributes() { for (String attribute : DOS_ATTRIBUTES) { - ASSERT.that(provider.get(file, attribute)).isEqualTo(false); + assertThat(provider.get(file, attribute)).isEqualTo(false); } } @@ -77,47 +77,47 @@ public class DosAttributeProviderTest extends AbstractAttributeProviderTest<DosA "basic", new BasicAttributeProvider().view(fileLookup(), NO_INHERITED_VIEWS))); assertNotNull(view); - ASSERT.that(view.name()).isEqualTo("dos"); + assertThat(view.name()).isEqualTo("dos"); DosFileAttributes attrs = view.readAttributes(); - ASSERT.that(attrs.isHidden()).isFalse(); - ASSERT.that(attrs.isArchive()).isFalse(); - ASSERT.that(attrs.isReadOnly()).isFalse(); - ASSERT.that(attrs.isSystem()).isFalse(); + assertThat(attrs.isHidden()).isFalse(); + assertThat(attrs.isArchive()).isFalse(); + assertThat(attrs.isReadOnly()).isFalse(); + assertThat(attrs.isSystem()).isFalse(); view.setArchive(true); view.setReadOnly(true); view.setHidden(true); view.setSystem(false); - ASSERT.that(attrs.isHidden()).isFalse(); - ASSERT.that(attrs.isArchive()).isFalse(); - ASSERT.that(attrs.isReadOnly()).isFalse(); + assertThat(attrs.isHidden()).isFalse(); + assertThat(attrs.isArchive()).isFalse(); + assertThat(attrs.isReadOnly()).isFalse(); attrs = view.readAttributes(); - ASSERT.that(attrs.isHidden()).isTrue(); - ASSERT.that(attrs.isArchive()).isTrue(); - ASSERT.that(attrs.isReadOnly()).isTrue(); - ASSERT.that(attrs.isSystem()).isFalse(); + assertThat(attrs.isHidden()).isTrue(); + assertThat(attrs.isArchive()).isTrue(); + assertThat(attrs.isReadOnly()).isTrue(); + assertThat(attrs.isSystem()).isFalse(); view.setTimes(FileTime.fromMillis(0L), null, null); - ASSERT.that(view.readAttributes().lastModifiedTime()).isEqualTo(FileTime.fromMillis(0L)); + assertThat(view.readAttributes().lastModifiedTime()).isEqualTo(FileTime.fromMillis(0L)); } @Test public void testAttributes() { DosFileAttributes attrs = provider.readAttributes(file); - ASSERT.that(attrs.isHidden()).isFalse(); - ASSERT.that(attrs.isArchive()).isFalse(); - ASSERT.that(attrs.isReadOnly()).isFalse(); - ASSERT.that(attrs.isSystem()).isFalse(); + assertThat(attrs.isHidden()).isFalse(); + assertThat(attrs.isArchive()).isFalse(); + assertThat(attrs.isReadOnly()).isFalse(); + assertThat(attrs.isSystem()).isFalse(); file.setAttribute("dos", "hidden", true); attrs = provider.readAttributes(file); - ASSERT.that(attrs.isHidden()).isTrue(); - ASSERT.that(attrs.isArchive()).isFalse(); - ASSERT.that(attrs.isReadOnly()).isFalse(); - ASSERT.that(attrs.isSystem()).isFalse(); + assertThat(attrs.isHidden()).isTrue(); + assertThat(attrs.isArchive()).isFalse(); + assertThat(attrs.isReadOnly()).isFalse(); + assertThat(attrs.isSystem()).isFalse(); } } diff --git a/jimfs/src/test/java/com/google/common/jimfs/FileFactoryTest.java b/jimfs/src/test/java/com/google/common/jimfs/FileFactoryTest.java index 41a1415..9e3cb40 100644 --- a/jimfs/src/test/java/com/google/common/jimfs/FileFactoryTest.java +++ b/jimfs/src/test/java/com/google/common/jimfs/FileFactoryTest.java @@ -16,7 +16,7 @@ package com.google.common.jimfs; -import static com.google.common.truth.Truth.ASSERT; +import static com.google.common.truth.Truth.assertThat; import org.junit.Before; import org.junit.Test; @@ -41,31 +41,31 @@ public class FileFactoryTest { @Test public void testCreateFiles_basic() { File file = factory.createDirectory(); - ASSERT.that(file.id()).isEqualTo(0L); - ASSERT.that(file.isDirectory()).isTrue(); + assertThat(file.id()).isEqualTo(0L); + assertThat(file.isDirectory()).isTrue(); file = factory.createRegularFile(); - ASSERT.that(file.id()).isEqualTo(1L); - ASSERT.that(file.isRegularFile()).isTrue(); + assertThat(file.id()).isEqualTo(1L); + assertThat(file.isRegularFile()).isTrue(); file = factory.createSymbolicLink(fakePath()); - ASSERT.that(file.id()).isEqualTo(2L); - ASSERT.that(file.isSymbolicLink()).isTrue(); + assertThat(file.id()).isEqualTo(2L); + assertThat(file.isSymbolicLink()).isTrue(); } @Test public void testCreateFiles_withSupplier() { File file = factory.directoryCreator().get(); - ASSERT.that(file.id()).isEqualTo(0L); - ASSERT.that(file.isDirectory()).isTrue(); + assertThat(file.id()).isEqualTo(0L); + assertThat(file.isDirectory()).isTrue(); file = factory.regularFileCreator().get(); - ASSERT.that(file.id()).isEqualTo(1L); - ASSERT.that(file.isRegularFile()).isTrue(); + assertThat(file.id()).isEqualTo(1L); + assertThat(file.isRegularFile()).isTrue(); file = factory.symbolicLinkCreator(fakePath()).get(); - ASSERT.that(file.id()).isEqualTo(2L); - ASSERT.that(file.isSymbolicLink()).isTrue(); + assertThat(file.id()).isEqualTo(2L); + assertThat(file.isSymbolicLink()).isTrue(); } static JimfsPath fakePath() { diff --git a/jimfs/src/test/java/com/google/common/jimfs/FileTest.java b/jimfs/src/test/java/com/google/common/jimfs/FileTest.java index 1f44d13..12bae2c 100644 --- a/jimfs/src/test/java/com/google/common/jimfs/FileTest.java +++ b/jimfs/src/test/java/com/google/common/jimfs/FileTest.java @@ -18,7 +18,7 @@ package com.google.common.jimfs; import static com.google.common.jimfs.FileFactoryTest.fakePath; import static com.google.common.jimfs.TestUtils.regularFile; -import static com.google.common.truth.Truth.ASSERT; +import static com.google.common.truth.Truth.assertThat; import org.junit.Test; import org.junit.runner.RunWith; @@ -39,78 +39,78 @@ public class FileTest { File file = RegularFile.create(0, new HeapDisk(10, 10, 10)); - ASSERT.that(file.getAttributeKeys()).isEmpty(); - ASSERT.that(file.getAttribute("foo", "foo")).isNull(); + assertThat(file.getAttributeKeys()).isEmpty(); + assertThat(file.getAttribute("foo", "foo")).isNull(); file.deleteAttribute("foo", "foo"); // doesn't throw file.setAttribute("foo", "foo", "foo"); - ASSERT.that(file.getAttributeKeys()).iteratesAs("foo:foo"); - ASSERT.that(file.getAttribute("foo", "foo")).isEqualTo("foo"); + assertThat(file.getAttributeKeys()).iteratesAs("foo:foo"); + assertThat(file.getAttribute("foo", "foo")).isEqualTo("foo"); file.deleteAttribute("foo", "foo"); - ASSERT.that(file.getAttributeKeys()).isEmpty(); - ASSERT.that(file.getAttribute("foo", "foo")).isNull(); + assertThat(file.getAttributeKeys()).isEmpty(); + assertThat(file.getAttribute("foo", "foo")).isNull(); } @Test public void testFileBasics() { File file = regularFile(0); - ASSERT.that(file.id()).is(0); - ASSERT.that(file.links()).is(0); + assertThat(file.id()).is(0); + assertThat(file.links()).is(0); } @Test public void testDirectory() { File file = Directory.create(0); - ASSERT.that(file.isDirectory()).isTrue(); - ASSERT.that(file.isRegularFile()).isFalse(); - ASSERT.that(file.isSymbolicLink()).isFalse(); + assertThat(file.isDirectory()).isTrue(); + assertThat(file.isRegularFile()).isFalse(); + assertThat(file.isSymbolicLink()).isFalse(); } @Test public void testRegularFile() { File file = regularFile(10); - ASSERT.that(file.isDirectory()).isFalse(); - ASSERT.that(file.isRegularFile()).isTrue(); - ASSERT.that(file.isSymbolicLink()).isFalse(); + assertThat(file.isDirectory()).isFalse(); + assertThat(file.isRegularFile()).isTrue(); + assertThat(file.isSymbolicLink()).isFalse(); } @Test public void testSymbolicLink() { File file = SymbolicLink.create(0, fakePath()); - ASSERT.that(file.isDirectory()).isFalse(); - ASSERT.that(file.isRegularFile()).isFalse(); - ASSERT.that(file.isSymbolicLink()).isTrue(); + assertThat(file.isDirectory()).isFalse(); + assertThat(file.isRegularFile()).isFalse(); + assertThat(file.isSymbolicLink()).isTrue(); } @Test public void testRootDirectory() { Directory file = Directory.createRoot(0, Name.simple("/")); - ASSERT.that(file.isRootDirectory()).isTrue(); + assertThat(file.isRootDirectory()).isTrue(); Directory otherFile = Directory.createRoot(1, Name.simple("$")); - ASSERT.that(otherFile.isRootDirectory()).isTrue(); + assertThat(otherFile.isRootDirectory()).isTrue(); } @Test public void testLinkAndUnlink() { File file = regularFile(0); - ASSERT.that(file.links()).is(0); + assertThat(file.links()).is(0); file.incrementLinkCount(); - ASSERT.that(file.links()).is(1); + assertThat(file.links()).is(1); file.incrementLinkCount(); - ASSERT.that(file.links()).is(2); + assertThat(file.links()).is(2); file.decrementLinkCount(); - ASSERT.that(file.links()).is(1); + assertThat(file.links()).is(1); file.decrementLinkCount(); - ASSERT.that(file.links()).is(0); + assertThat(file.links()).is(0); } } diff --git a/jimfs/src/test/java/com/google/common/jimfs/FileTreeTest.java b/jimfs/src/test/java/com/google/common/jimfs/FileTreeTest.java index 6f46a14..efb427a 100644 --- a/jimfs/src/test/java/com/google/common/jimfs/FileTreeTest.java +++ b/jimfs/src/test/java/com/google/common/jimfs/FileTreeTest.java @@ -18,7 +18,7 @@ package com.google.common.jimfs; import static com.google.common.base.Preconditions.checkArgument; import static com.google.common.jimfs.TestUtils.regularFile; -import static com.google.common.truth.Truth.ASSERT; +import static com.google.common.truth.Truth.assertThat; import static java.nio.file.LinkOption.NOFOLLOW_LINKS; import static org.junit.Assert.fail; @@ -421,15 +421,15 @@ public class FileTreeTest { } private void assertExists(DirectoryEntry entry, String parent, String file) { - ASSERT.that(entry.exists()).isTrue(); - ASSERT.that(entry.name()).isEqualTo(Name.simple(file)); - ASSERT.that(entry.directory()).isEqualTo(files.get(parent)); - ASSERT.that(entry.file()).isEqualTo(files.get(file)); + assertThat(entry.exists()).isTrue(); + assertThat(entry.name()).isEqualTo(Name.simple(file)); + assertThat(entry.directory()).isEqualTo(files.get(parent)); + assertThat(entry.file()).isEqualTo(files.get(file)); } private void assertParentExists(DirectoryEntry entry, String parent) { - ASSERT.that(entry.exists()).isFalse(); - ASSERT.that(entry.directory()).isEqualTo(files.get(parent)); + assertThat(entry.exists()).isFalse(); + assertThat(entry.directory()).isEqualTo(files.get(parent)); try { entry.file(); diff --git a/jimfs/src/test/java/com/google/common/jimfs/HeapDiskTest.java b/jimfs/src/test/java/com/google/common/jimfs/HeapDiskTest.java index 5f0caa0..85f3d52 100644 --- a/jimfs/src/test/java/com/google/common/jimfs/HeapDiskTest.java +++ b/jimfs/src/test/java/com/google/common/jimfs/HeapDiskTest.java @@ -16,7 +16,7 @@ package com.google.common.jimfs; -import static com.google.common.truth.Truth.ASSERT; +import static com.google.common.truth.Truth.assertThat; import static org.junit.Assert.fail; import org.junit.Before; @@ -48,10 +48,10 @@ public class HeapDiskTest { public void testInitialSettings_basic() { HeapDisk disk = new HeapDisk(8192, 100, 100); - ASSERT.that(disk.blockSize()).is(8192); - ASSERT.that(disk.getTotalSpace()).is(819200); - ASSERT.that(disk.getUnallocatedSpace()).is(819200); - ASSERT.that(disk.blockCache.blockCount()).is(0); + assertThat(disk.blockSize()).is(8192); + assertThat(disk.getTotalSpace()).is(819200); + assertThat(disk.getUnallocatedSpace()).is(819200); + assertThat(disk.blockCache.blockCount()).is(0); } @Test @@ -64,10 +64,10 @@ public class HeapDiskTest { HeapDisk disk = new HeapDisk(config); - ASSERT.that(disk.blockSize()).is(4); - ASSERT.that(disk.getTotalSpace()).is(96); - ASSERT.that(disk.getUnallocatedSpace()).is(96); - ASSERT.that(disk.blockCache.blockCount()).is(0); + assertThat(disk.blockSize()).is(4); + assertThat(disk.getTotalSpace()).is(96); + assertThat(disk.getUnallocatedSpace()).is(96); + assertThat(disk.blockCache.blockCount()).is(0); } @Test @@ -76,18 +76,18 @@ public class HeapDiskTest { disk.allocate(blocks, 1); - ASSERT.that(blocks.blockCount()).is(1); - ASSERT.that(blocks.getBlock(0).length).is(4); - ASSERT.that(disk.getUnallocatedSpace()).is(36); + assertThat(blocks.blockCount()).is(1); + assertThat(blocks.getBlock(0).length).is(4); + assertThat(disk.getUnallocatedSpace()).is(36); disk.allocate(blocks, 5); - ASSERT.that(blocks.blockCount()).is(6); + assertThat(blocks.blockCount()).is(6); for (int i = 0; i < blocks.blockCount(); i++) { - ASSERT.that(blocks.getBlock(i).length).is(4); + assertThat(blocks.getBlock(i).length).is(4); } - ASSERT.that(disk.getUnallocatedSpace()).is(16); - ASSERT.that(disk.blockCache.blockCount()).is(0); + assertThat(disk.getUnallocatedSpace()).is(16); + assertThat(disk.blockCache.blockCount()).is(0); } @Test @@ -97,15 +97,15 @@ public class HeapDiskTest { disk.free(blocks, 2); - ASSERT.that(blocks.blockCount()).is(4); - ASSERT.that(disk.getUnallocatedSpace()).is(24); - ASSERT.that(disk.blockCache.blockCount()).is(0); + assertThat(blocks.blockCount()).is(4); + assertThat(disk.getUnallocatedSpace()).is(24); + assertThat(disk.blockCache.blockCount()).is(0); disk.free(blocks); - ASSERT.that(blocks.blockCount()).is(0); - ASSERT.that(disk.getUnallocatedSpace()).is(40); - ASSERT.that(disk.blockCache.blockCount()).is(0); + assertThat(blocks.blockCount()).is(0); + assertThat(disk.getUnallocatedSpace()).is(40); + assertThat(disk.blockCache.blockCount()).is(0); } @Test @@ -115,15 +115,15 @@ public class HeapDiskTest { disk.free(blocks, 2); - ASSERT.that(blocks.blockCount()).is(4); - ASSERT.that(disk.getUnallocatedSpace()).is(24); - ASSERT.that(disk.blockCache.blockCount()).is(2); + assertThat(blocks.blockCount()).is(4); + assertThat(disk.getUnallocatedSpace()).is(24); + assertThat(disk.blockCache.blockCount()).is(2); disk.free(blocks); - ASSERT.that(blocks.blockCount()).is(0); - ASSERT.that(disk.getUnallocatedSpace()).is(40); - ASSERT.that(disk.blockCache.blockCount()).is(6); + assertThat(blocks.blockCount()).is(0); + assertThat(disk.getUnallocatedSpace()).is(40); + assertThat(disk.blockCache.blockCount()).is(6); } @Test @@ -133,15 +133,15 @@ public class HeapDiskTest { disk.free(blocks, 2); - ASSERT.that(blocks.blockCount()).is(4); - ASSERT.that(disk.getUnallocatedSpace()).is(24); - ASSERT.that(disk.blockCache.blockCount()).is(2); + assertThat(blocks.blockCount()).is(4); + assertThat(disk.getUnallocatedSpace()).is(24); + assertThat(disk.blockCache.blockCount()).is(2); disk.free(blocks); - ASSERT.that(blocks.blockCount()).is(0); - ASSERT.that(disk.getUnallocatedSpace()).is(40); - ASSERT.that(disk.blockCache.blockCount()).is(4); + assertThat(blocks.blockCount()).is(0); + assertThat(disk.getUnallocatedSpace()).is(40); + assertThat(disk.blockCache.blockCount()).is(4); } @Test @@ -149,12 +149,12 @@ public class HeapDiskTest { HeapDisk disk = new HeapDisk(4, 10, 10); disk.allocate(blocks, 10); - ASSERT.that(disk.getUnallocatedSpace()).is(0); + assertThat(disk.getUnallocatedSpace()).is(0); disk.free(blocks); - ASSERT.that(blocks.blockCount()).is(0); - ASSERT.that(disk.blockCache.blockCount()).is(10); + assertThat(blocks.blockCount()).is(0); + assertThat(disk.blockCache.blockCount()).is(10); List<byte[]> cachedBlocks = new ArrayList<>(); for (int i = 0; i < 10; i++) { @@ -163,12 +163,12 @@ public class HeapDiskTest { disk.allocate(blocks, 6); - ASSERT.that(blocks.blockCount()).is(6); - ASSERT.that(disk.blockCache.blockCount()).is(4); + assertThat(blocks.blockCount()).is(6); + assertThat(disk.blockCache.blockCount()).is(4); // the 6 arrays in blocks are the last 6 arrays that were cached for (int i = 0; i < 6; i++) { - ASSERT.that(blocks.getBlock(i)).isEqualTo(cachedBlocks.get(i + 4)); + assertThat(blocks.getBlock(i)).isEqualTo(cachedBlocks.get(i + 4)); } } @@ -177,12 +177,12 @@ public class HeapDiskTest { HeapDisk disk = new HeapDisk(4, 10, 4); disk.allocate(blocks, 10); - ASSERT.that(disk.getUnallocatedSpace()).is(0); + assertThat(disk.getUnallocatedSpace()).is(0); disk.free(blocks); - ASSERT.that(blocks.blockCount()).is(0); - ASSERT.that(disk.blockCache.blockCount()).is(4); + assertThat(blocks.blockCount()).is(0); + assertThat(disk.blockCache.blockCount()).is(4); List<byte[]> cachedBlocks = new ArrayList<>(); for (int i = 0; i < 4; i++) { @@ -191,12 +191,12 @@ public class HeapDiskTest { disk.allocate(blocks, 6); - ASSERT.that(blocks.blockCount()).is(6); - ASSERT.that(disk.blockCache.blockCount()).is(0); + assertThat(blocks.blockCount()).is(6); + assertThat(disk.blockCache.blockCount()).is(0); // the last 4 arrays in blocks are the 4 arrays that were cached for (int i = 2; i < 6; i++) { - ASSERT.that(blocks.getBlock(i)).isEqualTo(cachedBlocks.get(i - 2)); + assertThat(blocks.getBlock(i)).isEqualTo(cachedBlocks.get(i - 2)); } } @@ -223,6 +223,6 @@ public class HeapDiskTest { fail(); } catch (IOException expected) {} - ASSERT.that(blocks2.blockCount()).is(0); + assertThat(blocks2.blockCount()).is(0); } } diff --git a/jimfs/src/test/java/com/google/common/jimfs/JimfsInputStreamTest.java b/jimfs/src/test/java/com/google/common/jimfs/JimfsInputStreamTest.java index 170f3b8..291d312 100644 --- a/jimfs/src/test/java/com/google/common/jimfs/JimfsInputStreamTest.java +++ b/jimfs/src/test/java/com/google/common/jimfs/JimfsInputStreamTest.java @@ -18,7 +18,7 @@ package com.google.common.jimfs; import static com.google.common.jimfs.TestUtils.bytes; import static com.google.common.jimfs.TestUtils.regularFile; -import static com.google.common.truth.Truth.ASSERT; +import static com.google.common.truth.Truth.assertThat; import static org.junit.Assert.assertArrayEquals; import static org.junit.Assert.fail; @@ -42,7 +42,7 @@ public class JimfsInputStreamTest { @Test public void testRead_singleByte() throws IOException { JimfsInputStream in = newInputStream(2); - ASSERT.that(in.read()).is(2); + assertThat(in.read()).is(2); assertEmpty(in); } @@ -50,7 +50,7 @@ public class JimfsInputStreamTest { public void testRead_wholeArray() throws IOException { JimfsInputStream in = newInputStream(1, 2, 3, 4, 5, 6, 7, 8); byte[] bytes = new byte[8]; - ASSERT.that(in.read(bytes)).is(8); + assertThat(in.read(bytes)).is(8); assertArrayEquals(bytes(1, 2, 3, 4, 5, 6, 7, 8), bytes); assertEmpty(in); } @@ -59,7 +59,7 @@ public class JimfsInputStreamTest { public void testRead_wholeArray_arrayLarger() throws IOException { JimfsInputStream in = newInputStream(1, 2, 3, 4, 5, 6, 7, 8); byte[] bytes = new byte[12]; - ASSERT.that(in.read(bytes)).is(8); + assertThat(in.read(bytes)).is(8); assertArrayEquals(bytes(1, 2, 3, 4, 5, 6, 7, 8, 0, 0, 0, 0), bytes); assertEmpty(in); } @@ -68,10 +68,10 @@ public class JimfsInputStreamTest { public void testRead_wholeArray_arraySmaller() throws IOException { JimfsInputStream in = newInputStream(1, 2, 3, 4, 5, 6, 7, 8); byte[] bytes = new byte[6]; - ASSERT.that(in.read(bytes)).is(6); + assertThat(in.read(bytes)).is(6); assertArrayEquals(bytes(1, 2, 3, 4, 5, 6), bytes); bytes = new byte[6]; - ASSERT.that(in.read(bytes)).is(2); + assertThat(in.read(bytes)).is(2); assertArrayEquals(bytes(7, 8, 0, 0, 0, 0), bytes); assertEmpty(in); } @@ -80,7 +80,7 @@ public class JimfsInputStreamTest { public void testRead_partialArray() throws IOException { JimfsInputStream in = newInputStream(1, 2, 3, 4, 5, 6, 7, 8); byte[] bytes = new byte[12]; - ASSERT.that(in.read(bytes, 0, 8)).is(8); + assertThat(in.read(bytes, 0, 8)).is(8); assertArrayEquals(bytes(1, 2, 3, 4, 5, 6, 7, 8, 0, 0, 0, 0), bytes); assertEmpty(in); } @@ -89,7 +89,7 @@ public class JimfsInputStreamTest { public void testRead_partialArray_sliceLarger() throws IOException { JimfsInputStream in = newInputStream(1, 2, 3, 4, 5, 6, 7, 8); byte[] bytes = new byte[12]; - ASSERT.that(in.read(bytes, 0, 10)).is(8); + assertThat(in.read(bytes, 0, 10)).is(8); assertArrayEquals(bytes(1, 2, 3, 4, 5, 6, 7, 8, 0, 0, 0, 0), bytes); assertEmpty(in); } @@ -98,9 +98,9 @@ public class JimfsInputStreamTest { public void testRead_partialArray_sliceSmaller() throws IOException { JimfsInputStream in = newInputStream(1, 2, 3, 4, 5, 6, 7, 8); byte[] bytes = new byte[12]; - ASSERT.that(in.read(bytes, 0, 6)).is(6); + assertThat(in.read(bytes, 0, 6)).is(6); assertArrayEquals(bytes(1, 2, 3, 4, 5, 6, 0, 0, 0, 0, 0, 0), bytes); - ASSERT.that(in.read(bytes, 6, 6)).is(2); + assertThat(in.read(bytes, 6, 6)).is(2); assertArrayEquals(bytes(1, 2, 3, 4, 5, 6, 7, 8, 0, 0, 0, 0), bytes); assertEmpty(in); } @@ -131,36 +131,36 @@ public class JimfsInputStreamTest { @Test public void testAvailable() throws IOException { JimfsInputStream in = newInputStream(1, 2, 3, 4, 5, 6, 7, 8); - ASSERT.that(in.available()).is(8); - ASSERT.that(in.read()).is(1); - ASSERT.that(in.available()).is(7); - ASSERT.that(in.read(new byte[3])).is(3); - ASSERT.that(in.available()).is(4); - ASSERT.that(in.read(new byte[10], 1, 2)).is(2); - ASSERT.that(in.available()).is(2); - ASSERT.that(in.read(new byte[10])).is(2); - ASSERT.that(in.available()).is(0); + assertThat(in.available()).is(8); + assertThat(in.read()).is(1); + assertThat(in.available()).is(7); + assertThat(in.read(new byte[3])).is(3); + assertThat(in.available()).is(4); + assertThat(in.read(new byte[10], 1, 2)).is(2); + assertThat(in.available()).is(2); + assertThat(in.read(new byte[10])).is(2); + assertThat(in.available()).is(0); } @Test public void testSkip() throws IOException { JimfsInputStream in = newInputStream(1, 2, 3, 4, 5, 6, 7, 8); - ASSERT.that(in.skip(0)).is(0); - ASSERT.that(in.skip(-10)).is(0); - ASSERT.that(in.skip(2)).is(2); - ASSERT.that(in.read()).is(3); - ASSERT.that(in.skip(3)).is(3); - ASSERT.that(in.read()).is(7); - ASSERT.that(in.skip(10)).is(1); + assertThat(in.skip(0)).is(0); + assertThat(in.skip(-10)).is(0); + assertThat(in.skip(2)).is(2); + assertThat(in.read()).is(3); + assertThat(in.skip(3)).is(3); + assertThat(in.read()).is(7); + assertThat(in.skip(10)).is(1); assertEmpty(in); - ASSERT.that(in.skip(10)).is(0); + assertThat(in.skip(10)).is(0); assertEmpty(in); } @Test public void testFullyReadInputStream_doesNotChangeStateWhenStoreChanges() throws IOException { JimfsInputStream in = newInputStream(1, 2, 3, 4, 5); - ASSERT.that(in.read(new byte[5])).is(5); + assertThat(in.read(new byte[5])).is(5); assertEmpty(in); in.file.write(5, new byte[10], 0, 10); // append more bytes to file @@ -170,7 +170,7 @@ public class JimfsInputStreamTest { @Test public void testMark_unsupported() throws IOException { JimfsInputStream in = newInputStream(1, 2, 3); - ASSERT.that(in.markSupported()).isFalse(); + assertThat(in.markSupported()).isFalse(); // mark does nothing in.mark(1); @@ -233,9 +233,9 @@ public class JimfsInputStreamTest { } private static void assertEmpty(JimfsInputStream in) throws IOException { - ASSERT.that(in.read()).is(-1); - ASSERT.that(in.read(new byte[3])).is(-1); - ASSERT.that(in.read(new byte[10], 1, 5)).is(-1); - ASSERT.that(in.available()).is(0); + assertThat(in.read()).is(-1); + assertThat(in.read(new byte[3])).is(-1); + assertThat(in.read(new byte[10], 1, 5)).is(-1); + assertThat(in.available()).is(0); } } diff --git a/jimfs/src/test/java/com/google/common/jimfs/JimfsUnixLikeFileSystemTest.java b/jimfs/src/test/java/com/google/common/jimfs/JimfsUnixLikeFileSystemTest.java index de41cec..49950fe 100644 --- a/jimfs/src/test/java/com/google/common/jimfs/JimfsUnixLikeFileSystemTest.java +++ b/jimfs/src/test/java/com/google/common/jimfs/JimfsUnixLikeFileSystemTest.java @@ -20,7 +20,7 @@ import static com.google.common.jimfs.TestUtils.bytes; import static com.google.common.jimfs.TestUtils.permutations; import static com.google.common.jimfs.TestUtils.preFilledBytes; import static com.google.common.primitives.Bytes.concat; -import static com.google.common.truth.Truth.ASSERT; +import static com.google.common.truth.Truth.assert_; import static java.nio.charset.StandardCharsets.UTF_8; import static java.nio.file.LinkOption.NOFOLLOW_LINKS; import static java.nio.file.StandardCopyOption.ATOMIC_MOVE; @@ -123,44 +123,44 @@ public class JimfsUnixLikeFileSystemTest extends AbstractJimfsIntegrationTest { @Test public void testFileSystem() { - ASSERT.that(fs.getSeparator()).isEqualTo("/"); - ASSERT.that(fs.getRootDirectories()).iteratesAs(ImmutableSet.of(path("/"))); - ASSERT.that(fs.isOpen()).isTrue(); - ASSERT.that(fs.isReadOnly()).isFalse(); - ASSERT.that(fs.supportedFileAttributeViews()) + assert_().that(fs.getSeparator()).isEqualTo("/"); + assert_().that(fs.getRootDirectories()).iteratesAs(ImmutableSet.of(path("/"))); + assert_().that(fs.isOpen()).isTrue(); + assert_().that(fs.isReadOnly()).isFalse(); + assert_().that(fs.supportedFileAttributeViews()) .has().exactly("basic", "owner", "posix", "unix"); - ASSERT.that(fs.provider()).isA(JimfsFileSystemProvider.class); + assert_().that(fs.provider()).isA(JimfsFileSystemProvider.class); } @Test public void testFileStore() throws IOException { FileStore fileStore = Iterables.getOnlyElement(fs.getFileStores()); - ASSERT.that(fileStore.name()).isEqualTo("jimfs"); - ASSERT.that(fileStore.type()).isEqualTo("jimfs"); - ASSERT.that(fileStore.isReadOnly()).isFalse(); + assert_().that(fileStore.name()).isEqualTo("jimfs"); + assert_().that(fileStore.type()).isEqualTo("jimfs"); + assert_().that(fileStore.isReadOnly()).isFalse(); long totalSpace = 1024 * 1024 * 1024; // 1 GB - ASSERT.that(fileStore.getTotalSpace()).isEqualTo(totalSpace); - ASSERT.that(fileStore.getUnallocatedSpace()).isEqualTo(totalSpace); - ASSERT.that(fileStore.getUsableSpace()).isEqualTo(totalSpace); + assert_().that(fileStore.getTotalSpace()).isEqualTo(totalSpace); + assert_().that(fileStore.getUnallocatedSpace()).isEqualTo(totalSpace); + assert_().that(fileStore.getUsableSpace()).isEqualTo(totalSpace); Files.write(fs.getPath("/foo"), new byte[10000]); - ASSERT.that(fileStore.getTotalSpace()).isEqualTo(totalSpace); + assert_().that(fileStore.getTotalSpace()).isEqualTo(totalSpace); // We wrote 10000 bytes, but since the file system allocates fixed size blocks, more than 10k // bytes may have been allocated. As such, the unallocated space after the write can be at most // maxUnallocatedSpace. - ASSERT.that(fileStore.getUnallocatedSpace() <= totalSpace - 10000).isTrue(); + assert_().that(fileStore.getUnallocatedSpace() <= totalSpace - 10000).isTrue(); // Usable space is at most unallocated space. (In this case, it's currently exactly unallocated // space, but that's not required.) - ASSERT.that(fileStore.getUsableSpace() <= fileStore.getUnallocatedSpace()).isTrue(); + assert_().that(fileStore.getUsableSpace() <= fileStore.getUnallocatedSpace()).isTrue(); Files.delete(fs.getPath("/foo")); - ASSERT.that(fileStore.getTotalSpace()).isEqualTo(totalSpace); - ASSERT.that(fileStore.getUnallocatedSpace()).isEqualTo(totalSpace); - ASSERT.that(fileStore.getUsableSpace()).isEqualTo(totalSpace); + assert_().that(fileStore.getTotalSpace()).isEqualTo(totalSpace); + assert_().that(fileStore.getUnallocatedSpace()).isEqualTo(totalSpace); + assert_().that(fileStore.getUsableSpace()).isEqualTo(totalSpace); } @Test @@ -189,7 +189,7 @@ public class JimfsUnixLikeFileSystemTest extends AbstractJimfsIntegrationTest { Path p3 = path("c"); Path p4 = path("D"); - ASSERT.that(Ordering.natural().immutableSortedCopy(Arrays.asList(p3, p4, p1, p2))).isEqualTo( + assert_().that(Ordering.natural().immutableSortedCopy(Arrays.asList(p3, p4, p1, p2))).isEqualTo( ImmutableList.of(p2, p4, p1, p3)); // would be p1, p2, p3, p4 if sorting were case insensitive @@ -249,14 +249,14 @@ public class JimfsUnixLikeFileSystemTest extends AbstractJimfsIntegrationTest { @Test public void testPaths_startsWith_endsWith() { - ASSERT.that(path("/foo/bar").startsWith("/")).isTrue(); - ASSERT.that(path("/foo/bar").startsWith("/foo")).isTrue(); - ASSERT.that(path("/foo/bar").startsWith("/foo/bar")).isTrue(); - ASSERT.that(path("/foo/bar").endsWith("bar")).isTrue(); - ASSERT.that(path("/foo/bar").endsWith("foo/bar")).isTrue(); - ASSERT.that(path("/foo/bar").endsWith("/foo/bar")).isTrue(); - ASSERT.that(path("/foo/bar").endsWith("/foo")).isFalse(); - ASSERT.that(path("/foo/bar").startsWith("foo/bar")).isFalse(); + assert_().that(path("/foo/bar").startsWith("/")).isTrue(); + assert_().that(path("/foo/bar").startsWith("/foo")).isTrue(); + assert_().that(path("/foo/bar").startsWith("/foo/bar")).isTrue(); + assert_().that(path("/foo/bar").endsWith("bar")).isTrue(); + assert_().that(path("/foo/bar").endsWith("foo/bar")).isTrue(); + assert_().that(path("/foo/bar").endsWith("/foo/bar")).isTrue(); + assert_().that(path("/foo/bar").endsWith("/foo")).isFalse(); + assert_().that(path("/foo/bar").startsWith("foo/bar")).isFalse(); } @Test @@ -277,38 +277,38 @@ public class JimfsUnixLikeFileSystemTest extends AbstractJimfsIntegrationTest { Files.createDirectories(path("/foo/bar")); Files.createSymbolicLink(path("/link"), path("/")); - ASSERT.that(path("/link/foo/bar").toRealPath()).isEqualTo(path("/foo/bar")); + assert_().that(path("/link/foo/bar").toRealPath()).isEqualTo(path("/foo/bar")); - ASSERT.that(path("").toRealPath()).isEqualTo(path("/work")); - ASSERT.that(path(".").toRealPath()).isEqualTo(path("/work")); - ASSERT.that(path("..").toRealPath()).isEqualTo(path("/")); - ASSERT.that(path("../..").toRealPath()).isEqualTo(path("/")); - ASSERT.that(path("./.././..").toRealPath()).isEqualTo(path("/")); - ASSERT.that(path("./.././../.").toRealPath()).isEqualTo(path("/")); + assert_().that(path("").toRealPath()).isEqualTo(path("/work")); + assert_().that(path(".").toRealPath()).isEqualTo(path("/work")); + assert_().that(path("..").toRealPath()).isEqualTo(path("/")); + assert_().that(path("../..").toRealPath()).isEqualTo(path("/")); + assert_().that(path("./.././..").toRealPath()).isEqualTo(path("/")); + assert_().that(path("./.././../.").toRealPath()).isEqualTo(path("/")); } @Test public void testPaths_toUri() { - ASSERT.that(path("/").toUri()).is(URI.create("jimfs://unix/")); - ASSERT.that(path("/foo").toUri()).is(URI.create("jimfs://unix/foo")); - ASSERT.that(path("/foo/bar").toUri()).is(URI.create("jimfs://unix/foo/bar")); - ASSERT.that(path("foo").toUri()).is(URI.create("jimfs://unix/work/foo")); - ASSERT.that(path("foo/bar").toUri()).is(URI.create("jimfs://unix/work/foo/bar")); - ASSERT.that(path("").toUri()).is(URI.create("jimfs://unix/work")); - ASSERT.that(path("./../.").toUri()).is(URI.create("jimfs://unix/work/./../.")); + assert_().that(path("/").toUri()).is(URI.create("jimfs://unix/")); + assert_().that(path("/foo").toUri()).is(URI.create("jimfs://unix/foo")); + assert_().that(path("/foo/bar").toUri()).is(URI.create("jimfs://unix/foo/bar")); + assert_().that(path("foo").toUri()).is(URI.create("jimfs://unix/work/foo")); + assert_().that(path("foo/bar").toUri()).is(URI.create("jimfs://unix/work/foo/bar")); + assert_().that(path("").toUri()).is(URI.create("jimfs://unix/work")); + assert_().that(path("./../.").toUri()).is(URI.create("jimfs://unix/work/./../.")); } @Test public void testPaths_getFromUri() { - ASSERT.that(Paths.get(URI.create("jimfs://unix/"))) + assert_().that(Paths.get(URI.create("jimfs://unix/"))) .isEqualTo(path("/")); - ASSERT.that(Paths.get(URI.create("jimfs://unix/foo"))) + assert_().that(Paths.get(URI.create("jimfs://unix/foo"))) .isEqualTo(path("/foo")); - ASSERT.that(Paths.get(URI.create("jimfs://unix/foo%20bar"))) + assert_().that(Paths.get(URI.create("jimfs://unix/foo%20bar"))) .isEqualTo(path("/foo bar")); - ASSERT.that(Paths.get(URI.create("jimfs://unix/foo/./bar"))) + assert_().that(Paths.get(URI.create("jimfs://unix/foo/./bar"))) .isEqualTo(path("/foo/./bar")); - ASSERT.that(Paths.get(URI.create("jimfs://unix/foo/bar/"))) + assert_().that(Paths.get(URI.create("jimfs://unix/foo/bar/"))) .isEqualTo(path("/foo/bar")); } @@ -358,7 +358,7 @@ public class JimfsUnixLikeFileSystemTest extends AbstractJimfsIntegrationTest { fs.getPathMatcher("foo:foo"); fail(); } catch (UnsupportedOperationException expected) { - ASSERT.that(expected.getMessage()).contains("syntax"); + assert_().that(expected.getMessage()).contains("syntax"); } } @@ -581,7 +581,7 @@ public class JimfsUnixLikeFileSystemTest extends AbstractJimfsIntegrationTest { Files.createFile(path("/foo/bar/baz")); fail(); } catch (NoSuchFileException expected) { - ASSERT.that(expected.getFile()).isEqualTo("/foo/bar/baz"); + assert_().that(expected.getFile()).isEqualTo("/foo/bar/baz"); } } @@ -594,7 +594,7 @@ public class JimfsUnixLikeFileSystemTest extends AbstractJimfsIntegrationTest { Files.createFile(path("/foo/bar/baz/stuff")); fail(); } catch (NoSuchFileException expected) { - ASSERT.that(expected.getFile()).isEqualTo("/foo/bar/baz/stuff"); + assert_().that(expected.getFile()).isEqualTo("/foo/bar/baz/stuff"); } } @@ -607,7 +607,7 @@ public class JimfsUnixLikeFileSystemTest extends AbstractJimfsIntegrationTest { Files.createFile(path("/foo/bar/baz")); fail(); } catch (NoSuchFileException expected) { - ASSERT.that(expected.getFile()).isEqualTo("/foo/bar/baz"); + assert_().that(expected.getFile()).isEqualTo("/foo/bar/baz"); } } @@ -620,7 +620,7 @@ public class JimfsUnixLikeFileSystemTest extends AbstractJimfsIntegrationTest { Files.createFile(path("/foo/bar/baz/stuff")); fail(); } catch (NoSuchFileException expected) { - ASSERT.that(expected.getFile()).isEqualTo("/foo/bar/baz/stuff"); + assert_().that(expected.getFile()).isEqualTo("/foo/bar/baz/stuff"); } } @@ -634,7 +634,7 @@ public class JimfsUnixLikeFileSystemTest extends AbstractJimfsIntegrationTest { Files.createFile(path("/foo/bar/baz")); fail(); } catch (NoSuchFileException expected) { - ASSERT.that(expected.getFile()).isEqualTo("/foo/bar/baz"); + assert_().that(expected.getFile()).isEqualTo("/foo/bar/baz"); } } @@ -648,7 +648,7 @@ public class JimfsUnixLikeFileSystemTest extends AbstractJimfsIntegrationTest { Files.createFile(path("/foo/bar/baz/stuff")); fail(); } catch (NoSuchFileException expected) { - ASSERT.that(expected.getFile()).isEqualTo("/foo/bar/baz/stuff"); + assert_().that(expected.getFile()).isEqualTo("/foo/bar/baz/stuff"); } } @@ -890,7 +890,7 @@ public class JimfsUnixLikeFileSystemTest extends AbstractJimfsIntegrationTest { byte[] readBytes = new byte[4]; channel.read(ByteBuffer.wrap(readBytes)); - ASSERT.that(Bytes.asList(readBytes)).isEqualTo(Bytes.asList(bytes)); + assert_().that(Bytes.asList(readBytes)).isEqualTo(Bytes.asList(bytes)); } } @@ -955,16 +955,16 @@ public class JimfsUnixLikeFileSystemTest extends AbstractJimfsIntegrationTest { // non-CREATE mode Files.write(path("/foo"), preFilledBytes(10), WRITE); } catch (FileSystemException expected) { - ASSERT.that(expected.getFile()).isEqualTo("/foo"); - ASSERT.that(expected.getMessage()).contains("regular file"); + assert_().that(expected.getFile()).isEqualTo("/foo"); + assert_().that(expected.getMessage()).contains("regular file"); } try { // CREATE mode Files.write(path("/foo"), preFilledBytes(10)); } catch (FileSystemException expected) { - ASSERT.that(expected.getFile()).isEqualTo("/foo"); - ASSERT.that(expected.getMessage()).contains("regular file"); + assert_().that(expected.getFile()).isEqualTo("/foo"); + assert_().that(expected.getMessage()).contains("regular file"); } } @@ -1011,12 +1011,12 @@ public class JimfsUnixLikeFileSystemTest extends AbstractJimfsIntegrationTest { OutputStream out = Files.newOutputStream(foo, APPEND); FileChannel channel = FileChannel.open(foo, READ, WRITE); - ASSERT.that(channel.size()).isEqualTo(100L); + assert_().that(channel.size()).isEqualTo(100L); Files.delete(foo); assertThat("/foo").doesNotExist(); - ASSERT.that(channel.size()).isEqualTo(100L); + assert_().that(channel.size()).isEqualTo(100L); ByteBuffer buf = ByteBuffer.allocate(100); while (buf.hasRemaining()) { @@ -1028,9 +1028,9 @@ public class JimfsUnixLikeFileSystemTest extends AbstractJimfsIntegrationTest { byte[] moreBytes = {1, 2, 3, 4, 5}; out.write(moreBytes); - ASSERT.that(channel.size()).isEqualTo(105L); + assert_().that(channel.size()).isEqualTo(105L); buf.clear(); - ASSERT.that(channel.read(buf)).is(5); + assert_().that(channel.read(buf)).is(5); buf.flip(); byte[] b = new byte[5]; @@ -1095,14 +1095,14 @@ public class JimfsUnixLikeFileSystemTest extends AbstractJimfsIntegrationTest { Files.delete(path("/foo")); fail(); } catch (DirectoryNotEmptyException expected) { - ASSERT.that(expected.getFile()).isEqualTo("/foo"); + assert_().that(expected.getFile()).isEqualTo("/foo"); } try { Files.deleteIfExists(path("/foo")); fail(); } catch (DirectoryNotEmptyException expected) { - ASSERT.that(expected.getFile()).isEqualTo("/foo"); + assert_().that(expected.getFile()).isEqualTo("/foo"); } } @@ -1125,28 +1125,28 @@ public class JimfsUnixLikeFileSystemTest extends AbstractJimfsIntegrationTest { Files.delete(path("")); fail(); } catch (FileSystemException expected) { - ASSERT.that(expected.getFile()).isEqualTo(""); + assert_().that(expected.getFile()).isEqualTo(""); } try { Files.delete(path(".")); fail(); } catch (FileSystemException expected) { - ASSERT.that(expected.getFile()).isEqualTo("."); + assert_().that(expected.getFile()).isEqualTo("."); } try { Files.delete(path("../../work")); fail(); } catch (FileSystemException expected) { - ASSERT.that(expected.getFile()).isEqualTo("../../work"); + assert_().that(expected.getFile()).isEqualTo("../../work"); } try { Files.delete(path("./../work/.././../work/.")); fail(); } catch (FileSystemException expected) { - ASSERT.that(expected.getFile()).isEqualTo("./../work/.././../work/."); + assert_().that(expected.getFile()).isEqualTo("./../work/.././../work/."); } } @@ -1160,7 +1160,7 @@ public class JimfsUnixLikeFileSystemTest extends AbstractJimfsIntegrationTest { Files.delete(path("/")); fail(); } catch (IOException expected) { - ASSERT.that(expected.getMessage()).contains("root"); + assert_().that(expected.getMessage()).contains("root"); } Files.createDirectories(path("/foo/bar")); @@ -1169,14 +1169,14 @@ public class JimfsUnixLikeFileSystemTest extends AbstractJimfsIntegrationTest { Files.delete(path("/foo/bar/../..")); fail(); } catch (IOException expected) { - ASSERT.that(expected.getMessage()).contains("root"); + assert_().that(expected.getMessage()).contains("root"); } try { Files.delete(path("/foo/./../foo/bar/./../bar/.././../../..")); fail(); } catch (IOException expected) { - ASSERT.that(expected.getMessage()).contains("root"); + assert_().that(expected.getMessage()).contains("root"); } } @@ -1237,14 +1237,14 @@ public class JimfsUnixLikeFileSystemTest extends AbstractJimfsIntegrationTest { Files.createFile(path("/foo/bar/file")); fail(); } catch (IOException expected) { - ASSERT.that(expected.getMessage()).contains("symbolic link"); + assert_().that(expected.getMessage()).contains("symbolic link"); } try { Files.write(path("/foo/bar"), preFilledBytes(10)); fail(); } catch (IOException expected) { - ASSERT.that(expected.getMessage()).contains("symbolic link"); + assert_().that(expected.getMessage()).contains("symbolic link"); } } @@ -1524,7 +1524,7 @@ public class JimfsUnixLikeFileSystemTest extends AbstractJimfsIntegrationTest { FileTime.fromMillis(1000), FileTime.fromMillis(10000)); - ASSERT.that(Files.getAttribute(foo, "lastModifiedTime")).isEqualTo(FileTime.fromMillis(100)); + assert_().that(Files.getAttribute(foo, "lastModifiedTime")).isEqualTo(FileTime.fromMillis(100)); UserPrincipal zero = fs.getUserPrincipalLookupService().lookupPrincipalByName("zero"); Files.setAttribute(foo, "owner:owner", zero); @@ -1533,20 +1533,20 @@ public class JimfsUnixLikeFileSystemTest extends AbstractJimfsIntegrationTest { Files.copy(foo, bar, COPY_ATTRIBUTES); BasicFileAttributes attributes = Files.readAttributes(bar, BasicFileAttributes.class); - ASSERT.that(attributes.lastModifiedTime()).isEqualTo(FileTime.fromMillis(100)); - ASSERT.that(attributes.lastAccessTime()).isEqualTo(FileTime.fromMillis(1000)); - ASSERT.that(attributes.creationTime()).isEqualTo(FileTime.fromMillis(10000)); - ASSERT.that(Files.getAttribute(bar, "owner:owner")).isEqualTo(zero); + assert_().that(attributes.lastModifiedTime()).isEqualTo(FileTime.fromMillis(100)); + assert_().that(attributes.lastAccessTime()).isEqualTo(FileTime.fromMillis(1000)); + assert_().that(attributes.creationTime()).isEqualTo(FileTime.fromMillis(10000)); + assert_().that(Files.getAttribute(bar, "owner:owner")).isEqualTo(zero); Path baz = path("/baz"); Files.copy(foo, baz); // test that attributes are not copied when COPY_ATTRIBUTES is not specified attributes = Files.readAttributes(baz, BasicFileAttributes.class); - ASSERT.that(attributes.lastModifiedTime()).isNotEqualTo(FileTime.fromMillis(100)); - ASSERT.that(attributes.lastAccessTime()).isNotEqualTo(FileTime.fromMillis(1000)); - ASSERT.that(attributes.creationTime()).isNotEqualTo(FileTime.fromMillis(10000)); - ASSERT.that(Files.getAttribute(baz, "owner:owner")).isNotEqualTo(zero); + assert_().that(attributes.lastModifiedTime()).isNotEqualTo(FileTime.fromMillis(100)); + assert_().that(attributes.lastAccessTime()).isNotEqualTo(FileTime.fromMillis(1000)); + assert_().that(attributes.creationTime()).isNotEqualTo(FileTime.fromMillis(10000)); + assert_().that(Files.getAttribute(baz, "owner:owner")).isNotEqualTo(zero); } @Test @@ -1805,7 +1805,7 @@ public class JimfsUnixLikeFileSystemTest extends AbstractJimfsIntegrationTest { Files.move(path("/foo"), path("/foo/bar")); fail(); } catch (IOException expected) { - ASSERT.that(expected.getMessage()).contains("sub"); + assert_().that(expected.getMessage()).contains("sub"); } Files.createDirectories(path("/foo/bar/baz/stuff")); @@ -1816,7 +1816,7 @@ public class JimfsUnixLikeFileSystemTest extends AbstractJimfsIntegrationTest { Files.move(path("/foo/bar"), path("/hello/world/link/bar")); fail(); } catch (IOException expected) { - ASSERT.that(expected.getMessage()).contains("sub"); + assert_().that(expected.getMessage()).contains("sub"); } } @@ -1901,7 +1901,7 @@ public class JimfsUnixLikeFileSystemTest extends AbstractJimfsIntegrationTest { Path defaultFileSystemRoot = FileSystems.getDefault() .getRootDirectories().iterator().next(); - ASSERT.that(Files.isSameFile(path("/"), defaultFileSystemRoot)).isFalse(); + assert_().that(Files.isSameFile(path("/"), defaultFileSystemRoot)).isFalse(); } @Test @@ -1933,7 +1933,7 @@ public class JimfsUnixLikeFileSystemTest extends AbstractJimfsIntegrationTest { SecureDirectoryStream<Path> secureStream = (SecureDirectoryStream<Path>) stream; - ASSERT.that(ImmutableList.copyOf(secureStream)).isEqualTo( + assert_().that(ImmutableList.copyOf(secureStream)).isEqualTo( ImmutableList.of( path("/foo/a"), path("/foo/b"), path("/foo/bar"), path("/foo/barLink"))); @@ -1957,11 +1957,11 @@ public class JimfsUnixLikeFileSystemTest extends AbstractJimfsIntegrationTest { assertThat("/baz/stuff/b").doesNotExist(); assertThat("/baz/stuff").hasChildren("a", "bar", "barLink"); - ASSERT.that(secureStream.getFileAttributeView(BasicFileAttributeView.class) + assert_().that(secureStream.getFileAttributeView(BasicFileAttributeView.class) .readAttributes() .isDirectory()).isTrue(); - ASSERT.that(secureStream.getFileAttributeView(path("a"), BasicFileAttributeView.class) + assert_().that(secureStream.getFileAttributeView(path("a"), BasicFileAttributeView.class) .readAttributes() .isRegularFile()).isTrue(); @@ -1969,23 +1969,23 @@ public class JimfsUnixLikeFileSystemTest extends AbstractJimfsIntegrationTest { secureStream.deleteFile(path("bar")); fail(); } catch (FileSystemException expected) { - ASSERT.that(expected.getFile()).isEqualTo("bar"); + assert_().that(expected.getFile()).isEqualTo("bar"); } try { secureStream.deleteDirectory(path("a")); fail(); } catch (FileSystemException expected) { - ASSERT.that(expected.getFile()).isEqualTo("a"); + assert_().that(expected.getFile()).isEqualTo("a"); } try (SecureDirectoryStream<Path> barStream = secureStream.newDirectoryStream(path("bar"))) { barStream.newByteChannel(path("stuff"), ImmutableSet.of(WRITE, CREATE_NEW)).close(); - ASSERT.that(barStream.getFileAttributeView(path("stuff"), BasicFileAttributeView.class) + assert_().that(barStream.getFileAttributeView(path("stuff"), BasicFileAttributeView.class) .readAttributes() .isRegularFile()).isTrue(); - ASSERT.that(secureStream.getFileAttributeView( + assert_().that(secureStream.getFileAttributeView( path("bar/stuff"), BasicFileAttributeView.class) .readAttributes() .isRegularFile()).isTrue(); @@ -1993,12 +1993,12 @@ public class JimfsUnixLikeFileSystemTest extends AbstractJimfsIntegrationTest { try (SecureDirectoryStream<Path> barLinkStream = secureStream .newDirectoryStream(path("barLink"))) { - ASSERT.that(barLinkStream.getFileAttributeView( + assert_().that(barLinkStream.getFileAttributeView( path("stuff"), BasicFileAttributeView.class) .readAttributes() .isRegularFile()).isTrue(); - ASSERT.that(barLinkStream.getFileAttributeView( + assert_().that(barLinkStream.getFileAttributeView( path(".."), BasicFileAttributeView.class) .readAttributes() .isDirectory()).isTrue(); @@ -2008,7 +2008,7 @@ public class JimfsUnixLikeFileSystemTest extends AbstractJimfsIntegrationTest { secureStream.newDirectoryStream(path("barLink"), NOFOLLOW_LINKS); fail(); } catch (NotDirectoryException expected) { - ASSERT.that(expected.getFile()).isEqualTo("barLink"); + assert_().that(expected.getFile()).isEqualTo("barLink"); } try (SecureDirectoryStream<Path> barStream = secureStream.newDirectoryStream(path("bar"))) { @@ -2017,7 +2017,7 @@ public class JimfsUnixLikeFileSystemTest extends AbstractJimfsIntegrationTest { assertThat(path("/baz/stuff/a")).doesNotExist(); assertThat(path("/baz/stuff/bar/moved")).isRegularFile(); - ASSERT.that(barStream.getFileAttributeView(path("moved"), BasicFileAttributeView.class) + assert_().that(barStream.getFileAttributeView(path("moved"), BasicFileAttributeView.class) .readAttributes() .isRegularFile()).isTrue(); } @@ -2036,11 +2036,11 @@ public class JimfsUnixLikeFileSystemTest extends AbstractJimfsIntegrationTest { try (DirectoryStream<Path> stream = Files.newDirectoryStream(path("foo"))) { SecureDirectoryStream<Path> secureStream = (SecureDirectoryStream<Path>) stream; - ASSERT.that(ImmutableList.copyOf(secureStream)).has() + assert_().that(ImmutableList.copyOf(secureStream)).has() .exactly(path("foo/a"), path("foo/b"), path("foo/c")); try (DirectoryStream<Path> stream2 = secureStream.newDirectoryStream(path("c"))) { - ASSERT.that(ImmutableList.copyOf(stream2)).has() + assert_().that(ImmutableList.copyOf(stream2)).has() .exactly(path("foo/c/d"), path("foo/c/e")); } } @@ -2317,11 +2317,11 @@ public class JimfsUnixLikeFileSystemTest extends AbstractJimfsIntegrationTest { Files.createFile(bar); try (DirectoryStream<Path> stream = Files.newDirectoryStream(foo)) { - ASSERT.that(stream).isNotA(SecureDirectoryStream.class); + assert_().that(stream).isNotA(SecureDirectoryStream.class); } try (SeekableByteChannel channel = Files.newByteChannel(bar)) { - ASSERT.that(channel).isNotA(FileChannel.class); + assert_().that(channel).isNotA(FileChannel.class); } } } diff --git a/jimfs/src/test/java/com/google/common/jimfs/JimfsWindowsLikeFileSystemTest.java b/jimfs/src/test/java/com/google/common/jimfs/JimfsWindowsLikeFileSystemTest.java index 65ebd68..39a618c 100644 --- a/jimfs/src/test/java/com/google/common/jimfs/JimfsWindowsLikeFileSystemTest.java +++ b/jimfs/src/test/java/com/google/common/jimfs/JimfsWindowsLikeFileSystemTest.java @@ -16,7 +16,7 @@ package com.google.common.jimfs; -import static com.google.common.truth.Truth.ASSERT; +import static com.google.common.truth.Truth.assert_; import static java.nio.file.StandardCopyOption.REPLACE_EXISTING; import static org.junit.Assert.fail; @@ -56,13 +56,13 @@ public class JimfsWindowsLikeFileSystemTest extends AbstractJimfsIntegrationTest @Test public void testFileSystem() { - ASSERT.that(fs.getSeparator()).isEqualTo("\\"); - ASSERT.that(fs.getRootDirectories()).iteratesAs(ImmutableSet.of(path("C:\\"), path("E:\\"))); - ASSERT.that(fs.isOpen()).isTrue(); - ASSERT.that(fs.isReadOnly()).isFalse(); - ASSERT.that(fs.supportedFileAttributeViews()) + assert_().that(fs.getSeparator()).isEqualTo("\\"); + assert_().that(fs.getRootDirectories()).iteratesAs(ImmutableSet.of(path("C:\\"), path("E:\\"))); + assert_().that(fs.isOpen()).isTrue(); + assert_().that(fs.isReadOnly()).isFalse(); + assert_().that(fs.supportedFileAttributeViews()) .has().exactly("basic", "owner", "dos", "acl", "user"); - ASSERT.that(fs.provider()).isA(JimfsFileSystemProvider.class); + assert_().that(fs.provider()).isA(JimfsFileSystemProvider.class); } @Test @@ -92,7 +92,7 @@ public class JimfsWindowsLikeFileSystemTest extends AbstractJimfsIntegrationTest Path p3 = path("c"); Path p4 = path("D"); - ASSERT.that(Ordering.natural().immutableSortedCopy(Arrays.asList(p3, p4, p1, p2))).isEqualTo( + assert_().that(Ordering.natural().immutableSortedCopy(Arrays.asList(p3, p4, p1, p2))).isEqualTo( ImmutableList.of(p1, p2, p3, p4)); // would be p2, p4, p1, p3 if sorting were case sensitive @@ -170,14 +170,14 @@ public class JimfsWindowsLikeFileSystemTest extends AbstractJimfsIntegrationTest @Test public void testPaths_startsWith_endsWith() { - ASSERT.that(path("C:\\foo\\bar").startsWith("C:\\")).isTrue(); - ASSERT.that(path("C:\\foo\\bar").startsWith("C:\\foo")).isTrue(); - ASSERT.that(path("C:\\foo\\bar").startsWith("C:\\foo\\bar")).isTrue(); - ASSERT.that(path("C:\\foo\\bar").endsWith("bar")).isTrue(); - ASSERT.that(path("C:\\foo\\bar").endsWith("foo\\bar")).isTrue(); - ASSERT.that(path("C:\\foo\\bar").endsWith("C:\\foo\\bar")).isTrue(); - ASSERT.that(path("C:\\foo\\bar").endsWith("C:\\foo")).isFalse(); - ASSERT.that(path("C:\\foo\\bar").startsWith("foo\\bar")).isFalse(); + assert_().that(path("C:\\foo\\bar").startsWith("C:\\")).isTrue(); + assert_().that(path("C:\\foo\\bar").startsWith("C:\\foo")).isTrue(); + assert_().that(path("C:\\foo\\bar").startsWith("C:\\foo\\bar")).isTrue(); + assert_().that(path("C:\\foo\\bar").endsWith("bar")).isTrue(); + assert_().that(path("C:\\foo\\bar").endsWith("foo\\bar")).isTrue(); + assert_().that(path("C:\\foo\\bar").endsWith("C:\\foo\\bar")).isTrue(); + assert_().that(path("C:\\foo\\bar").endsWith("C:\\foo")).isFalse(); + assert_().that(path("C:\\foo\\bar").startsWith("foo\\bar")).isFalse(); } @Test @@ -198,62 +198,62 @@ public class JimfsWindowsLikeFileSystemTest extends AbstractJimfsIntegrationTest Files.createDirectories(path("C:\\foo\\bar")); Files.createSymbolicLink(path("C:\\link"), path("C:\\")); - ASSERT.that(path("C:\\link\\foo\\bar").toRealPath()).isEqualTo(path("C:\\foo\\bar")); + assert_().that(path("C:\\link\\foo\\bar").toRealPath()).isEqualTo(path("C:\\foo\\bar")); - ASSERT.that(path("").toRealPath()).isEqualTo(path("C:\\work")); - ASSERT.that(path(".").toRealPath()).isEqualTo(path("C:\\work")); - ASSERT.that(path("..").toRealPath()).isEqualTo(path("C:\\")); - ASSERT.that(path("..\\..").toRealPath()).isEqualTo(path("C:\\")); - ASSERT.that(path(".\\..\\.\\..").toRealPath()).isEqualTo(path("C:\\")); - ASSERT.that(path(".\\..\\.\\..\\.").toRealPath()).isEqualTo(path("C:\\")); + assert_().that(path("").toRealPath()).isEqualTo(path("C:\\work")); + assert_().that(path(".").toRealPath()).isEqualTo(path("C:\\work")); + assert_().that(path("..").toRealPath()).isEqualTo(path("C:\\")); + assert_().that(path("..\\..").toRealPath()).isEqualTo(path("C:\\")); + assert_().that(path(".\\..\\.\\..").toRealPath()).isEqualTo(path("C:\\")); + assert_().that(path(".\\..\\.\\..\\.").toRealPath()).isEqualTo(path("C:\\")); } @Test public void testPaths_toUri() { - ASSERT.that(fs.getPath("C:\\").toUri()).is(URI.create("jimfs://win/C:/")); - ASSERT.that(fs.getPath("C:\\foo").toUri()).is(URI.create("jimfs://win/C:/foo")); - ASSERT.that(fs.getPath("C:\\foo\\bar").toUri()).is(URI.create("jimfs://win/C:/foo/bar")); - ASSERT.that(fs.getPath("foo").toUri()).is(URI.create("jimfs://win/C:/work/foo")); - ASSERT.that(fs.getPath("foo\\bar").toUri()).is(URI.create("jimfs://win/C:/work/foo/bar")); - ASSERT.that(fs.getPath("").toUri()).is(URI.create("jimfs://win/C:/work")); - ASSERT.that(fs.getPath(".\\..\\.").toUri()).is(URI.create("jimfs://win/C:/work/./../.")); + assert_().that(fs.getPath("C:\\").toUri()).is(URI.create("jimfs://win/C:/")); + assert_().that(fs.getPath("C:\\foo").toUri()).is(URI.create("jimfs://win/C:/foo")); + assert_().that(fs.getPath("C:\\foo\\bar").toUri()).is(URI.create("jimfs://win/C:/foo/bar")); + assert_().that(fs.getPath("foo").toUri()).is(URI.create("jimfs://win/C:/work/foo")); + assert_().that(fs.getPath("foo\\bar").toUri()).is(URI.create("jimfs://win/C:/work/foo/bar")); + assert_().that(fs.getPath("").toUri()).is(URI.create("jimfs://win/C:/work")); + assert_().that(fs.getPath(".\\..\\.").toUri()).is(URI.create("jimfs://win/C:/work/./../.")); } @Test public void testPaths_toUri_unc() { - ASSERT.that(fs.getPath("\\\\host\\share\\").toUri()) + assert_().that(fs.getPath("\\\\host\\share\\").toUri()) .is(URI.create("jimfs://win//host/share/")); - ASSERT.that(fs.getPath("\\\\host\\share\\foo").toUri()) + assert_().that(fs.getPath("\\\\host\\share\\foo").toUri()) .is(URI.create("jimfs://win//host/share/foo")); - ASSERT.that(fs.getPath("\\\\host\\share\\foo\\bar").toUri()) + assert_().that(fs.getPath("\\\\host\\share\\foo\\bar").toUri()) .is(URI.create("jimfs://win//host/share/foo/bar")); } @Test public void testPaths_getFromUri() { - ASSERT.that(Paths.get(URI.create("jimfs://win/C:/"))) + assert_().that(Paths.get(URI.create("jimfs://win/C:/"))) .isEqualTo(fs.getPath("C:\\")); - ASSERT.that(Paths.get(URI.create("jimfs://win/C:/foo"))) + assert_().that(Paths.get(URI.create("jimfs://win/C:/foo"))) .isEqualTo(fs.getPath("C:\\foo")); - ASSERT.that(Paths.get(URI.create("jimfs://win/C:/foo%20bar"))) + assert_().that(Paths.get(URI.create("jimfs://win/C:/foo%20bar"))) .isEqualTo(fs.getPath("C:\\foo bar")); - ASSERT.that(Paths.get(URI.create("jimfs://win/C:/foo/./bar"))) + assert_().that(Paths.get(URI.create("jimfs://win/C:/foo/./bar"))) .isEqualTo(fs.getPath("C:\\foo\\.\\bar")); - ASSERT.that(Paths.get(URI.create("jimfs://win/C:/foo/bar/"))) + assert_().that(Paths.get(URI.create("jimfs://win/C:/foo/bar/"))) .isEqualTo(fs.getPath("C:\\foo\\bar")); } @Test public void testPaths_getFromUri_unc() { - ASSERT.that(Paths.get(URI.create("jimfs://win//host/share/"))) + assert_().that(Paths.get(URI.create("jimfs://win//host/share/"))) .isEqualTo(fs.getPath("\\\\host\\share\\")); - ASSERT.that(Paths.get(URI.create("jimfs://win//host/share/foo"))) + assert_().that(Paths.get(URI.create("jimfs://win//host/share/foo"))) .isEqualTo(fs.getPath("\\\\host\\share\\foo")); - ASSERT.that(Paths.get(URI.create("jimfs://win//host/share/foo%20bar"))) + assert_().that(Paths.get(URI.create("jimfs://win//host/share/foo%20bar"))) .isEqualTo(fs.getPath("\\\\host\\share\\foo bar")); - ASSERT.that(Paths.get(URI.create("jimfs://win//host/share/foo/./bar"))) + assert_().that(Paths.get(URI.create("jimfs://win//host/share/foo/./bar"))) .isEqualTo(fs.getPath("\\\\host\\share\\foo\\.\\bar")); - ASSERT.that(Paths.get(URI.create("jimfs://win//host/share/foo/bar/"))) + assert_().that(Paths.get(URI.create("jimfs://win//host/share/foo/bar/"))) .isEqualTo(fs.getPath("\\\\host\\share\\foo\\bar")); } @@ -371,8 +371,8 @@ public class JimfsWindowsLikeFileSystemTest extends AbstractJimfsIntegrationTest Files.delete(path("E:\\")); fail(); } catch (FileSystemException expected) { - ASSERT.that(expected.getFile()).isEqualTo("E:\\"); - ASSERT.that(expected.getMessage()).contains("root"); + assert_().that(expected.getFile()).isEqualTo("E:\\"); + assert_().that(expected.getMessage()).contains("root"); } } diff --git a/jimfs/src/test/java/com/google/common/jimfs/NameTest.java b/jimfs/src/test/java/com/google/common/jimfs/NameTest.java index d5d0168..1953076 100644 --- a/jimfs/src/test/java/com/google/common/jimfs/NameTest.java +++ b/jimfs/src/test/java/com/google/common/jimfs/NameTest.java @@ -16,7 +16,7 @@ package com.google.common.jimfs; -import static com.google.common.truth.Truth.ASSERT; +import static com.google.common.truth.Truth.assertThat; import org.junit.Test; import org.junit.runner.RunWith; @@ -32,10 +32,10 @@ public class NameTest { @Test public void testNames() { - ASSERT.that(Name.create("foo", "foo")).isEqualTo(Name.create("foo", "foo")); - ASSERT.that(Name.create("FOO", "foo")).isEqualTo(Name.create("foo", "foo")); - ASSERT.that(Name.create("FOO", "foo")).isNotEqualTo(Name.create("FOO", "FOO")); + assertThat(Name.create("foo", "foo")).isEqualTo(Name.create("foo", "foo")); + assertThat(Name.create("FOO", "foo")).isEqualTo(Name.create("foo", "foo")); + assertThat(Name.create("FOO", "foo")).isNotEqualTo(Name.create("FOO", "FOO")); - ASSERT.that(Name.create("a", "b").toString()).isEqualTo("a"); + assertThat(Name.create("a", "b").toString()).isEqualTo("a"); } } diff --git a/jimfs/src/test/java/com/google/common/jimfs/OwnerAttributeProviderTest.java b/jimfs/src/test/java/com/google/common/jimfs/OwnerAttributeProviderTest.java index 5844c57..eb81eb2 100644 --- a/jimfs/src/test/java/com/google/common/jimfs/OwnerAttributeProviderTest.java +++ b/jimfs/src/test/java/com/google/common/jimfs/OwnerAttributeProviderTest.java @@ -17,7 +17,7 @@ package com.google.common.jimfs; import static com.google.common.jimfs.UserLookupService.createUserPrincipal; -import static com.google.common.truth.Truth.ASSERT; +import static com.google.common.truth.Truth.assertThat; import com.google.common.collect.ImmutableSet; @@ -50,7 +50,7 @@ public class OwnerAttributeProviderTest extends @Test public void testInitialAttributes() { - ASSERT.that(provider.get(file, "owner")).isEqualTo(createUserPrincipal("user")); + assertThat(provider.get(file, "owner")).isEqualTo(createUserPrincipal("user")); } @Test @@ -65,13 +65,13 @@ public class OwnerAttributeProviderTest extends @Test public void testView() throws IOException { FileOwnerAttributeView view = provider.view(fileLookup(), NO_INHERITED_VIEWS); - ASSERT.that(view).isNotNull(); + assertThat(view).isNotNull(); - ASSERT.that(view.name()).isEqualTo("owner"); - ASSERT.that(view.getOwner()).isEqualTo(createUserPrincipal("user")); + assertThat(view.name()).isEqualTo("owner"); + assertThat(view.getOwner()).isEqualTo(createUserPrincipal("user")); view.setOwner(createUserPrincipal("root")); - ASSERT.that(view.getOwner()).isEqualTo(createUserPrincipal("root")); - ASSERT.that(file.getAttribute("owner", "owner")).isEqualTo(createUserPrincipal("root")); + assertThat(view.getOwner()).isEqualTo(createUserPrincipal("root")); + assertThat(file.getAttribute("owner", "owner")).isEqualTo(createUserPrincipal("root")); } } diff --git a/jimfs/src/test/java/com/google/common/jimfs/PathServiceTest.java b/jimfs/src/test/java/com/google/common/jimfs/PathServiceTest.java index 8b544a1..f77b72b 100644 --- a/jimfs/src/test/java/com/google/common/jimfs/PathServiceTest.java +++ b/jimfs/src/test/java/com/google/common/jimfs/PathServiceTest.java @@ -17,7 +17,8 @@ package com.google.common.jimfs; import static com.google.common.jimfs.PathSubject.paths; -import static com.google.common.truth.Truth.ASSERT; +import static com.google.common.truth.Truth.assertThat; +import static com.google.common.truth.Truth.assert_; import com.google.common.collect.ImmutableList; import com.google.common.collect.ImmutableSet; @@ -44,33 +45,33 @@ public class PathServiceTest { @Test public void testBasicProperties() { - ASSERT.that(service.getSeparator()).isEqualTo("/"); - ASSERT.that(fakeWindowsPathService().getSeparator()).isEqualTo("\\"); + assertThat(service.getSeparator()).isEqualTo("/"); + assertThat(fakeWindowsPathService().getSeparator()).isEqualTo("\\"); } @Test public void testPathCreation() { - ASSERT.about(paths()).that(service.emptyPath()) + assert_().about(paths()).that(service.emptyPath()) .hasRootComponent(null).and() .hasNameComponents(""); - ASSERT.about(paths()).that(service.createRoot(service.name("/"))) + assert_().about(paths()).that(service.createRoot(service.name("/"))) .isAbsolute().and() .hasRootComponent("/").and() .hasNoNameComponents(); - ASSERT.about(paths()).that(service.createFileName(service.name("foo"))) + assert_().about(paths()).that(service.createFileName(service.name("foo"))) .hasRootComponent(null).and() .hasNameComponents("foo"); JimfsPath relative = service.createRelativePath(service.names(ImmutableList.of("foo", "bar"))); - ASSERT.about(paths()).that(relative) + assert_().about(paths()).that(relative) .hasRootComponent(null).and() .hasNameComponents("foo", "bar"); JimfsPath absolute = service.createPath( service.name("/"), service.names(ImmutableList.of("foo", "bar"))); - ASSERT.about(paths()).that(absolute) + assert_().about(paths()).that(absolute) .isAbsolute().and() .hasRootComponent("/").and() .hasNameComponents("foo", "bar"); @@ -79,7 +80,7 @@ public class PathServiceTest { @Test public void testPathCreation_emptyPath() { // normalized to empty path with single empty string name - ASSERT.about(paths()).that(service.createPath(null, ImmutableList.<Name>of())) + assert_().about(paths()).that(service.createPath(null, ImmutableList.<Name>of())) .hasRootComponent(null).and() .hasNameComponents(""); } @@ -88,7 +89,7 @@ public class PathServiceTest { public void testPathCreation_parseIgnoresEmptyString() { // if the empty string wasn't ignored, the resulting path would be "/foo" since the empty // string would be joined with foo - ASSERT.about(paths()).that(service.parsePath("", "foo")) + assert_().about(paths()).that(service.parsePath("", "foo")) .hasRootComponent(null).and() .hasNameComponents("foo"); } @@ -98,10 +99,10 @@ public class PathServiceTest { // not much to test for this since it just delegates to PathType anyway JimfsPath path = new JimfsPath( service, null, ImmutableList.of(Name.simple("foo"), Name.simple("bar"))); - ASSERT.that(service.toString(path)).isEqualTo("foo/bar"); + assertThat(service.toString(path)).isEqualTo("foo/bar"); path = new JimfsPath(service, Name.simple("/"), ImmutableList.of(Name.simple("foo"))); - ASSERT.that(service.toString(path)).isEqualTo("/foo"); + assertThat(service.toString(path)).isEqualTo("/foo"); } @Test @@ -115,8 +116,8 @@ public class PathServiceTest { JimfsPath path3 = new JimfsPath(pathService, null, ImmutableList.of(Name.create("FOO", "9874238974897189741"))); - ASSERT.that(pathService.hash(path1)).isEqualTo(pathService.hash(path2)); - ASSERT.that(pathService.hash(path2)).isEqualTo(pathService.hash(path3)); + assertThat(pathService.hash(path1)).isEqualTo(pathService.hash(path2)); + assertThat(pathService.hash(path2)).isEqualTo(pathService.hash(path3)); } @Test @@ -130,8 +131,8 @@ public class PathServiceTest { JimfsPath path3 = new JimfsPath(pathService, null, ImmutableList.of(Name.create("28937497189478912374897", "foo"))); - ASSERT.that(pathService.hash(path1)).isEqualTo(pathService.hash(path2)); - ASSERT.that(pathService.hash(path2)).isEqualTo(pathService.hash(path3)); + assertThat(pathService.hash(path1)).isEqualTo(pathService.hash(path2)); + assertThat(pathService.hash(path2)).isEqualTo(pathService.hash(path3)); } @Test @@ -142,8 +143,8 @@ public class PathServiceTest { JimfsPath path2 = new JimfsPath(pathService, null, ImmutableList.of(Name.create("b", "y"))); JimfsPath path3 = new JimfsPath(pathService, null, ImmutableList.of(Name.create("c", "x"))); - ASSERT.that(pathService.compare(path1, path2)).is(-1); - ASSERT.that(pathService.compare(path2, path3)).is(-1); + assertThat(pathService.compare(path1, path2)).is(-1); + assertThat(pathService.compare(path2, path3)).is(-1); } @Test @@ -154,14 +155,14 @@ public class PathServiceTest { JimfsPath path2 = new JimfsPath(pathService, null, ImmutableList.of(Name.create("b", "y"))); JimfsPath path3 = new JimfsPath(pathService, null, ImmutableList.of(Name.create("c", "x"))); - ASSERT.that(pathService.compare(path1, path2)).is(1); - ASSERT.that(pathService.compare(path2, path3)).is(1); + assertThat(pathService.compare(path1, path2)).is(1); + assertThat(pathService.compare(path2, path3)).is(1); } @Test public void testPathMatcher() { - ASSERT.that(service.createPathMatcher("regex:foo")).isA(PathMatchers.RegexPathMatcher.class); - ASSERT.that(service.createPathMatcher("glob:foo")).isA(PathMatchers.RegexPathMatcher.class); + assertThat(service.createPathMatcher("regex:foo")).isA(PathMatchers.RegexPathMatcher.class); + assertThat(service.createPathMatcher("glob:foo")).isA(PathMatchers.RegexPathMatcher.class); } public static PathService fakeUnixPathService() { diff --git a/jimfs/src/test/java/com/google/common/jimfs/PathTypeTest.java b/jimfs/src/test/java/com/google/common/jimfs/PathTypeTest.java index 37cf3ca..784a1a5 100644 --- a/jimfs/src/test/java/com/google/common/jimfs/PathTypeTest.java +++ b/jimfs/src/test/java/com/google/common/jimfs/PathTypeTest.java @@ -18,7 +18,7 @@ package com.google.common.jimfs; import static com.google.common.base.Preconditions.checkArgument; import static com.google.common.jimfs.PathType.ParseResult; -import static com.google.common.truth.Truth.ASSERT; +import static com.google.common.truth.Truth.assertThat; import com.google.common.collect.ImmutableList; @@ -43,8 +43,8 @@ public class PathTypeTest { @Test public void testBasicProperties() { - ASSERT.that(type.getSeparator()).isEqualTo("/"); - ASSERT.that(type.getOtherSeparators()).isEqualTo("\\"); + assertThat(type.getSeparator()).isEqualTo("/"); + assertThat(type.getOtherSeparators()).isEqualTo("\\"); } @Test @@ -59,29 +59,29 @@ public class PathTypeTest { @Test public void testToString() { ParseResult path = type.parsePath("foo/bar\\baz"); - ASSERT.that(type.toString(path.root(), path.names())).isEqualTo("foo/bar/baz"); + assertThat(type.toString(path.root(), path.names())).isEqualTo("foo/bar/baz"); ParseResult path2 = type.parsePath("$/foo/bar"); - ASSERT.that(type.toString(path2.root(), path2.names())).isEqualTo("$foo/bar"); + assertThat(type.toString(path2.root(), path2.names())).isEqualTo("$foo/bar"); } @Test public void testToUri() { URI fileUri = type.toUri(fileSystemUri, "$", ImmutableList.of("foo", "bar")); - ASSERT.that(fileUri.toString()).is("jimfs://foo/$/foo/bar"); - ASSERT.that(fileUri.getPath()).isEqualTo("/$/foo/bar"); + assertThat(fileUri.toString()).is("jimfs://foo/$/foo/bar"); + assertThat(fileUri.getPath()).isEqualTo("/$/foo/bar"); URI rootUri = type.toUri(fileSystemUri, "$", ImmutableList.<String>of()); - ASSERT.that(rootUri.toString()).is("jimfs://foo/$"); - ASSERT.that(rootUri.getPath()).isEqualTo("/$"); + assertThat(rootUri.toString()).is("jimfs://foo/$"); + assertThat(rootUri.getPath()).isEqualTo("/$"); } @Test public void testToUri_escaping() { URI fileUri = type.toUri(fileSystemUri, "$", ImmutableList.of("foo", "bar baz")); - ASSERT.that(fileUri.toString()).is("jimfs://foo/$/foo/bar%20baz"); - ASSERT.that(fileUri.getRawPath()).isEqualTo("/$/foo/bar%20baz"); - ASSERT.that(fileUri.getPath()).isEqualTo("/$/foo/bar baz"); + assertThat(fileUri.toString()).is("jimfs://foo/$/foo/bar%20baz"); + assertThat(fileUri.getRawPath()).isEqualTo("/$/foo/bar%20baz"); + assertThat(fileUri.getPath()).isEqualTo("/$/foo/bar baz"); } @Test @@ -95,16 +95,16 @@ public class PathTypeTest { static void assertParseResult( ParseResult result, @Nullable String root, String... names) { - ASSERT.that(result.root()).isEqualTo(root); - ASSERT.that(result.names()).iteratesAs((Object[]) names); + assertThat(result.root()).isEqualTo(root); + assertThat(result.names()).iteratesAs((Object[]) names); } static void assertUriRoundTripsCorrectly(PathType type, String path) { ParseResult result = type.parsePath(path); URI uri = type.toUri(fileSystemUri, result.root(), result.names()); ParseResult parsedUri = type.fromUri(uri); - ASSERT.that(parsedUri.root()).isEqualTo(result.root()); - ASSERT.that(parsedUri.names()).iteratesAs(result.names()); + assertThat(parsedUri.root()).isEqualTo(result.root()); + assertThat(parsedUri.names()).iteratesAs(result.names()); } /** diff --git a/jimfs/src/test/java/com/google/common/jimfs/PollingWatchServiceTest.java b/jimfs/src/test/java/com/google/common/jimfs/PollingWatchServiceTest.java index dba5218..eee1241 100644 --- a/jimfs/src/test/java/com/google/common/jimfs/PollingWatchServiceTest.java +++ b/jimfs/src/test/java/com/google/common/jimfs/PollingWatchServiceTest.java @@ -16,7 +16,7 @@ package com.google.common.jimfs; -import static com.google.common.truth.Truth.ASSERT; +import static com.google.common.truth.Truth.assertThat; import static java.nio.file.StandardWatchEventKinds.ENTRY_CREATE; import static java.nio.file.StandardWatchEventKinds.ENTRY_DELETE; import static java.nio.file.StandardWatchEventKinds.ENTRY_MODIFY; @@ -71,16 +71,16 @@ public class PollingWatchServiceTest { @Test public void testNewWatcher() { - ASSERT.that(watcher.isOpen()).isTrue(); - ASSERT.that(watcher.isPolling()).isFalse(); + assertThat(watcher.isOpen()).isTrue(); + assertThat(watcher.isPolling()).isFalse(); } @Test public void testRegister() throws IOException { Key key = watcher.register(createDirectory(), ImmutableList.of(ENTRY_CREATE)); - ASSERT.that(key.isValid()).isTrue(); + assertThat(key.isValid()).isTrue(); - ASSERT.that(watcher.isPolling()).isTrue(); + assertThat(watcher.isPolling()).isTrue(); } @Test @@ -107,22 +107,22 @@ public class PollingWatchServiceTest { public void testCancellingLastKeyStopsPolling() throws IOException { Key key = watcher.register(createDirectory(), ImmutableList.of(ENTRY_CREATE)); key.cancel(); - ASSERT.that(key.isValid()).isFalse(); + assertThat(key.isValid()).isFalse(); - ASSERT.that(watcher.isPolling()).isFalse(); + assertThat(watcher.isPolling()).isFalse(); Key key2 = watcher.register(createDirectory(), ImmutableList.of(ENTRY_CREATE)); Key key3 = watcher.register(createDirectory(), ImmutableList.of(ENTRY_DELETE)); - ASSERT.that(watcher.isPolling()).isTrue(); + assertThat(watcher.isPolling()).isTrue(); key2.cancel(); - ASSERT.that(watcher.isPolling()).isTrue(); + assertThat(watcher.isPolling()).isTrue(); key3.cancel(); - ASSERT.that(watcher.isPolling()).isFalse(); + assertThat(watcher.isPolling()).isFalse(); } @Test @@ -130,15 +130,15 @@ public class PollingWatchServiceTest { Key key1 = watcher.register(createDirectory(), ImmutableList.of(ENTRY_CREATE)); Key key2 = watcher.register(createDirectory(), ImmutableList.of(ENTRY_DELETE)); - ASSERT.that(key1.isValid()).isTrue(); - ASSERT.that(key2.isValid()).isTrue(); - ASSERT.that(watcher.isPolling()).isTrue(); + assertThat(key1.isValid()).isTrue(); + assertThat(key2.isValid()).isTrue(); + assertThat(watcher.isPolling()).isTrue(); watcher.close(); - ASSERT.that(key1.isValid()).isFalse(); - ASSERT.that(key2.isValid()).isFalse(); - ASSERT.that(watcher.isPolling()).isFalse(); + assertThat(key1.isValid()).isFalse(); + assertThat(key2.isValid()).isFalse(); + assertThat(watcher.isPolling()).isFalse(); } @Test(timeout = 200) @@ -200,9 +200,9 @@ public class PollingWatchServiceTest { WatchKey key = watcher.take(); List<WatchEvent<?>> keyEvents = key.pollEvents(); if (keyEvents.size() == 1) { - ASSERT.that(keyEvents).has().exactly(new Event<>(ENTRY_DELETE, 1, fs.getPath("foo"))); + assertThat(keyEvents).has().exactly(new Event<>(ENTRY_DELETE, 1, fs.getPath("foo"))); } else { - ASSERT.that(keyEvents).has().exactlyAs(Arrays.<WatchEvent<?>>asList( + assertThat(keyEvents).has().exactlyAs(Arrays.<WatchEvent<?>>asList( new Event<>(ENTRY_MODIFY, 1, fs.getPath("foo")), new Event<>(ENTRY_DELETE, 1, fs.getPath("foo")))); } @@ -213,7 +213,7 @@ public class PollingWatchServiceTest { ensureTimeToPoll(); // otherwise we could read 1 event but not all the events we're expecting WatchKey key = watcher.take(); List<WatchEvent<?>> keyEvents = key.pollEvents(); - ASSERT.that(keyEvents).has().exactlyAs(Arrays.<WatchEvent<?>>asList(events)); + assertThat(keyEvents).has().exactlyAs(Arrays.<WatchEvent<?>>asList(events)); key.reset(); } diff --git a/jimfs/src/test/java/com/google/common/jimfs/PosixAttributeProviderTest.java b/jimfs/src/test/java/com/google/common/jimfs/PosixAttributeProviderTest.java index c3b39c1..3d38bad 100644 --- a/jimfs/src/test/java/com/google/common/jimfs/PosixAttributeProviderTest.java +++ b/jimfs/src/test/java/com/google/common/jimfs/PosixAttributeProviderTest.java @@ -18,7 +18,7 @@ package com.google.common.jimfs; import static com.google.common.jimfs.UserLookupService.createGroupPrincipal; import static com.google.common.jimfs.UserLookupService.createUserPrincipal; -import static com.google.common.truth.Truth.ASSERT; +import static com.google.common.truth.Truth.assertThat; import static org.junit.Assert.assertNotNull; import com.google.common.collect.ImmutableList; @@ -89,35 +89,35 @@ public class PosixAttributeProviderTest extends "owner", new OwnerAttributeProvider().view(fileLookup(), NO_INHERITED_VIEWS))); assertNotNull(view); - ASSERT.that(view.name()).isEqualTo("posix"); - ASSERT.that(view.getOwner()).isEqualTo(createUserPrincipal("user")); + assertThat(view.name()).isEqualTo("posix"); + assertThat(view.getOwner()).isEqualTo(createUserPrincipal("user")); PosixFileAttributes attrs = view.readAttributes(); - ASSERT.that(attrs.fileKey()).isEqualTo(0); - ASSERT.that(attrs.owner()).isEqualTo(createUserPrincipal("user")); - ASSERT.that(attrs.group()).isEqualTo(createGroupPrincipal("group")); - ASSERT.that(attrs.permissions()).isEqualTo(PosixFilePermissions.fromString("rw-r--r--")); + assertThat(attrs.fileKey()).isEqualTo(0); + assertThat(attrs.owner()).isEqualTo(createUserPrincipal("user")); + assertThat(attrs.group()).isEqualTo(createGroupPrincipal("group")); + assertThat(attrs.permissions()).isEqualTo(PosixFilePermissions.fromString("rw-r--r--")); view.setOwner(createUserPrincipal("root")); - ASSERT.that(view.getOwner()).isEqualTo(createUserPrincipal("root")); - ASSERT.that(file.getAttribute("owner", "owner")).isEqualTo(createUserPrincipal("root")); + assertThat(view.getOwner()).isEqualTo(createUserPrincipal("root")); + assertThat(file.getAttribute("owner", "owner")).isEqualTo(createUserPrincipal("root")); view.setGroup(createGroupPrincipal("root")); - ASSERT.that(view.readAttributes().group()).isEqualTo(createGroupPrincipal("root")); - ASSERT.that(file.getAttribute("posix", "group")).isEqualTo(createGroupPrincipal("root")); + assertThat(view.readAttributes().group()).isEqualTo(createGroupPrincipal("root")); + assertThat(file.getAttribute("posix", "group")).isEqualTo(createGroupPrincipal("root")); view.setPermissions(PosixFilePermissions.fromString("rwx------")); - ASSERT.that(view.readAttributes().permissions()).isEqualTo( + assertThat(view.readAttributes().permissions()).isEqualTo( PosixFilePermissions.fromString("rwx------")); - ASSERT.that(file.getAttribute("posix", "permissions")).isEqualTo( + assertThat(file.getAttribute("posix", "permissions")).isEqualTo( PosixFilePermissions.fromString("rwx------")); } @Test public void testAttributes() { PosixFileAttributes attrs = provider.readAttributes(file); - ASSERT.that(attrs.permissions()).isEqualTo(PosixFilePermissions.fromString("rw-r--r--")); - ASSERT.that(attrs.group()).isEqualTo(createGroupPrincipal("group")); - ASSERT.that(attrs.fileKey()).isEqualTo(0); + assertThat(attrs.permissions()).isEqualTo(PosixFilePermissions.fromString("rw-r--r--")); + assertThat(attrs.group()).isEqualTo(createGroupPrincipal("group")); + assertThat(attrs.fileKey()).isEqualTo(0); } } diff --git a/jimfs/src/test/java/com/google/common/jimfs/RegularFileBlocksTest.java b/jimfs/src/test/java/com/google/common/jimfs/RegularFileBlocksTest.java index e5cb154..b1c13e3 100644 --- a/jimfs/src/test/java/com/google/common/jimfs/RegularFileBlocksTest.java +++ b/jimfs/src/test/java/com/google/common/jimfs/RegularFileBlocksTest.java @@ -16,7 +16,7 @@ package com.google.common.jimfs; -import static com.google.common.truth.Truth.ASSERT; +import static com.google.common.truth.Truth.assertThat; import com.google.common.primitives.Bytes; @@ -46,25 +46,25 @@ public class RegularFileBlocksTest { @Test public void testInitialState() { - ASSERT.that(file.blockCount()).is(0); + assertThat(file.blockCount()).is(0); // no bounds checking, but there should never be a block at an index >= size - ASSERT.that(file.getBlock(0)).isNull(); + assertThat(file.getBlock(0)).isNull(); } @Test public void testAddAndGet() { file.addBlock(new byte[] {1}); - ASSERT.that(file.blockCount()).is(1); - ASSERT.that(Bytes.asList(file.getBlock(0))).isEqualTo(Bytes.asList(new byte[] {1})); - ASSERT.that(file.getBlock(1)).isNull(); + assertThat(file.blockCount()).is(1); + assertThat(Bytes.asList(file.getBlock(0))).isEqualTo(Bytes.asList(new byte[] {1})); + assertThat(file.getBlock(1)).isNull(); file.addBlock(new byte[] {1, 2}); - ASSERT.that(file.blockCount()).is(2); - ASSERT.that(Bytes.asList(file.getBlock(1))).isEqualTo(Bytes.asList(new byte[] {1, 2})); - ASSERT.that(file.getBlock(2)).isNull(); + assertThat(file.blockCount()).is(2); + assertThat(Bytes.asList(file.getBlock(1))).isEqualTo(Bytes.asList(new byte[] {1, 2})); + assertThat(file.getBlock(2)).isNull(); } @Test @@ -74,18 +74,18 @@ public class RegularFileBlocksTest { file.addBlock(new byte[0]); file.addBlock(new byte[0]); - ASSERT.that(file.blockCount()).is(4); + assertThat(file.blockCount()).is(4); file.truncateBlocks(2); - ASSERT.that(file.blockCount()).is(2); - ASSERT.that(file.getBlock(2)).isNull(); - ASSERT.that(file.getBlock(3)).isNull(); - ASSERT.that(file.getBlock(0)).isNotNull(); + assertThat(file.blockCount()).is(2); + assertThat(file.getBlock(2)).isNull(); + assertThat(file.getBlock(3)).isNull(); + assertThat(file.getBlock(0)).isNotNull(); file.truncateBlocks(0); - ASSERT.that(file.blockCount()).is(0); - ASSERT.that(file.getBlock(0)).isNull(); + assertThat(file.blockCount()).is(0); + assertThat(file.getBlock(0)).isNull(); } @Test @@ -94,25 +94,25 @@ public class RegularFileBlocksTest { file.addBlock(new byte[] {1, 2}); RegularFile other = createFile(); - ASSERT.that(other.blockCount()).is(0); + assertThat(other.blockCount()).is(0); file.copyBlocksTo(other, 2); - ASSERT.that(other.blockCount()).is(2); - ASSERT.that(other.getBlock(0)).isEqualTo(file.getBlock(0)); - ASSERT.that(other.getBlock(1)).isEqualTo(file.getBlock(1)); + assertThat(other.blockCount()).is(2); + assertThat(other.getBlock(0)).isEqualTo(file.getBlock(0)); + assertThat(other.getBlock(1)).isEqualTo(file.getBlock(1)); file.copyBlocksTo(other, 1); // should copy the last block - ASSERT.that(other.blockCount()).is(3); - ASSERT.that(other.getBlock(2)).isEqualTo(file.getBlock(1)); + assertThat(other.blockCount()).is(3); + assertThat(other.getBlock(2)).isEqualTo(file.getBlock(1)); other.copyBlocksTo(file, 3); - ASSERT.that(file.blockCount()).is(5); - ASSERT.that(file.getBlock(2)).isEqualTo(other.getBlock(0)); - ASSERT.that(file.getBlock(3)).isEqualTo(other.getBlock(1)); - ASSERT.that(file.getBlock(4)).isEqualTo(other.getBlock(2)); + assertThat(file.blockCount()).is(5); + assertThat(file.getBlock(2)).isEqualTo(other.getBlock(0)); + assertThat(file.getBlock(3)).isEqualTo(other.getBlock(1)); + assertThat(file.getBlock(4)).isEqualTo(other.getBlock(2)); } @Test @@ -122,25 +122,25 @@ public class RegularFileBlocksTest { file.addBlock(new byte[] {1, 2, 3}); RegularFile other = createFile(); - ASSERT.that(file.blockCount()).is(3); - ASSERT.that(other.blockCount()).is(0); + assertThat(file.blockCount()).is(3); + assertThat(other.blockCount()).is(0); file.transferBlocksTo(other, 3); - ASSERT.that(file.blockCount()).is(0); - ASSERT.that(other.blockCount()).is(3); + assertThat(file.blockCount()).is(0); + assertThat(other.blockCount()).is(3); - ASSERT.that(file.getBlock(0)).isNull(); - ASSERT.that(Bytes.asList(other.getBlock(0))).isEqualTo(Bytes.asList(new byte[] {1})); - ASSERT.that(Bytes.asList(other.getBlock(1))).isEqualTo(Bytes.asList(new byte[] {1, 2})); - ASSERT.that(Bytes.asList(other.getBlock(2))).isEqualTo(Bytes.asList(new byte[] {1, 2, 3})); + assertThat(file.getBlock(0)).isNull(); + assertThat(Bytes.asList(other.getBlock(0))).isEqualTo(Bytes.asList(new byte[] {1})); + assertThat(Bytes.asList(other.getBlock(1))).isEqualTo(Bytes.asList(new byte[] {1, 2})); + assertThat(Bytes.asList(other.getBlock(2))).isEqualTo(Bytes.asList(new byte[] {1, 2, 3})); other.transferBlocksTo(file, 1); - ASSERT.that(file.blockCount()).is(1); - ASSERT.that(other.blockCount()).is(2); - ASSERT.that(other.getBlock(2)).isNull(); - ASSERT.that(Bytes.asList(file.getBlock(0))).isEqualTo(Bytes.asList(new byte[]{1, 2, 3})); - ASSERT.that(file.getBlock(1)).isNull(); + assertThat(file.blockCount()).is(1); + assertThat(other.blockCount()).is(2); + assertThat(other.getBlock(2)).isNull(); + assertThat(Bytes.asList(file.getBlock(0))).isEqualTo(Bytes.asList(new byte[]{1, 2, 3})); + assertThat(file.getBlock(1)).isNull(); } } diff --git a/jimfs/src/test/java/com/google/common/jimfs/UnixAttributeProviderTest.java b/jimfs/src/test/java/com/google/common/jimfs/UnixAttributeProviderTest.java index 385697e..3887cb1 100644 --- a/jimfs/src/test/java/com/google/common/jimfs/UnixAttributeProviderTest.java +++ b/jimfs/src/test/java/com/google/common/jimfs/UnixAttributeProviderTest.java @@ -18,7 +18,7 @@ package com.google.common.jimfs; import static com.google.common.jimfs.UserLookupService.createGroupPrincipal; import static com.google.common.jimfs.UserLookupService.createUserPrincipal; -import static com.google.common.truth.Truth.ASSERT; +import static com.google.common.truth.Truth.assertThat; import com.google.common.collect.ImmutableSet; @@ -63,24 +63,24 @@ public class UnixAttributeProviderTest extends // these are pretty much meaningless here since they aren't properties this // file system actually has, so don't really care about the exact value of these - ASSERT.that(provider.get(file, "uid")).isA(Integer.class); - ASSERT.that(provider.get(file, "gid")).isA(Integer.class); - ASSERT.that(provider.get(file, "rdev")).isEqualTo(0L); - ASSERT.that(provider.get(file, "dev")).isEqualTo(1L); - ASSERT.that(provider.get(file, "ino")).isA(Integer.class); + assertThat(provider.get(file, "uid")).isA(Integer.class); + assertThat(provider.get(file, "gid")).isA(Integer.class); + assertThat(provider.get(file, "rdev")).isEqualTo(0L); + assertThat(provider.get(file, "dev")).isEqualTo(1L); + assertThat(provider.get(file, "ino")).isA(Integer.class); // these have logical origins in attributes from other views - ASSERT.that(provider.get(file, "mode")).isEqualTo(0644); // rw-r--r-- - ASSERT.that(provider.get(file, "ctime")) + assertThat(provider.get(file, "mode")).isEqualTo(0644); // rw-r--r-- + assertThat(provider.get(file, "ctime")) .isEqualTo(FileTime.fromMillis(file.getCreationTime())); // this is based on a property this file system does actually have - ASSERT.that(provider.get(file, "nlink")).isEqualTo(1); + assertThat(provider.get(file, "nlink")).isEqualTo(1); file.incrementLinkCount(); - ASSERT.that(provider.get(file, "nlink")).isEqualTo(2); + assertThat(provider.get(file, "nlink")).isEqualTo(2); file.decrementLinkCount(); - ASSERT.that(provider.get(file, "nlink")).isEqualTo(1); + assertThat(provider.get(file, "nlink")).isEqualTo(1); } @Test diff --git a/jimfs/src/test/java/com/google/common/jimfs/UnixPathTypeTest.java b/jimfs/src/test/java/com/google/common/jimfs/UnixPathTypeTest.java index 1e3fca5..6d6c3d2 100644 --- a/jimfs/src/test/java/com/google/common/jimfs/UnixPathTypeTest.java +++ b/jimfs/src/test/java/com/google/common/jimfs/UnixPathTypeTest.java @@ -19,7 +19,7 @@ package com.google.common.jimfs; import static com.google.common.jimfs.PathTypeTest.assertParseResult; import static com.google.common.jimfs.PathTypeTest.assertUriRoundTripsCorrectly; import static com.google.common.jimfs.PathTypeTest.fileSystemUri; -import static com.google.common.truth.Truth.ASSERT; +import static com.google.common.truth.Truth.assertThat; import static org.junit.Assert.assertEquals; import static org.junit.Assert.fail; @@ -43,36 +43,36 @@ public class UnixPathTypeTest { @Test public void testUnix() { PathType unix = PathType.unix(); - ASSERT.that(unix.getSeparator()).isEqualTo("/"); - ASSERT.that(unix.getOtherSeparators()).isEqualTo(""); + assertThat(unix.getSeparator()).isEqualTo("/"); + assertThat(unix.getOtherSeparators()).isEqualTo(""); // "//foo/bar" is what will be passed to parsePath if "/", "foo", "bar" is passed to getPath PathType.ParseResult path = unix.parsePath("//foo/bar"); assertParseResult(path, "/", "foo", "bar"); - ASSERT.that(unix.toString(path.root(), path.names())).isEqualTo("/foo/bar"); + assertThat(unix.toString(path.root(), path.names())).isEqualTo("/foo/bar"); PathType.ParseResult path2 = unix.parsePath("foo/bar/"); assertParseResult(path2, null, "foo", "bar"); - ASSERT.that(unix.toString(path2.root(), path2.names())).isEqualTo("foo/bar"); + assertThat(unix.toString(path2.root(), path2.names())).isEqualTo("foo/bar"); } @Test public void testUnix_toUri() { URI fileUri = PathType.unix().toUri(fileSystemUri, "/", ImmutableList.of("foo", "bar")); - ASSERT.that(fileUri.toString()).is("jimfs://foo/foo/bar"); - ASSERT.that(fileUri.getPath()).isEqualTo("/foo/bar"); + assertThat(fileUri.toString()).is("jimfs://foo/foo/bar"); + assertThat(fileUri.getPath()).isEqualTo("/foo/bar"); URI rootUri = PathType.unix().toUri(fileSystemUri, "/", ImmutableList.<String>of()); - ASSERT.that(rootUri.toString()).is("jimfs://foo/"); - ASSERT.that(rootUri.getPath()).isEqualTo("/"); + assertThat(rootUri.toString()).is("jimfs://foo/"); + assertThat(rootUri.getPath()).isEqualTo("/"); } @Test public void testUnix_toUri_escaping() { URI uri = PathType.unix().toUri(fileSystemUri, "/", ImmutableList.of("foo bar")); - ASSERT.that(uri.toString()).is("jimfs://foo/foo%20bar"); - ASSERT.that(uri.getRawPath()).isEqualTo("/foo%20bar"); - ASSERT.that(uri.getPath()).isEqualTo("/foo bar"); + assertThat(uri.toString()).is("jimfs://foo/foo%20bar"); + assertThat(uri.getRawPath()).isEqualTo("/foo%20bar"); + assertThat(uri.getPath()).isEqualTo("/foo bar"); } @Test diff --git a/jimfs/src/test/java/com/google/common/jimfs/UserDefinedAttributeProviderTest.java b/jimfs/src/test/java/com/google/common/jimfs/UserDefinedAttributeProviderTest.java index 3731c93..56e1816 100644 --- a/jimfs/src/test/java/com/google/common/jimfs/UserDefinedAttributeProviderTest.java +++ b/jimfs/src/test/java/com/google/common/jimfs/UserDefinedAttributeProviderTest.java @@ -16,7 +16,7 @@ package com.google.common.jimfs; -import static com.google.common.truth.Truth.ASSERT; +import static com.google.common.truth.Truth.assertThat; import static org.junit.Assert.assertNotNull; import static org.junit.Assert.fail; @@ -55,8 +55,8 @@ public class UserDefinedAttributeProviderTest @Test public void testInitialAttributes() { // no initial attributes - ASSERT.that(ImmutableList.copyOf(file.getAttributeKeys())).isEmpty(); - ASSERT.that(provider.attributes(file)).isEmpty(); + assertThat(ImmutableList.copyOf(file.getAttributeKeys())).isEmpty(); + assertThat(provider.attributes(file)).isEmpty(); } @Test @@ -67,12 +67,12 @@ public class UserDefinedAttributeProviderTest byte[] one = (byte[]) provider.get(file, "one"); byte[] two = (byte[]) provider.get(file, "two"); - ASSERT.that(Arrays.equals(one, bytes)).isTrue(); - ASSERT.that(Arrays.equals(two, bytes)).isTrue(); + assertThat(Arrays.equals(one, bytes)).isTrue(); + assertThat(Arrays.equals(two, bytes)).isTrue(); assertSetFails("foo", "hello"); - ASSERT.that(provider.attributes(file)).has().exactly("one", "two"); + assertThat(provider.attributes(file)).has().exactly("one", "two"); } @Test @@ -85,8 +85,8 @@ public class UserDefinedAttributeProviderTest UserDefinedFileAttributeView view = provider.view(fileLookup(), NO_INHERITED_VIEWS); assertNotNull(view); - ASSERT.that(view.name()).isEqualTo("user"); - ASSERT.that(view.list()).isEmpty(); + assertThat(view.name()).isEqualTo("user"); + assertThat(view.list()).isEmpty(); byte[] b1 = {0, 1, 2}; byte[] b2 = {0, 1, 2, 3, 4}; @@ -94,11 +94,11 @@ public class UserDefinedAttributeProviderTest view.write("b1", ByteBuffer.wrap(b1)); view.write("b2", ByteBuffer.wrap(b2)); - ASSERT.that(view.list()).has().allOf("b1", "b2"); - ASSERT.that(file.getAttributeKeys()).has().exactly("user:b1", "user:b2"); + assertThat(view.list()).has().allOf("b1", "b2"); + assertThat(file.getAttributeKeys()).has().exactly("user:b1", "user:b2"); - ASSERT.that(view.size("b1")).is(3); - ASSERT.that(view.size("b2")).is(5); + assertThat(view.size("b1")).is(3); + assertThat(view.size("b2")).is(5); ByteBuffer buf1 = ByteBuffer.allocate(view.size("b1")); ByteBuffer buf2 = ByteBuffer.allocate(view.size("b2")); @@ -106,30 +106,30 @@ public class UserDefinedAttributeProviderTest view.read("b1", buf1); view.read("b2", buf2); - ASSERT.that(Arrays.equals(b1, buf1.array())).isTrue(); - ASSERT.that(Arrays.equals(b2, buf2.array())).isTrue(); + assertThat(Arrays.equals(b1, buf1.array())).isTrue(); + assertThat(Arrays.equals(b2, buf2.array())).isTrue(); view.delete("b2"); - ASSERT.that(view.list()).has().exactly("b1"); - ASSERT.that(file.getAttributeKeys()).has().exactly("user:b1"); + assertThat(view.list()).has().exactly("b1"); + assertThat(file.getAttributeKeys()).has().exactly("user:b1"); try { view.size("b2"); fail(); } catch (IllegalArgumentException expected) { - ASSERT.that(expected.getMessage()).contains("not set"); + assertThat(expected.getMessage()).contains("not set"); } try { view.read("b2", ByteBuffer.allocate(10)); fail(); } catch (IllegalArgumentException expected) { - ASSERT.that(expected.getMessage()).contains("not set"); + assertThat(expected.getMessage()).contains("not set"); } view.write("b1", ByteBuffer.wrap(b2)); - ASSERT.that(view.size("b1")).is(5); + assertThat(view.size("b1")).is(5); view.delete("b2"); // succeeds } diff --git a/jimfs/src/test/java/com/google/common/jimfs/UserLookupServiceTest.java b/jimfs/src/test/java/com/google/common/jimfs/UserLookupServiceTest.java index 9101eb1..23bfc9e 100644 --- a/jimfs/src/test/java/com/google/common/jimfs/UserLookupServiceTest.java +++ b/jimfs/src/test/java/com/google/common/jimfs/UserLookupServiceTest.java @@ -16,7 +16,7 @@ package com.google.common.jimfs; -import static com.google.common.truth.Truth.ASSERT; +import static com.google.common.truth.Truth.assertThat; import static org.junit.Assert.fail; import org.junit.Test; @@ -44,15 +44,15 @@ public class UserLookupServiceTest { UserPrincipal bob2 = service.lookupPrincipalByName("bob"); UserPrincipal alice = service.lookupPrincipalByName("alice"); - ASSERT.that(bob1).isEqualTo(bob2); - ASSERT.that(bob1).isNotEqualTo(alice); + assertThat(bob1).isEqualTo(bob2); + assertThat(bob1).isNotEqualTo(alice); GroupPrincipal group1 = service.lookupPrincipalByGroupName("group"); GroupPrincipal group2 = service.lookupPrincipalByGroupName("group"); GroupPrincipal foo = service.lookupPrincipalByGroupName("foo"); - ASSERT.that(group1).isEqualTo(group2); - ASSERT.that(group1).isNotEqualTo(foo); + assertThat(group1).isEqualTo(group2); + assertThat(group1).isNotEqualTo(foo); } @Test @@ -63,7 +63,7 @@ public class UserLookupServiceTest { service.lookupPrincipalByGroupName("group"); fail(); } catch (UserPrincipalNotFoundException expected) { - ASSERT.that(expected.getName()).isEqualTo("group"); + assertThat(expected.getName()).isEqualTo("group"); } } } diff --git a/jimfs/src/test/java/com/google/common/jimfs/WindowsPathTypeTest.java b/jimfs/src/test/java/com/google/common/jimfs/WindowsPathTypeTest.java index 40ae9ba..3d18285 100644 --- a/jimfs/src/test/java/com/google/common/jimfs/WindowsPathTypeTest.java +++ b/jimfs/src/test/java/com/google/common/jimfs/WindowsPathTypeTest.java @@ -20,7 +20,7 @@ import static com.google.common.jimfs.PathType.windows; import static com.google.common.jimfs.PathTypeTest.assertParseResult; import static com.google.common.jimfs.PathTypeTest.assertUriRoundTripsCorrectly; import static com.google.common.jimfs.PathTypeTest.fileSystemUri; -import static com.google.common.truth.Truth.ASSERT; +import static com.google.common.truth.Truth.assertThat; import static org.junit.Assert.fail; import com.google.common.collect.ImmutableList; @@ -43,21 +43,21 @@ public class WindowsPathTypeTest { @Test public void testWindows() { PathType windows = PathType.windows(); - ASSERT.that(windows.getSeparator()).isEqualTo("\\"); - ASSERT.that(windows.getOtherSeparators()).isEqualTo("/"); + assertThat(windows.getSeparator()).isEqualTo("\\"); + assertThat(windows.getOtherSeparators()).isEqualTo("/"); // "C:\\foo\bar" results from "C:\", "foo", "bar" passed to getPath PathType.ParseResult path = windows.parsePath("C:\\\\foo\\bar"); assertParseResult(path, "C:\\", "foo", "bar"); - ASSERT.that(windows.toString(path.root(), path.names())).isEqualTo("C:\\foo\\bar"); + assertThat(windows.toString(path.root(), path.names())).isEqualTo("C:\\foo\\bar"); PathType.ParseResult path2 = windows.parsePath("foo/bar/"); assertParseResult(path2, null, "foo", "bar"); - ASSERT.that(windows.toString(path2.root(), path2.names())).isEqualTo("foo\\bar"); + assertThat(windows.toString(path2.root(), path2.names())).isEqualTo("foo\\bar"); PathType.ParseResult path3 = windows.parsePath("hello world/foo/bar"); assertParseResult(path3, null, "hello world", "foo", "bar"); - ASSERT.that(windows.toString(null, path3.names())).isEqualTo("hello world\\foo\\bar"); + assertThat(windows.toString(null, path3.names())).isEqualTo("hello world\\foo\\bar"); } @Test @@ -103,32 +103,32 @@ public class WindowsPathTypeTest { windows.parsePath("\\\\"); fail(); } catch (InvalidPathException expected) { - ASSERT.that(expected.getInput()).isEqualTo("\\\\"); - ASSERT.that(expected.getReason()).isEqualTo("UNC path is missing hostname"); + assertThat(expected.getInput()).isEqualTo("\\\\"); + assertThat(expected.getReason()).isEqualTo("UNC path is missing hostname"); } try { windows.parsePath("\\\\host"); fail(); } catch (InvalidPathException expected) { - ASSERT.that(expected.getInput()).isEqualTo("\\\\host"); - ASSERT.that(expected.getReason()).isEqualTo("UNC path is missing sharename"); + assertThat(expected.getInput()).isEqualTo("\\\\host"); + assertThat(expected.getReason()).isEqualTo("UNC path is missing sharename"); } try { windows.parsePath("\\\\host\\"); fail(); } catch (InvalidPathException expected) { - ASSERT.that(expected.getInput()).isEqualTo("\\\\host\\"); - ASSERT.that(expected.getReason()).isEqualTo("UNC path is missing sharename"); + assertThat(expected.getInput()).isEqualTo("\\\\host\\"); + assertThat(expected.getReason()).isEqualTo("UNC path is missing sharename"); } try { windows.parsePath("//host"); fail(); } catch (InvalidPathException expected) { - ASSERT.that(expected.getInput()).is("//host"); - ASSERT.that(expected.getReason()).isEqualTo("UNC path is missing sharename"); + assertThat(expected.getInput()).is("//host"); + assertThat(expected.getReason()).isEqualTo("UNC path is missing sharename"); } } @@ -162,34 +162,34 @@ public class WindowsPathTypeTest { @Test public void testWindows_toUri_normal() { URI fileUri = PathType.windows().toUri(fileSystemUri, "C:\\", ImmutableList.of("foo", "bar")); - ASSERT.that(fileUri.toString()).is("jimfs://foo/C:/foo/bar"); - ASSERT.that(fileUri.getPath()).isEqualTo("/C:/foo/bar"); + assertThat(fileUri.toString()).is("jimfs://foo/C:/foo/bar"); + assertThat(fileUri.getPath()).isEqualTo("/C:/foo/bar"); URI rootUri = PathType.windows().toUri(fileSystemUri, "C:\\", ImmutableList.<String>of()); - ASSERT.that(rootUri.toString()).is("jimfs://foo/C:/"); - ASSERT.that(rootUri.getPath()).isEqualTo("/C:/"); + assertThat(rootUri.toString()).is("jimfs://foo/C:/"); + assertThat(rootUri.getPath()).isEqualTo("/C:/"); } @Test public void testWindows_toUri_unc() { URI fileUri = PathType.windows() .toUri(fileSystemUri, "\\\\host\\share\\", ImmutableList.of("foo", "bar")); - ASSERT.that(fileUri.toString()).is("jimfs://foo//host/share/foo/bar"); - ASSERT.that(fileUri.getPath()).is("//host/share/foo/bar"); + assertThat(fileUri.toString()).is("jimfs://foo//host/share/foo/bar"); + assertThat(fileUri.getPath()).is("//host/share/foo/bar"); URI rootUri = PathType.windows() .toUri(fileSystemUri, "\\\\host\\share\\", ImmutableList.<String>of()); - ASSERT.that(rootUri.toString()).is("jimfs://foo//host/share/"); - ASSERT.that(rootUri.getPath()).is("//host/share/"); + assertThat(rootUri.toString()).is("jimfs://foo//host/share/"); + assertThat(rootUri.getPath()).is("//host/share/"); } @Test public void testWindows_toUri_escaping() { URI uri = PathType.windows() .toUri(fileSystemUri, "C:\\", ImmutableList.of("Users", "foo", "My Documents")); - ASSERT.that(uri.toString()).is("jimfs://foo/C:/Users/foo/My%20Documents"); - ASSERT.that(uri.getRawPath()).isEqualTo("/C:/Users/foo/My%20Documents"); - ASSERT.that(uri.getPath()).isEqualTo("/C:/Users/foo/My Documents"); + assertThat(uri.toString()).is("jimfs://foo/C:/Users/foo/My%20Documents"); + assertThat(uri.getRawPath()).isEqualTo("/C:/Users/foo/My%20Documents"); + assertThat(uri.getPath()).isEqualTo("/C:/Users/foo/My Documents"); } @Test |