Hi I'm totally new to Maven my Java knowledge is low, my programming is good in other areas but I'm little overwhelmed currently with size of this multimode Maven build I'm trying to get working.
I'm trying to install a Maven build SDK and receive this error when running MVN test:
Tests run: 4, Failures: 2, Errors: 0, Skipped: 0, Time elapsed: 0.194 sec <<< FAILURE!
testWriteWithMap(eu.sdk.util.JsonWriterTest) Time elapsed: 0.181 sec <<< FAILURE!
junit.framework.ComparisonFailure: null expected:<{"[b":12,"c":123,"a":"test1"]}> but was:<{"[a":"test1","b":12,"c":123]}>
at junit.framework.Assert.assertEquals(Assert.java:81)
at junit.framework.Assert.assertEquals(Assert.java:87)
at junit.framework.Assert$assertEquals$0.callStatic(Unknown Source)
at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCallStatic(CallSiteArray.java:53)
at org.codehaus.groovy.runtime.callsite.AbstractCallSite.callStatic(AbstractCallSite.java:157)
at org.codehaus.groovy.runtime.callsite.AbstractCallSite.callStatic(AbstractCallSite.java:169)
at eu.digient.sdk.util.JsonWriterTest.testWriteWithMap(JsonWriterTest.groovy:28)
testConvert2JsonStrWithMap(eu.sdk.util.JsonWriterTest) Time elapsed: 0.001 sec <<< FAILURE!
junit.framework.ComparisonFailure: null expected:<{"[b":12,"c":123,"a":"test1"]}> but was:<{"[a":"test1","b":12,"c":123]}>
at junit.framework.Assert.assertEquals(Assert.java:81)
at junit.framework.Assert.assertEquals(Assert.java:87)
at junit.framework.Assert$assertEquals$0.callStatic(Unknown Source)
at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCallStatic(CallSiteArray.java:53)
at org.codehaus.groovy.runtime.callsite.AbstractCallSite.callStatic(AbstractCallSite.java:157)
at org.codehaus.groovy.runtime.callsite.AbstractCallSite.callStatic(AbstractCallSite.java:169)
at eu.digient.sdk.util.JsonWriterTest.testConvert2JsonStrWithMap(JsonWriterTest.groovy:85)
I have traced the error to the test file and found the test function here:
@Test
public void testWriteWithMap() {
MockHttpServletResponse response = new MockHttpServletResponse();
Map<String, Object> jsonBean = new HashMap<String, Object>();
jsonBean.put("a", "test1");
jsonBean.put("b", 12);
jsonBean.put("c", new BigDecimal(123));
try {
JsonWriter.write(response, jsonBean);
assertEquals("{\"b\":12,\"c\":123,\"a\":\"test1\"}", response.getContentAsString());
} catch (HttpMessageNotWritableException e) {
fail("fail");
} catch (IOException e) {
fail("fail");
}
}
Why is this failing, my assumption is this should be the correct test having inherited this code from a once working on the server project for my new client. I don't really understand what this tests aim is at the moment? Can any one enlighten me please?
Aucun commentaire:
Enregistrer un commentaire