Skip to content

Commit

Permalink
WiP. Trying out a new matcher.
Browse files Browse the repository at this point in the history
  • Loading branch information
bogdanmarculescu committed Feb 5, 2020
1 parent 5e9579d commit 29387f6
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 8 deletions.
Expand Up @@ -2,8 +2,6 @@

import org.hamcrest.Description;
import org.hamcrest.TypeSafeMatcher;

import java.util.Arrays;
import java.util.Collection;

public class StringCollectionMatcher extends TypeSafeMatcher<Collection<String>> {
Expand Down
Expand Up @@ -47,12 +47,8 @@ class PartialOracles {
lines.add("expectationHandler")
lines.indented {
lines.add(".expect($expectationsMasterSwitch)")
for (oracle in oracles) {
oracle.addExpectations(call, lines, res, name, format)
if (format.isJava()) {
lines.append(";")
}
}
for (oracle in oracles) { oracle.addExpectations(call, lines, res, name, format) }
if (format.isJava()) { lines.append(";") }
}
}

Expand Down
12 changes: 12 additions & 0 deletions core/src/test/kotlin/org/evomaster/core/output/MatcherTests.kt
Expand Up @@ -3,9 +3,11 @@ package org.evomaster.core.output
import org.evomaster.client.java.controller.contentMatchers.NumberMatcher.numbersMatch
import org.evomaster.client.java.controller.contentMatchers.StringMatcher.stringsMatch
import org.evomaster.client.java.controller.contentMatchers.SubStringMatcher.subStringsMatch
import org.evomaster.client.java.controller.contentMatchers.StringCollectionMatcher.collectionContains
import org.junit.jupiter.api.Assertions.assertTrue
import org.junit.jupiter.api.Assertions.assertFalse
import org.junit.jupiter.api.Test
import java.util.*

class MatcherTests{

Expand Down Expand Up @@ -56,4 +58,14 @@ class MatcherTests{
assertFalse(numbersMatch(404.1, "404.0"))
}

/**
* The [testStringCollectionMatcher]
*/
@Test
fun testStringCollectionMatcher(){
assertTrue(collectionContains(Arrays.asList("mup", "tup", "vup"), "vup"))
assertFalse(collectionContains(Arrays.asList("mup", "tup", "vup"), "mjup"))
}


}

0 comments on commit 29387f6

Please sign in to comment.