Skip to content

Commit e2dd295

Browse files
committed
Improve the comments in the test.
1 parent 9140394 commit e2dd295

File tree

1 file changed

+10
-4
lines changed

1 file changed

+10
-4
lines changed

src/test/java/org/casbin/adapter/JDBCAdapterTest.java

+10-4
Original file line numberDiff line numberDiff line change
@@ -82,20 +82,26 @@ public void testAddAndRemovePolicy() {
8282
Enforcer e = new Enforcer("examples/rbac_model.conf", a);
8383
testEnforce(e, "cathy", "data1", "read", false);
8484

85-
//add a policy
85+
// AutoSave is enabled by default.
86+
// It can be disabled by:
87+
// e.enableAutoSave(false);
88+
89+
// Because AutoSave is enabled, the policy change not only affects the policy in Casbin enforcer,
90+
// but also affects the policy in the storage.
8691
e.addPolicy("cathy", "data1", "read");
8792
testEnforce(e, "cathy", "data1", "read", true);
8893

89-
//reload policies from DB
94+
// Reload the policy from the storage to see the effect.
9095
e.clearPolicy();
9196
a.loadPolicy(e.getModel());
97+
// The policy has a new rule: {"cathy", "data1", "read"}.
9298
testEnforce(e, "cathy", "data1", "read", true);
9399

94-
//remove a policy
100+
// Remove the added rule.
95101
e.removePolicy("cathy", "data1", "read");
96102
testEnforce(e, "cathy", "data1", "read", false);
97103

98-
//reload policies from DB
104+
// Reload the policy from the storage to see the effect.
99105
e.clearPolicy();
100106
a.loadPolicy(e.getModel());
101107
testEnforce(e, "cathy", "data1", "read", false);

0 commit comments

Comments
 (0)