@Test public void MockTrashTest() throws IOException { FileSystem fs = mock(FileSystem.class); Path homeDirectory = new Path("/home/directory"); when(fs.getHomeDirectory()).thenReturn(homeDirectory); when(fs.makeQualified(any(Path.class))).thenAnswer(new Answer<Path>() { @Override public Path answer(InvocationOnMock invocation) throws Throwable { return (Path) invocation.getArguments()[0]; } }); Trash trash = new MockTrash(fs, new Properties(), "user"); Assert.assertTrue(trash.moveToTrash(new Path("/some/path"))); verify(fs).getHomeDirectory(); verify(fs).makeQualified(any(Path.class)); verifyNoMoreInteractions(fs); }
public MockTrash(FileSystem fs, Properties props, String user) throws IOException { super(fs, props, user); }
MockTrash extends ProxiedTrash { public MockTrash(FileSystem fs, Properties props, String user) throws IOException { super(fs, props, user); } }
MockTrash extends ProxiedTrash { public MockTrash(FileSystem fs, Properties props, String user) throws IOException { super(fs, props, user); } MockTrash(FileSystem fs, Properties props, String user); }
MockTrash extends ProxiedTrash { public MockTrash(FileSystem fs, Properties props, String user) throws IOException { super(fs, props, user); } MockTrash(FileSystem fs, Properties props, String user); @Override boolean moveToTrash(Path path); @Override void createTrashSnapshot(); @Override void purgeTrashSnapshots(); }
MockTrash extends ProxiedTrash { public MockTrash(FileSystem fs, Properties props, String user) throws IOException { super(fs, props, user); } MockTrash(FileSystem fs, Properties props, String user); @Override boolean moveToTrash(Path path); @Override void createTrashSnapshot(); @Override void purgeTrashSnapshots();  }