-
Notifications
You must be signed in to change notification settings - Fork 408
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix UriReference issue in MixedLwM2mLink when rootpath is not null.
- Loading branch information
1 parent
9fadb35
commit 13dea84
Showing
2 changed files
with
58 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
44 changes: 44 additions & 0 deletions
44
leshan-core/src/test/java/org/eclipse/leshan/core/link/MixedLwM2mLinkTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
/******************************************************************************* | ||
* Copyright (c) 2022 Sierra Wireless and others. | ||
* | ||
* All rights reserved. This program and the accompanying materials | ||
* are made available under the terms of the Eclipse Public License v2.0 | ||
* and Eclipse Distribution License v1.0 which accompany this distribution. | ||
* | ||
* The Eclipse Public License is available at | ||
* http://www.eclipse.org/legal/epl-v20.html | ||
* and the Eclipse Distribution License is available at | ||
* http://www.eclipse.org/org/documents/edl-v10.html. | ||
* | ||
* Contributors: | ||
* Sierra Wireless - initial API and implementation | ||
*******************************************************************************/ | ||
package org.eclipse.leshan.core.link; | ||
|
||
import static org.junit.Assert.assertEquals; | ||
|
||
import org.eclipse.leshan.core.link.attributes.ResourceTypeAttribute; | ||
import org.eclipse.leshan.core.link.lwm2m.MixedLwM2mLink; | ||
import org.eclipse.leshan.core.node.LwM2mPath; | ||
import org.junit.Test; | ||
|
||
public class MixedLwM2mLinkTest { | ||
|
||
@Test | ||
public void check_uri_reference() { | ||
Link link = new MixedLwM2mLink("/root", LwM2mPath.ROOTPATH, new ResourceTypeAttribute("oma.lwm2m")); | ||
assertEquals("/root", link.getUriReference()); | ||
|
||
link = new MixedLwM2mLink("/root", new LwM2mPath(2)); | ||
assertEquals("/root/2", link.getUriReference()); | ||
|
||
link = new MixedLwM2mLink("/root/", new LwM2mPath(2)); | ||
assertEquals("/root//2", link.getUriReference()); | ||
|
||
link = new MixedLwM2mLink("/", new LwM2mPath(2)); | ||
assertEquals("/2", link.getUriReference()); | ||
|
||
link = new MixedLwM2mLink(null, new LwM2mPath(2)); | ||
assertEquals("/2", link.getUriReference()); | ||
} | ||
} |