List of usage examples for java.lang AssertionError getMessage
public String getMessage()
From source file:com.alliander.osgp.acceptancetests.devicemanagement.ChangeOrganisationDataSteps.java
@DomainStep("the change organisation request should return result (.*)") public boolean thenTheResponseShouldReturn(final String result) { LOGGER.info("THEN: the set remove organisation request should return {}.", result); if (result.toUpperCase().equals("OK")) { try {/* ww w.j a v a 2 s . c o m*/ Assert.assertNotNull("Response should not be null", this.response); Assert.assertNull("Throwable should be null", this.throwable); } catch (final AssertionError e) { LOGGER.error("Exception [{}]: {}", e.getClass().getSimpleName(), e.getMessage()); return false; } } else { try { Assert.assertNotNull("Throwable should not be null", this.throwable); Assert.assertEquals(result.toUpperCase(), this.throwable.getCause().getClass().getSimpleName().toUpperCase()); } catch (final AssertionError e) { LOGGER.error("Exception [{}]: {}", e.getClass().getSimpleName(), e.getMessage()); return false; } } return true; }
From source file:net.javacrumbs.jsonunit.spring.ExampleControllerTest.java
@Test public void isAbsentShouldFailIfNodeExists() throws Exception { try {/*from ww w .j ava 2 s . com*/ exec().andExpect(json().node("result.string").isAbsent()); failIfNoException(); } catch (AssertionError e) { assertEquals("Node \"result.string\" is present.", e.getMessage()); } }
From source file:net.javacrumbs.jsonunit.spring.ExampleControllerTest.java
@Test public void isArrayShouldFailIfNotPresent() throws Exception { try {// w w w. j av a 2s. c o m exec().andExpect(json().node("result.array2").isArray()); failIfNoException(); } catch (AssertionError e) { assertEquals("Node \"result.array2\" is missing.", e.getMessage()); } }
From source file:net.javacrumbs.jsonunit.spring.ExampleControllerTest.java
@Test public void isPresentShouldFailIfNodeIsAbsent() throws Exception { try {//from w w w . ja va2 s . c om exec().andExpect(json().node("result.string2").isPresent()); failIfNoException(); } catch (AssertionError e) { assertEquals("Node \"result.string2\" is missing.", e.getMessage()); } }
From source file:org.marketcetera.util.test.EqualityAssertTest.java
@Test public void nullIsolated() { try {//www. ja v a 2 s . co m assertEquality(new EqualsNull(0), new EqualsNull(0)); } catch (AssertionError ex) { assertEquals("'I am 0' equal to null", ex.getMessage()); return; } fail(); }
From source file:org.marketcetera.util.test.EqualityAssertTest.java
@Test public void zero() { try {// w w w. j ava2 s .c o m assertEquality(new EqualsZero(0), new EqualsZero(0)); } catch (AssertionError ex) { assertEquals("'I am 0' equal to zero", ex.getMessage()); return; } fail(); }
From source file:org.marketcetera.util.test.EqualityAssertTest.java
@Test public void nullInList() { try {// ww w.jav a 2 s. c o m assertEquality(new EqualsNull(0), new EqualsNull(0), new Object[] { null }); } catch (AssertionError ex) { assertEquals("'I am 0' equal to 'null'", ex.getMessage()); return; } fail(); }
From source file:org.marketcetera.util.test.EqualityAssertTest.java
@Test public void same() { Correct c = new Correct(0); try {/*from ww w .ja v a 2 s . c o m*/ assertEquality(c, c); } catch (AssertionError ex) { assertEquals("'I am 0' same as 'I am 0'", ex.getMessage()); return; } fail(); }
From source file:org.marketcetera.util.test.EqualityAssertTest.java
@Test public void noDiff() { try {//from w w w. ja v a 2 s.c o m assertEquality(new Correct(0), new Correct(0), new Correct(0)); } catch (AssertionError ex) { assertEquals("'I am 0' equal to 'I am 0'", ex.getMessage()); return; } fail(); }
From source file:org.marketcetera.util.test.EqualityAssertTest.java
@Test public void selfUnequals() { try {//from w ww . j ava2 s .co m assertEquality(new SelfUnequals(), new SelfUnequals()); } catch (AssertionError ex) { assertEquals("'I am self' unequal to self", ex.getMessage()); return; } fail(); }