Skip to content

Commit

Permalink
Update Registration tests to check rootpath
Browse files Browse the repository at this point in the history
  • Loading branch information
sbernard31 committed Jun 3, 2021
1 parent 63683cb commit a84e60a
Showing 1 changed file with 24 additions and 0 deletions.
Expand Up @@ -32,6 +32,9 @@ public class RegistrationTest {
public void test_object_links_without_version_nor_rootpath() {
Registration reg = given_a_registration_with_object_link_like("</1/0>,</3/0>");

// check root path
assertEquals("/", reg.getRootPath());

// Ensure supported objects are correct
Map<Integer, String> supportedObject = reg.getSupportedObject();
assertEquals(2, supportedObject.size());
Expand All @@ -43,6 +46,9 @@ public void test_object_links_without_version_nor_rootpath() {
public void test_object_links_with_default_rootpath() {
Registration reg = given_a_registration_with_object_link_like("</>;rt=\"oma.lwm2m\", </1/0>,</3/0>");

// check root path
assertEquals("/", reg.getRootPath());

// Ensure supported objects are correct
Map<Integer, String> supportedObject = reg.getSupportedObject();
assertEquals(2, supportedObject.size());
Expand All @@ -54,6 +60,9 @@ public void test_object_links_with_default_rootpath() {
public void test_object_links_with_rootpath() {
Registration reg = given_a_registration_with_object_link_like("</root>;rt=\"oma.lwm2m\", </root/1/0>,</3/0>");

// check root path
assertEquals("/root/", reg.getRootPath());

// Ensure supported objects are correct
Map<Integer, String> supportedObject = reg.getSupportedObject();
assertEquals(1, supportedObject.size());
Expand All @@ -65,6 +74,9 @@ public void test_object_links_with_rootpath() {
public void test_object_links_with_unquoted_rootpath() {
Registration reg = given_a_registration_with_object_link_like("</root>;rt=oma.lwm2m, </root/1/0>,</3/0>");

// check root path
assertEquals("/root/", reg.getRootPath());

// Ensure supported objects are correct
Map<Integer, String> supportedObject = reg.getSupportedObject();
assertEquals(1, supportedObject.size());
Expand All @@ -77,6 +89,9 @@ public void test_object_links_with_regexp_rootpath() {
Registration reg = given_a_registration_with_object_link_like(
"</r(\\d+)oot>;rt=\"oma.lwm2m\", </r(\\d+)oot/1/0>,</3/0>");

// check root path
assertEquals("/r(\\d+)oot/", reg.getRootPath());

// Ensure supported objects are correct
Map<Integer, String> supportedObject = reg.getSupportedObject();
assertEquals(1, supportedObject.size());
Expand All @@ -88,6 +103,9 @@ public void test_object_links_with_regexp_rootpath() {
public void test_object_links_with_version() {
Registration reg = given_a_registration_with_object_link_like("</1/0>,</3>;ver=\"1.1\",</3/0>");

// check root path
assertEquals("/", reg.getRootPath());

// Ensure supported objects are correct
Map<Integer, String> supportedObject = reg.getSupportedObject();
assertEquals(2, supportedObject.size());
Expand All @@ -100,6 +118,9 @@ public void test_object_links_with_text_in_not_lwm2m_path() {
Registration reg = given_a_registration_with_object_link_like(
"</root>;rt=\"oma.lwm2m\",<text>,</1/text/0/in/path>,empty,</2/O/test/in/path>,</root/3/0>;ver=\"1.1\",</root/4/0/0/>");

// check root path
assertEquals("/root/", reg.getRootPath());

// Ensure supported objects are correct
Map<Integer, String> supportedObject = reg.getSupportedObject();
assertEquals(1, supportedObject.size());
Expand All @@ -111,6 +132,9 @@ public void test_object_links_with_text_in_lwm2m_path() {
Registration reg = given_a_registration_with_object_link_like(
"<text>,</1/text/0/in/path>,empty,</2/O/test/in/path>,</3/0>;ver=\"1.1\",</4/0/0/>");

// check root path
assertEquals("/", reg.getRootPath());

// Ensure supported objects are correct
Map<Integer, String> supportedObject = reg.getSupportedObject();
assertEquals(1, supportedObject.size());
Expand Down

0 comments on commit a84e60a

Please sign in to comment.