|
12 | 12 | import static org.assertj.core.api.Assertions.assertThat;
|
13 | 13 |
|
14 | 14 | import java.sql.SQLException;
|
| 15 | +import java.util.stream.Stream; |
15 | 16 | import org.junit.jupiter.api.Test;
|
| 17 | +import org.junit.jupiter.params.ParameterizedTest; |
| 18 | +import org.junit.jupiter.params.provider.Arguments; |
| 19 | +import org.junit.jupiter.params.provider.MethodSource; |
16 | 20 | import org.sqlite.ExtendedCommand.BackupCommand;
|
17 | 21 | import org.sqlite.ExtendedCommand.RestoreCommand;
|
18 | 22 | import org.sqlite.ExtendedCommand.SQLExtension;
|
@@ -69,4 +73,22 @@ public void parseRestoreCmd() throws SQLException {
|
69 | 73 | assertThat(b.targetDB).isEqualTo("main");
|
70 | 74 | assertThat(b.srcFile).isEqualTo("target/sample.db");
|
71 | 75 | }
|
| 76 | + |
| 77 | + @ParameterizedTest |
| 78 | + @MethodSource |
| 79 | + public void removeQuotation(String input, String expected) throws SQLException { |
| 80 | + assertThat(ExtendedCommand.removeQuotation(input)).isEqualTo(expected); |
| 81 | + } |
| 82 | + |
| 83 | + private static Stream<Arguments> removeQuotation() { |
| 84 | + return Stream.of( |
| 85 | + Arguments.of(null, null), // Null String |
| 86 | + Arguments.of("'", "'"), // String with one single quotation only |
| 87 | + Arguments.of("\"", "\""), // String with one double quotation only |
| 88 | + Arguments.of("'Test\"", "'Test\""), // String with two mismatch quotations |
| 89 | + Arguments.of("'Test'", "Test"), // String with two matching single quotations |
| 90 | + Arguments.of("\"Test\"", "Test"), // String with two matching double quotations |
| 91 | + Arguments.of("'Te's\"t'", "Te's\"t") // String with more than two quotations |
| 92 | + ); |
| 93 | + } |
72 | 94 | }
|
0 commit comments