Skip to content

Commit 32f9a88

Browse files
committed
add test cases
1 parent f9168c8 commit 32f9a88

1 file changed

Lines changed: 31 additions & 0 deletions

File tree

src/test/java/com/joonsang/graylog/GraylogQueryTests.java

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -225,4 +225,35 @@ public void TC_017_PARENTHESES() {
225225
.as("TC_017_PARENTHESES")
226226
.isEqualTo(expect);
227227
}
228+
229+
@Test
230+
public void TC_018_PREPEND() {
231+
GraylogQuery prepend = GraylogQuery.builder()
232+
.not().exists("type");
233+
234+
GraylogQuery query = GraylogQuery.builder(prepend)
235+
.and().term("ssh");
236+
237+
String expect = "NOT _exists_:type AND \"ssh\"";
238+
239+
assertThat(query.build())
240+
.as("TC_018_PREPEND")
241+
.isEqualTo(expect);
242+
}
243+
244+
@Test
245+
public void TC_019_APPEND() {
246+
GraylogQuery append = GraylogQuery.builder()
247+
.or().exists("type");
248+
249+
GraylogQuery query = GraylogQuery.builder()
250+
.term("ssh")
251+
.append(append);
252+
253+
String expect = "\"ssh\" OR _exists_:type";
254+
255+
assertThat(query.build())
256+
.as("TC_019_APPEND")
257+
.isEqualTo(expect);
258+
}
228259
}

0 commit comments

Comments
 (0)