tests: clean up tests for IAM condition support #224
Conversation
Codecov Report
@@ Coverage Diff @@
## master #224 +/- ##
============================================
+ Coverage 67.61% 67.62% +0.01%
- Complexity 379 384 +5
============================================
Files 36 36
Lines 1976 1986 +10
Branches 262 269 +7
============================================
+ Hits 1336 1343 +7
- Misses 532 535 +3
Partials 108 108
Continue to review full report at Codecov.
|
private static final Binding VIEWER_BINDING = | ||
Binding.newBuilder().setRole(VIEWER).setMembers(MEMBERS_LIST_1).build(); | ||
private static final Binding EDITOR_BINDING = | ||
Binding.newBuilder().setRole(EDITOR).setMembers(MEMBERS_LIST_2).build(); | ||
private static final List<Binding> BINDINGS_NO_CONDITIONS = |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
private static final List<Binding> BINDINGS_NO_CONDITIONS = | |
private static final ImmutableList<Binding> BINDINGS_NO_CONDITIONS = |
ImmutableList
and friends are especially useful as parameter, method, field, and local variable types, so that users know they are immutable. (For example, the mutation methods are all deprecated, so IDEs will warn about their use.) Please do this throughout the file.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
ImmutableList.copyOf(BINDINGS_NO_CONDITIONS) | ||
.of( | ||
Binding.newBuilder() | ||
.setRole(VIEWER) | ||
.setMembers(MEMBERS_LIST_1) | ||
.setCondition( | ||
Condition.newBuilder() | ||
.setTitle("Condition") | ||
.setDescription("Condition") | ||
.setExpression("Expr") | ||
.build()) | ||
.build(), | ||
Binding.newBuilder().setRole(EDITOR).setMembers(MEMBERS_LIST_2).build()); | ||
.of(VIEWER_BINDING.toBuilder().setCondition(CONDITION).build(), EDITOR_BINDING); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ImmutableList.of()
is a static method. Here you're calling a static method on an instance (returned by ImmutableList.copyOf()
), which basically throws the instance away.
I think you can delete line 63 and just do ImmutableList.of(VIEWER_BINDING.toBuilder()…, EDITOR_BINDING)
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
@netdpb PTAL |
Fixes #169