Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
WIP First version of the check that does not work (#714)
- Loading branch information
David Dufour-Boivin
committed
Jul 5, 2018
1 parent
c5cdae9
commit e233d1e
Showing
3 changed files
with
131 additions
and
41 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
48 changes: 48 additions & 0 deletions
48
server/src/test/java/de/zalando/zally/rule/zally/NoUnusedDefinitionsRule2Test.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
package de.zalando.zally.rule.zally | ||
|
||
import com.fasterxml.jackson.core.JsonPointer | ||
import de.zalando.zally.getContextFromFixture | ||
import de.zalando.zally.getFixture | ||
import de.zalando.zally.rule.api.Violation | ||
import io.swagger.models.Swagger | ||
import org.assertj.core.api.Assertions.assertThat | ||
import org.junit.Test | ||
|
||
class NoUnusedDefinitionsRule2Test { | ||
|
||
private val rule = NoUnusedDefinitionsRule2() | ||
|
||
@Test | ||
fun positiveCase() { | ||
val context = getContextFromFixture("unusedDefinitionsValid.json")!! | ||
assertThat(rule.validate(context)) | ||
.isEmpty() | ||
} | ||
|
||
@Test | ||
fun negativeCase() { | ||
val results = rule.validate(getContextFromFixture("unusedDefinitionsInvalid.json")!!) | ||
assertThat(results).hasSameElementsAs(listOf( | ||
Violation("", JsonPointer.compile("/definitions/PetName")), | ||
Violation("", JsonPointer.compile("/parameters/FlowId")) | ||
)) | ||
} | ||
|
||
// @Test | ||
// fun emptySwaggerShouldPass() { | ||
// val swagger = Swagger() | ||
// assertThat(rule.validate(swagger)).isNull() | ||
// } | ||
// | ||
// @Test | ||
// fun positiveCaseSpp() { | ||
// val swagger = getFixture("api_spp.json") | ||
// assertThat(rule.validate(swagger)).isNull() | ||
// } | ||
// | ||
// @Test | ||
// fun positiveCaseTinbox() { | ||
// val swagger = getFixture("api_tinbox.yaml") | ||
// assertThat(rule.validate(swagger)).isNull() | ||
// } | ||
} |