|
| 1 | +package io.redskap.swagger.brake.integration.nobreakingchange; |
| 2 | + |
| 3 | +import static org.assertj.core.api.Assertions.assertThat; |
| 4 | + |
| 5 | +import java.util.Collection; |
| 6 | + |
| 7 | +import com.google.common.collect.Sets; |
| 8 | +import io.redskap.swagger.brake.core.BreakingChange; |
| 9 | +import io.redskap.swagger.brake.integration.AbstractSwaggerBrakeIntTest; |
| 10 | +import io.redskap.swagger.brake.runner.Options; |
| 11 | +import org.junit.Test; |
| 12 | +import org.junit.runner.RunWith; |
| 13 | +import org.springframework.test.context.junit4.SpringRunner; |
| 14 | + |
| 15 | +@RunWith(SpringRunner.class) |
| 16 | +public class ExcludedPathsIntTest extends AbstractSwaggerBrakeIntTest { |
| 17 | + @Test |
| 18 | + public void testExcludedPathsWorksCorrectlyForExactMatch() { |
| 19 | + // given |
| 20 | + String oldApiPath = "request/parameterdeleted/petstore.yaml"; |
| 21 | + String newApiPath = "request/parameterdeleted/petstore_v2.yaml"; |
| 22 | + Options options = new Options(); |
| 23 | + options.setOldApiPath(oldApiPath); |
| 24 | + options.setNewApiPath(newApiPath); |
| 25 | + options.setExcludedPaths(Sets.newHashSet("/pet/findByStatus")); |
| 26 | + // when |
| 27 | + Collection<BreakingChange> result = execute(options); |
| 28 | + // then |
| 29 | + assertThat(result).isEmpty(); |
| 30 | + } |
| 31 | + |
| 32 | + @Test |
| 33 | + public void testExcludedPathsWorksCorrectlyForStartingMatch() { |
| 34 | + // given |
| 35 | + String oldApiPath = "request/parameterdeleted/petstore.yaml"; |
| 36 | + String newApiPath = "request/parameterdeleted/petstore_v2.yaml"; |
| 37 | + Options options = new Options(); |
| 38 | + options.setOldApiPath(oldApiPath); |
| 39 | + options.setNewApiPath(newApiPath); |
| 40 | + options.setExcludedPaths(Sets.newHashSet("/pet")); |
| 41 | + // when |
| 42 | + Collection<BreakingChange> result = execute(options); |
| 43 | + // then |
| 44 | + assertThat(result).isEmpty(); |
| 45 | + } |
| 46 | +} |
0 commit comments