-
-
Notifications
You must be signed in to change notification settings - Fork 716
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
2 changed files
with
43 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
41 changes: 41 additions & 0 deletions
41
allure-plugin-api/src/test/java/io/qameta/allure/entity/LabelsTest.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,41 @@ | ||
package io.qameta.allure.entity; | ||
|
||
import org.junit.Test; | ||
|
||
import java.util.List; | ||
import java.util.Optional; | ||
|
||
import static org.assertj.core.api.Assertions.assertThat; | ||
|
||
/** | ||
* @author charlie (Dmitry Baev). | ||
*/ | ||
public class LabelsTest { | ||
|
||
@Test | ||
public void shouldFindLabelsInEmptyArray() throws Exception { | ||
final Optional<String> found = new TestResult().findOneLabel("hey"); | ||
assertThat(found) | ||
.isEmpty(); | ||
} | ||
|
||
@Test | ||
public void shouldFindOneWithNullValue() throws Exception { | ||
final TestResult result = new TestResult(); | ||
result.getLabels().add(new Label().setName("hey").setValue(null)); | ||
final Optional<String> found = result.findOneLabel("hey"); | ||
assertThat(found) | ||
.isEmpty(); | ||
} | ||
|
||
@Test | ||
public void shouldFindAllWithNullValue() throws Exception { | ||
final TestResult result = new TestResult(); | ||
result.getLabels().add(new Label().setName("hey").setValue(null)); | ||
result.getLabels().add(new Label().setName("hey").setValue("a")); | ||
result.getLabels().add(new Label().setName("hey").setValue("b")); | ||
final List<String> found = result.findAllLabels("hey"); | ||
assertThat(found) | ||
.containsExactlyInAnyOrder(null, "a", "b"); | ||
} | ||
} |