Skip to content

Add unit test for EncryptOrderByItemTokenGenerator#16012

Merged
strongduanmu merged 1 commit intoapache:masterfrom
huang-yilong:15822
Mar 13, 2022
Merged

Add unit test for EncryptOrderByItemTokenGenerator#16012
strongduanmu merged 1 commit intoapache:masterfrom
huang-yilong:15822

Conversation

@huang-yilong
Copy link
Contributor

Fixes #15822.

Changes proposed in this pull request:

  • add unit test for the generateSQLTokens method in EncryptOrderByItemTokenGenerator.

Copy link
Member

@strongduanmu strongduanmu left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@trydamere Thank you for your contribution, this pr looks good to me. I'll merge this pr after removing the useless blank line.

when(encryptRule.findEncryptTable("t_encrypt")).thenReturn(Optional.of(encryptTable));
return encryptRule;
}

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi @trydamere, can you remove this useless blank line?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sure. I'll do it.

@strongduanmu strongduanmu added this to the 5.1.1 milestone Mar 12, 2022
when(sqlStatementContext.getGroupByContext().getItems()).thenReturn(Collections.emptyList());
when(sqlStatementContext.getSubqueryContexts().values()).thenReturn(Collections.emptyList());
when(sqlStatementContext.getTablesContext()).thenReturn(new TablesContext(Collections.singletonList(simpleTableSegment)));
return sqlStatementContext;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi @trydamere, rename sqlStatementContext with result may be better.

when(encryptTable.findEncryptorName("certificate_number")).thenReturn(Optional.of("encryptor_name"));
when(encryptRule.findEncryptor("t_encrypt", "certificate_number")).thenReturn(Optional.of(mock(EncryptAlgorithm.class)));
when(encryptRule.findEncryptTable("t_encrypt")).thenReturn(Optional.of(encryptTable));
return encryptRule;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Rename encryptRule with result.

Copy link
Member

@strongduanmu strongduanmu left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi @trydamere, can you sync latest master branch to solve ci error?

@huang-yilong
Copy link
Contributor Author

I will do it.

Copy link
Member

@strongduanmu strongduanmu left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@trydamere Thank you.

@strongduanmu strongduanmu merged commit ba0f2fc into apache:master Mar 13, 2022
@huang-yilong huang-yilong deleted the 15822 branch March 13, 2022 04:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add unit test for EncryptOrderByItemTokenGenerator

3 participants