@@ -113,20 +113,24 @@ public void shouldParseSslPasswords() throws IOException {
113
113
assertEquals (producerProperties .getProperty ("ssl.keystore.password" ), "keystore-password" );
114
114
}
115
115
116
- @ Test
117
- public void shouldThr () throws IOException {
118
- File trustStorePasswordFile = writeDummyPasswordFile ("truststore-password.txt" , "truststore-password" );
119
- File keyStorePasswordFile = writeDummyPasswordFile ("keystore-password.txt" , "keystore-password" );
120
- when (configuration .getString (eq (Constants .SINK_KAFKA_SSL_TRUSTSTORE_PASSWORD_LOCATION_KEY ), anyString ())).thenReturn (trustStorePasswordFile .getAbsolutePath ());
121
- when (configuration .getString (eq (Constants .SINK_KAFKA_SSL_KEYSTORE_PASSWORD_LOCATION_KEY ), anyString ())).thenReturn (keyStorePasswordFile .getAbsolutePath ());
116
+ @ Test (expected = IllegalArgumentException .class )
117
+ public void shouldThrowWhenKeyStorePasswordIsNotExists () {
118
+ when (configuration .getString (eq (Constants .SINK_KAFKA_SSL_KEYSTORE_PASSWORD_LOCATION_KEY ), anyString ())).thenReturn ("/non-exists.txt" );
122
119
when (configuration .getString (eq (Constants .SINK_KAFKA_BROKERS_KEY ), anyString ())).thenReturn ("10.200.216.87:6668" );
123
120
when (configuration .getBoolean (eq (Constants .SINK_KAFKA_PRODUCE_LARGE_MESSAGE_ENABLE_KEY ), anyBoolean ())).thenReturn (true );
124
121
when (configuration .getString (eq (Constants .SINK_KAFKA_LINGER_MS_KEY ), anyString ())).thenReturn ("1000" );
125
122
126
- Properties producerProperties = sinkOrchestrator .getProducerProperties (configuration );
123
+ sinkOrchestrator .getProducerProperties (configuration );
124
+ }
127
125
128
- assertEquals (producerProperties .getProperty ("ssl.truststore.password" ), "truststore-password" );
129
- assertEquals (producerProperties .getProperty ("ssl.keystore.password" ), "keystore-password" );
126
+ @ Test (expected = IllegalArgumentException .class )
127
+ public void shouldThrowWhenTrustStorePasswordIsNotExists () {
128
+ when (configuration .getString (eq (Constants .SINK_KAFKA_SSL_TRUSTSTORE_PASSWORD_LOCATION_KEY ), anyString ())).thenReturn ("/non-exists.txt" );
129
+ when (configuration .getString (eq (Constants .SINK_KAFKA_BROKERS_KEY ), anyString ())).thenReturn ("10.200.216.87:6668" );
130
+ when (configuration .getBoolean (eq (Constants .SINK_KAFKA_PRODUCE_LARGE_MESSAGE_ENABLE_KEY ), anyBoolean ())).thenReturn (true );
131
+ when (configuration .getString (eq (Constants .SINK_KAFKA_LINGER_MS_KEY ), anyString ())).thenReturn ("1000" );
132
+
133
+ sinkOrchestrator .getProducerProperties (configuration );
130
134
}
131
135
132
136
@ Test
0 commit comments