-
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.
GH-1674: Fix NPE when creating Composite failure Response
- Loading branch information
1 parent
5f0d210
commit 8bd4416
Showing
4 changed files
with
79 additions
and
4 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
33 changes: 33 additions & 0 deletions
33
...rc/test/java/org/eclipse/leshan/core/response/CancelCompositeObservationResponseTest.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,33 @@ | ||
/******************************************************************************* | ||
* Copyright (c) 2024 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: | ||
* Michał Wadowski (Orange) - Add Observe-Composite feature. | ||
*******************************************************************************/ | ||
package org.eclipse.leshan.core.response; | ||
|
||
import static org.junit.jupiter.api.Assertions.assertEquals; | ||
import static org.junit.jupiter.api.Assertions.assertNull; | ||
|
||
import org.eclipse.leshan.core.ResponseCode; | ||
import org.junit.jupiter.api.Test; | ||
|
||
public class CancelCompositeObservationResponseTest { | ||
|
||
@Test | ||
public void create_failure_reponse() { | ||
CancelCompositeObservationResponse response = new CancelCompositeObservationResponse(ResponseCode.NOT_FOUND, | ||
null, null, null, null, null); | ||
assertEquals(response.getCode(), ResponseCode.NOT_FOUND); | ||
assertNull(response.getContent()); | ||
} | ||
} |
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
32 changes: 32 additions & 0 deletions
32
...-lwm2m-core/src/test/java/org/eclipse/leshan/core/response/ReadCompositeResponseTest.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,32 @@ | ||
/******************************************************************************* | ||
* Copyright (c) 2024 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.response; | ||
|
||
import static org.junit.jupiter.api.Assertions.assertEquals; | ||
import static org.junit.jupiter.api.Assertions.assertNull; | ||
|
||
import org.eclipse.leshan.core.ResponseCode; | ||
import org.junit.jupiter.api.Test; | ||
|
||
public class ReadCompositeResponseTest { | ||
|
||
@Test | ||
public void create_failure_reponse() { | ||
ReadCompositeResponse response = ReadCompositeResponse.notFound(); | ||
assertEquals(response.getCode(), ResponseCode.NOT_FOUND); | ||
assertNull(response.getContent()); | ||
} | ||
} |