Java 类org.hamcrest.text.IsEqualIgnoringWhiteSpace 实例源码

项目:redsniff    文件:RedsniffWicketTestBase.java   
public static Matcher<String> containsIgnoringWhitespace(final String expected){
    return new TypeSafeMatcher<String>(){

        @Override
        public void describeTo(Description description) {
            description.appendText(expected); //don't bother to add the fact that it contains ignoring case

        }

        @Override
        protected boolean matchesSafely(String actual) {
            String strippedActual = stripSpace(actual);
            String strippedExpected =  stripSpace(expected);
            return containsString(strippedExpected).matches(strippedActual); 
        }

        private String stripSpace(String string) {
            return new IsEqualIgnoringWhiteSpace("").stripSpace(string);
        }
    };

}
项目:JHawtCode    文件:CodeTests.java   
@Test
public void runCodeSimple() throws Exception {
    ResultActions actions = this.mockMvc.perform(post("/jhawtcode/dynacode").param("code", "jhc.println(true);").param("replacementCP", fullClassPath));
    //actions.andDo(print());
    actions.andExpect(status().isOk());
    //not the best content test, but works for now until gzip deflate
    actions.andExpect(content().string(new IsNot(new IsNull())));
    actions.andExpect(content().string(new IsNot(new IsEmptyString())));
    actions.andExpect(content().string(new IsEqualIgnoringWhiteSpace("true")));
}
项目:JHawtCode    文件:CodeTests.java   
@Test
public void runCodeSimpleWithImport() throws Exception {
    ResultActions actions = this.mockMvc.perform(post("/jhawtcode/dynacode").param("code", "jhc.println(Math.pow(3,3));").param("replacementCP", fullClassPath).param("imports", "import java.lang.Math;"));
    //actions.andDo(print());
    actions.andExpect(status().isOk());
    //not the best content test, but works for now until gzip deflate
    actions.andExpect(content().string(new IsNot(new IsNull())));
    actions.andExpect(content().string(new IsNot(new IsEmptyString())));
    actions.andExpect(content().string(new IsEqualIgnoringWhiteSpace("27.0")));
}
项目:JHawtCode    文件:CodeTests.java   
@Test
public void runCodeSimpleWithImportAndMethod() throws Exception {
    ResultActions actions = this.mockMvc.perform(post("/jhawtcode/dynacode").param("code", "jhc.println(Math.pow(3,addem(2,1)));").param("replacementCP", fullClassPath).param("imports", "import java.lang.Math;").param("methods", "public int addem(int a, int b) { return a+b; }"));
    //actions.andDo(print());
    actions.andExpect(status().isOk());
    //not the best content test, but works for now until gzip deflate
    actions.andExpect(content().string(new IsNot(new IsNull())));
    actions.andExpect(content().string(new IsNot(new IsEmptyString())));
    actions.andExpect(content().string(new IsEqualIgnoringWhiteSpace("27.0")));
}
项目:JHawtCode    文件:CodeTests.java   
@Test
public void runCodeSimpleWithImportAndMethodAndGlobal() throws Exception {
    ResultActions actions = this.mockMvc.perform(post("/jhawtcode/dynacode").param("code", "jhc.println(Math.pow(3,addem(1,1)));").param("replacementCP", fullClassPath).param("imports", "import java.lang.Math;").param("methods", "public int addem(int a, int b) { return a+b+MYVAR; }").param("globals", "private int MYVAR=1;"));
    //actions.andDo(print());
    actions.andExpect(status().isOk());
    //not the best content test, but works for now until gzip deflate
    actions.andExpect(content().string(new IsNot(new IsNull())));
    actions.andExpect(content().string(new IsNot(new IsEmptyString())));
    actions.andExpect(content().string(new IsEqualIgnoringWhiteSpace("27.0")));
}
项目:redsniff    文件:ContainsIgnoringWhitespace.java   
private String stripSpace(String string) {
    return new IsEqualIgnoringWhiteSpace("").stripSpace(string);
}
项目:marmotta    文件:ProgramTest.java   
@Test
public void testGetPathExpression() {
    final String result = program.getPathExpression(backend);
    Assert.assertThat(result, IsEqualIgnoringWhiteSpace.equalToIgnoringWhiteSpace(expr));
}
项目:marmotta    文件:TestsTest.java   
@Test
public void testGetPathExpression() {
    Assert.assertThat(test.getPathExpression(backend), IsEqualIgnoringWhiteSpace.equalToIgnoringWhiteSpace(expr));
}
项目:marmotta    文件:SelectorsTest.java   
@Test
public void testGetPathExpression() {
    Assert.assertThat(selector.getPathExpression(backend), IsEqualIgnoringWhiteSpace.equalToIgnoringWhiteSpace(expr));
}