Skip to content
Snippets Groups Projects

Update BoundaryTests.java

Open Xi Chen requested to merge XCC2/swen90006-a1-2019:patch-2 into master
1 file
+ 33
19
Compare changes
  • Side-by-side
  • Inline
package swen90006.passbook;
import java.util.List;
import java.util.ArrayList;
import java.nio.charset.Charset;
import java.nio.file.Path;
import java.nio.file.Files;
import java.nio.file.FileSystems;
import static org.junit.Assert.assertTrue;
import static org.junit.jupiter.api.Assertions.assertThrows;
import org.junit.*;
import static org.junit.Assert.*;
import java.net.MalformedURLException;
import java.net.URL;
import org.junit.Test;
//By extending PartitioningTests, we inherit tests from the script
public class BoundaryTests
extends PartitioningTests
{
//Add another test
@Test public void anotherTEst()
{
//include a message for better feedback
final int expected = 2;
final int actual = 2;
assertEquals("Some failure message", expected, actual);
}
public class BoundaryTests extends PartitioningTests {
/*
* Test cases for addUser
*/
@Test
public void testPassphraseLength() {
// EC 1.2
assertThrows(WeakPassphraseException.class, () -> pb.addUser("456abc", "0234569"));
}
@Test
public void testWeakPassphrase() throws DuplicateUserException, WeakPassphraseException {
pb.addUser("456abc", "az0129AZ");
assertTrue(pb.isUser("456abc"));
}
/*
* Test cases for updateDetails
*/
@Test
public void testDetailsNUll() throws MalformedURLException, InvalidSessionIDException, NoSuchURLException {
URL url = new URL("https://students.com");
pb.updateDetails(sessionID, url, "Xi", null);
assertThrows(NoSuchURLException.class, () -> pb.retrieveDetails(sessionID, url));
}
}
Loading