|
1 | 1 | package org.utplsql.api.testRunner;
|
2 | 2 |
|
| 3 | +import org.junit.jupiter.api.Nested; |
3 | 4 | import org.junit.jupiter.api.Test;
|
4 | 5 | import org.utplsql.api.AbstractDatabaseTest;
|
5 | 6 | import org.utplsql.api.FileMapperOptions;
|
@@ -50,4 +51,37 @@ private void assertMapping(FileMapping fileMapping, String owner, String name, S
|
50 | 51 | assertEquals(type, fileMapping.getObjectType());
|
51 | 52 | }
|
52 | 53 |
|
| 54 | + @Nested |
| 55 | + class Default_type_mapping { |
| 56 | + |
| 57 | + void checkTypeMapping( List<KeyValuePair> typeMappings ) throws SQLException { |
| 58 | + List<String> filePaths = java.util.Arrays.asList( |
| 59 | + "/award_bonus.prc", |
| 60 | + "/betwnstr.fnc", |
| 61 | + "/package_body.pkb", |
| 62 | + "/type_body.tpb", |
| 63 | + "/trigger.trg"); |
| 64 | + FileMapperOptions mapperOptions = new FileMapperOptions(filePaths); |
| 65 | + mapperOptions.setTypeMappings(typeMappings); |
| 66 | + |
| 67 | + List<FileMapping> fileMappings = FileMapper.buildFileMappingList(getConnection(), mapperOptions); |
| 68 | + |
| 69 | + assertEquals("PROCEDURE", fileMappings.get(0).getObjectType()); |
| 70 | + assertEquals("FUNCTION", fileMappings.get(1).getObjectType()); |
| 71 | + assertEquals("PACKAGE BODY", fileMappings.get(2).getObjectType()); |
| 72 | + assertEquals("TYPE BODY", fileMappings.get(3).getObjectType()); |
| 73 | + assertEquals("TRIGGER", fileMappings.get(4).getObjectType()); |
| 74 | + } |
| 75 | + |
| 76 | + @Test |
| 77 | + void is_used_on_null_parameter() throws SQLException { |
| 78 | + checkTypeMapping(null); |
| 79 | + } |
| 80 | + |
| 81 | + @Test |
| 82 | + void is_used_on_empty_parameter() throws SQLException { |
| 83 | + checkTypeMapping(new ArrayList<>()); |
| 84 | + } |
| 85 | + } |
| 86 | + |
53 | 87 | }
|
0 commit comments