Constructor for creating a Registration with a location URI

pull/17/merge
Richard Körber 2015-12-20 12:21:20 +01:00
parent db927300e9
commit f4cd15da65
2 changed files with 26 additions and 0 deletions

View File

@ -28,6 +28,20 @@ public class Registration {
private URI agreement;
private URI location;
/**
* Create an empty {@link Registration}.
*/
public Registration() {
// default constructor
}
/**
* Create a {@link Registration} for the given location URI.
*/
public Registration(URI location) {
this.location = location;
}
/**
* Returns the URI of the agreement document the user is required to accept.
*/

View File

@ -49,4 +49,16 @@ public class RegistrationTest {
assertThat(registration.getContacts(), contains("mailto:foo@example.com", "mailto:bar@example.com"));
}
/**
* Test constructors;
*/
@Test
public void testConstructor() throws URISyntaxException {
Registration registration1 = new Registration();
assertThat(registration1.getLocation(), is(nullValue()));
Registration registration2 = new Registration(new URI("http://example.com/acme/12345"));
assertThat(registration2.getLocation(), is(new URI("http://example.com/acme/12345")));
}
}