Skip to content

Commit

Permalink
重命名测试方法并简化测试配置
Browse files Browse the repository at this point in the history
测试方法"contextLoadsTest"已重命名为"rsaKeyPairGeneratorTest",更准确地反映了其测试目的。同时,移除了测试类中不必要的@SpringBootTest注解配置,因为当前测试不需要启动整个Spring应用上下文。
  • Loading branch information
vnobo committed Oct 11, 2024
1 parent 41fde05 commit 57afcdd
Showing 1 changed file with 1 addition and 6 deletions.
Original file line number Diff line number Diff line change
@@ -1,9 +1,6 @@
package com.plate.boot;

import com.plate.boot.config.WebConfigurationTest;
import org.junit.jupiter.api.Test;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.context.annotation.Import;

import javax.crypto.BadPaddingException;
import javax.crypto.Cipher;
Expand All @@ -16,12 +13,10 @@
/**
* @author <a href="https://github.com/vnobo">Alex Bob</a>
*/
@SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT, properties = "spring.profiles.active=test")
@Import({WebConfigurationTest.class})
class BootApplicationTest {

@Test
void contextLoadsTest() throws NoSuchAlgorithmException, NoSuchPaddingException, InvalidKeyException, IllegalBlockSizeException, BadPaddingException {
void rsaKeyPairGeneratorTest() throws NoSuchAlgorithmException, NoSuchPaddingException, InvalidKeyException, IllegalBlockSizeException, BadPaddingException {
KeyPairGenerator keyPairGenerator = KeyPairGenerator.getInstance("RSA");
keyPairGenerator.initialize(2048);
KeyPair keyPair = keyPairGenerator.generateKeyPair();
Expand Down

0 comments on commit 57afcdd

Please sign in to comment.