File tree Expand file tree Collapse file tree 1 file changed +34
-11
lines changed
opa-async-java-client/src/test/java/com/contentgrid/opa/client Expand file tree Collapse file tree 1 file changed +34
-11
lines changed Original file line number Diff line number Diff line change 1414import com .contentgrid .opa .rego .ast .Query ;
1515import com .contentgrid .opa .rego .ast .Term ;
1616import com .contentgrid .opa .rego .ast .Term .Ref ;
17+ import com .contentgrid .opa .rego .ast .Term .Text ;
18+ import com .contentgrid .opa .rego .ast .Term .Var ;
1719import java .io .IOException ;
1820import java .io .UncheckedIOException ;
1921import java .nio .charset .StandardCharsets ;
@@ -320,17 +322,38 @@ void abacExample() {
320322 .hasSize (2 )
321323 .allSatisfy (expr -> {
322324 // each expression has 3 terms (the 'eq' operator, the attribute value and the input value)
323- assertThat (expr .getTerms ()).hasSize (3 );
324- assertThat (expr .getTerms ()).anySatisfy (
325- term -> {
326- assertThat (term ).isInstanceOfSatisfying (Ref .class , ref -> {
327- assertThat (ref .getValue ()).singleElement ().satisfies (
328- t -> assertThat (t ).hasToString ("eq" )
329- );
330- });
331- }
332- );
333- }));
325+ assertThat (expr .getTerms ())
326+ .hasSize (3 )
327+ .anySatisfy (
328+ term -> {
329+ assertThat (term ).isInstanceOfSatisfying (Ref .class , ref -> {
330+ assertThat (ref .getValue ()).singleElement ().satisfies (
331+ t -> assertThat (t ).hasToString ("eq" )
332+ );
333+ });
334+ }
335+ );
336+ })
337+ )
338+ .anySatisfy (query -> {
339+ assertThat (query ).anySatisfy (
340+ expr -> assertThat (expr .getTerms ())
341+ .isEqualTo (List .of (
342+ new Ref (List .of (new Var ("eq" ))),
343+ new Text ("att1v1" ),
344+ new Ref (List .of (
345+ new Var ("input" ),
346+ new Text ("entity" ),
347+ new Text ("a" )
348+ )
349+ )
350+ )
351+
352+ )
353+ );
354+
355+ })
356+ ;
334357 }
335358
336359 @ Test
You can’t perform that action at this time.
0 commit comments