package com.github.tomakehurst.wiremock.admin;

import com.github.tomakehurst.wiremock.admin.model.ResponseDefinitionBodyMatcher;
import com.github.tomakehurst.wiremock.http.ResponseDefinition;
import org.junit.Test;

import static com.github.tomakehurst.wiremock.client.ResponseDefinitionBuilder.responseDefinition;
import static junit.framework.TestCase.assertFalse;

public class ResponseDefinitionBodyMatcherTest {
    @Test
    public void doesNotMatchEmptyBody() {
        ResponseDefinition emptyBody = responseDefinition().build();
        ResponseDefinitionBodyMatcher matcher = new ResponseDefinitionBodyMatcher(0, 0);
        assertFalse(matcher.match(emptyBody).isExactMatch());
    }
}

@@ -166,12 +166,14 @@
 ock.
-http
+client
 .Res
@@ -191,41 +191,24 @@
 tion
-;%0Aimport org.junit.Test;%0A
+Builder;
 %0Aimport 
 stat
@@ -203,23 +203,16 @@
 %0Aimport 
-static 
 com.gith
@@ -227,38 +227,36 @@
 ehurst.wiremock.
-client
+http
 .ResponseDefinit
@@ -262,36 +262,34 @@
 tion
-Builder.responseDefinition
+;%0Aimport org.junit.Test
 ;%0A
+%0A
 impo
@@ -302,43 +302,78 @@
 tic 
+org.
 junit.
-framework.TestCase
+Assert.assertFalse;%0Aimport static org.junit.Assert
 .assert
-Fals
+Tru
 e;%0A%0A
@@ -451,102 +451,832 @@
 oid 
-doesNotMatchEmptyBody() %7B%0A        ResponseDefinition emptyBody = responseDefinition().bui
+noThresholds() %7B%0A        ResponseDefinitionBodyMatcher matcher = new ResponseDefinitionBodyMatcher(0, 0);%0A        assertFalse(matcher.match(new ResponseDefinition()).isExactMatch());%0A        assertTrue(matcher.match(textResponseDefinition(%22a%22)).isExactMatch());%0A        assertTrue(matcher.match(binaryResponseDefinition(new byte%5B%5D %7B 0x1 %7D)).isExactMatch());%0A    %7D%0A%0A    @Test%0A    public void textBodyMatchingWithThreshold() %7B%0A        ResponseDefinitionBodyMatcher matcher = new ResponseDefinitionBodyMatcher(2, 0);%0A        assertFalse(matcher.match(textResponseDefinition(%22f%22)).isExactMatch());%0A        assertFalse(matcher.match(textResponseDefinition(%22fo%22)).isExactMatch());%0A        assertTrue(matcher.match(textResponseDefinition(%22foo%22)).isExactMatch());%0A    %7D%0A%0A    @Test%0A    public void binaryBodyMatchingWithThresho
 ld()
-;
+ %7B
 %0A   
@@ -1349,33 +1349,33 @@
 nBodyMatcher(0, 
-0
+2
 );%0A        asser
@@ -1399,33 +1399,692 @@
 tch(
-emptyBody).isExactMatch()
+binaryResponseDefinition(new byte%5B%5D %7B 0x1 %7D)).isExactMatch());%0A        assertFalse(matcher.match(binaryResponseDefinition(new byte%5B%5D %7B 0x1, 0xc %7D)).isExactMatch());%0A        assertTrue(matcher.match(binaryResponseDefinition(new byte%5B%5D %7B 0x1, 0xc, 0xf %7D)).isExactMatch());%0A    %7D%0A%0A    private static ResponseDefinition textResponseDefinition(String body) %7B%0A        return new ResponseDefinitionBuilder()%0A            .withHeader(%22Content-Type%22, %22text/plain%22)%0A            .withBody(body)%0A            .build();%0A    %7D%0A%0A    private static ResponseDefinition binaryResponseDefinition(byte%5B%5D body) %7B%0A        return new ResponseDefinitionBuilder()%0A            .withBody(body)%0A            .build(
 );%0A 

Add more tests for ResponseDefinitionBodyMatcher