Skip to content

Commit

Permalink
Create tck test to DocumentCondition
Browse files Browse the repository at this point in the history
Signed-off-by: Otavio Santana <otaviopolianasantana@gmail.com>
  • Loading branch information
otaviojava committed Jun 9, 2022
1 parent 643b770 commit d5e5a67
Showing 1 changed file with 25 additions and 0 deletions.
Expand Up @@ -67,6 +67,31 @@ public void shouldReturnValidDoubleNegation() {
Assertions.assertEquals(condition, affirmative);
}


@Test
public void shouldCreateNotCondition() {
Document age = Document.of("age", 26);
DocumentCondition condition = DocumentCondition.gt(age);
DocumentCondition negate = DocumentCondition.not(condition);
Document negateDocument = negate.getDocument();
assertEquals(Condition.NOT, negate.getCondition());
assertEquals(Condition.NOT.getNameField(), negateDocument.getName());
assertEquals(DocumentCondition.gt(age), negateDocument.getValue().get());
}

@Test
public void shouldReturnValidDoubleNot() {
Document age = Document.of("age", 26);
DocumentCondition condition = DocumentCondition.gt(age);
DocumentCondition affirmative = DocumentCondition.not(DocumentCondition.not(condition));
Assertions.assertEquals(condition, affirmative);
}

@Test
public void shouldShouldReturnErrorOnNot() {
Assertions.assertThrows(NullPointerException.class, ()-> DocumentCondition.not(null));
}

@Test
public void shouldCreateEqFromNameValue() {
Document document = Document.of("name", "Ada Lovelace");
Expand Down

0 comments on commit d5e5a67

Please sign in to comment.