
import jcifs.smb.NtlmPasswordAuthentication;
import jcifs.smb.SmbFile;
import junit.framework.TestCase;

public class SmbFileTests extends TestCase {

	@Override
	protected void setUp() throws Exception {
		super.setUp();
	}

	@Override
	protected void tearDown() throws Exception {
		super.tearDown();
	}

	public void testUsersCanNotSeeEachOther() throws Exception {

		SmbFile userAShares = new SmbFile("smb://localhost/",
				new NtlmPasswordAuthentication("", "userA", "password"));
		for (SmbFile share : userAShares.listFiles()) {
			assertTrue("userA can't see userB", !share.getCanonicalPath()
					.contains("userB"));
		}
		SmbFile userBShares = new SmbFile("smb://localhost/",
				new NtlmPasswordAuthentication("", "userB", "password"));
		for (SmbFile share : userBShares.listFiles()) {
			assertTrue("userB can't see userA", !share.getCanonicalPath()
					.contains("userA"));
		}
	}
}