コード例 #1
0
 @Test
 public void disallowed_list_only_nok() {
   AuthorizationRule rule = new AuthorizationRule();
   CommitInformation commitInformation = new CommitInformation();
   commitInformation.setAuthor("test");
   RuleExecutionResult result =
       rule.apply(context, new AuthorizationRuleOptions("", "stephan,ursula"), commitInformation);
   assertNotNull(result);
   assertEquals(RuleExecutionResultType.FAIL, result.getType());
   assertEquals("[AUTHORIZATION-001] Author \"test\" is not authorized.", result.getMessage());
 }
コード例 #2
0
 @Test
 public void combined_list_ok() {
   AuthorizationRule rule = new AuthorizationRule();
   CommitInformation commitInformation = new CommitInformation();
   commitInformation.setAuthor("test");
   RuleExecutionResult result =
       rule.apply(
           context, new AuthorizationRuleOptions("test", "stephan,ursula"), commitInformation);
   assertNotNull(result);
   assertEquals(RuleExecutionResultType.OK, result.getType());
   assertNull(result.getMessage());
 }