Java Code Examples for org.springframework.messaging.MessagingException#getCause()
The following examples show how to use
org.springframework.messaging.MessagingException#getCause() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: ProductServiceApplicationTests.java From Hands-On-Microservices-with-Spring-Boot-and-Spring-Cloud with MIT License | 6 votes |
@Test public void duplicateError() { int productId = 1; assertNull(repository.findByProductId(productId).block()); sendCreateProductEvent(productId); assertNotNull(repository.findByProductId(productId).block()); try { sendCreateProductEvent(productId); fail("Expected a MessagingException here!"); } catch (MessagingException me) { if (me.getCause() instanceof InvalidInputException) { InvalidInputException iie = (InvalidInputException)me.getCause(); assertEquals("Duplicate key, Product Id: " + productId, iie.getMessage()); } else { fail("Expected a InvalidInputException as the root cause!"); } } }
Example 2
Source File: ProductServiceApplicationTests.java From Hands-On-Microservices-with-Spring-Boot-and-Spring-Cloud with MIT License | 6 votes |
@Test public void duplicateError() { int productId = 1; assertNull(repository.findByProductId(productId).block()); sendCreateProductEvent(productId); assertNotNull(repository.findByProductId(productId).block()); try { sendCreateProductEvent(productId); fail("Expected a MessagingException here!"); } catch (MessagingException me) { if (me.getCause() instanceof InvalidInputException) { InvalidInputException iie = (InvalidInputException)me.getCause(); assertEquals("Duplicate key, Product Id: " + productId, iie.getMessage()); } else { fail("Expected a InvalidInputException as the root cause!"); } } }
Example 3
Source File: ReviewServiceApplicationTests.java From Hands-On-Microservices-with-Spring-Boot-and-Spring-Cloud with MIT License | 6 votes |
@Test public void duplicateError() { int productId = 1; int reviewId = 1; assertEquals(0, repository.count()); sendCreateReviewEvent(productId, reviewId); assertEquals(1, repository.count()); try { sendCreateReviewEvent(productId, reviewId); fail("Expected a MessagingException here!"); } catch (MessagingException me) { if (me.getCause() instanceof InvalidInputException) { InvalidInputException iie = (InvalidInputException)me.getCause(); assertEquals("Duplicate key, Product Id: 1, Review Id:1", iie.getMessage()); } else { fail("Expected a InvalidInputException as the root cause!"); } } assertEquals(1, repository.count()); }
Example 4
Source File: RecommendationServiceApplicationTests.java From Hands-On-Microservices-with-Spring-Boot-and-Spring-Cloud with MIT License | 6 votes |
@Test public void duplicateError() { int productId = 1; int recommendationId = 1; sendCreateRecommendationEvent(productId, recommendationId); assertEquals(1, (long)repository.count().block()); try { sendCreateRecommendationEvent(productId, recommendationId); fail("Expected a MessagingException here!"); } catch (MessagingException me) { if (me.getCause() instanceof InvalidInputException) { InvalidInputException iie = (InvalidInputException)me.getCause(); assertEquals("Duplicate key, Product Id: 1, Recommendation Id:1", iie.getMessage()); } else { fail("Expected a InvalidInputException as the root cause!"); } } assertEquals(1, (long)repository.count().block()); }
Example 5
Source File: ProductServiceApplicationTests.java From Hands-On-Microservices-with-Spring-Boot-and-Spring-Cloud with MIT License | 6 votes |
@Test public void duplicateError() { int productId = 1; assertNull(repository.findByProductId(productId).block()); sendCreateProductEvent(productId); assertNotNull(repository.findByProductId(productId).block()); try { sendCreateProductEvent(productId); fail("Expected a MessagingException here!"); } catch (MessagingException me) { if (me.getCause() instanceof InvalidInputException) { InvalidInputException iie = (InvalidInputException)me.getCause(); assertEquals("Duplicate key, Product Id: " + productId, iie.getMessage()); } else { fail("Expected a InvalidInputException as the root cause!"); } } }
Example 6
Source File: ReviewServiceApplicationTests.java From Hands-On-Microservices-with-Spring-Boot-and-Spring-Cloud with MIT License | 6 votes |
@Test public void duplicateError() { int productId = 1; int reviewId = 1; assertEquals(0, repository.count()); sendCreateReviewEvent(productId, reviewId); assertEquals(1, repository.count()); try { sendCreateReviewEvent(productId, reviewId); fail("Expected a MessagingException here!"); } catch (MessagingException me) { if (me.getCause() instanceof InvalidInputException) { InvalidInputException iie = (InvalidInputException)me.getCause(); assertEquals("Duplicate key, Product Id: 1, Review Id:1", iie.getMessage()); } else { fail("Expected a InvalidInputException as the root cause!"); } } assertEquals(1, repository.count()); }
Example 7
Source File: ProductServiceApplicationTests.java From Hands-On-Microservices-with-Spring-Boot-and-Spring-Cloud with MIT License | 6 votes |
@Test public void duplicateError() { int productId = 1; assertNull(repository.findByProductId(productId).block()); sendCreateProductEvent(productId); assertNotNull(repository.findByProductId(productId).block()); try { sendCreateProductEvent(productId); fail("Expected a MessagingException here!"); } catch (MessagingException me) { if (me.getCause() instanceof InvalidInputException) { InvalidInputException iie = (InvalidInputException)me.getCause(); assertEquals("Duplicate key, Product Id: " + productId, iie.getMessage()); } else { fail("Expected a InvalidInputException as the root cause!"); } } }
Example 8
Source File: ReviewServiceApplicationTests.java From Hands-On-Microservices-with-Spring-Boot-and-Spring-Cloud with MIT License | 6 votes |
@Test public void duplicateError() { int productId = 1; int reviewId = 1; assertEquals(0, repository.count()); sendCreateReviewEvent(productId, reviewId); assertEquals(1, repository.count()); try { sendCreateReviewEvent(productId, reviewId); fail("Expected a MessagingException here!"); } catch (MessagingException me) { if (me.getCause() instanceof InvalidInputException) { InvalidInputException iie = (InvalidInputException)me.getCause(); assertEquals("Duplicate key, Product Id: 1, Review Id:1", iie.getMessage()); } else { fail("Expected a InvalidInputException as the root cause!"); } } assertEquals(1, repository.count()); }
Example 9
Source File: ReviewServiceApplicationTests.java From Hands-On-Microservices-with-Spring-Boot-and-Spring-Cloud with MIT License | 6 votes |
@Test public void duplicateError() { int productId = 1; int reviewId = 1; assertEquals(0, repository.count()); sendCreateReviewEvent(productId, reviewId); assertEquals(1, repository.count()); try { sendCreateReviewEvent(productId, reviewId); fail("Expected a MessagingException here!"); } catch (MessagingException me) { if (me.getCause() instanceof InvalidInputException) { InvalidInputException iie = (InvalidInputException)me.getCause(); assertEquals("Duplicate key, Product Id: 1, Review Id:1", iie.getMessage()); } else { fail("Expected a InvalidInputException as the root cause!"); } } assertEquals(1, repository.count()); }
Example 10
Source File: RecommendationServiceApplicationTests.java From Hands-On-Microservices-with-Spring-Boot-and-Spring-Cloud with MIT License | 6 votes |
@Test public void duplicateError() { int productId = 1; int recommendationId = 1; sendCreateRecommendationEvent(productId, recommendationId); assertEquals(1, (long)repository.count().block()); try { sendCreateRecommendationEvent(productId, recommendationId); fail("Expected a MessagingException here!"); } catch (MessagingException me) { if (me.getCause() instanceof InvalidInputException) { InvalidInputException iie = (InvalidInputException)me.getCause(); assertEquals("Duplicate key, Product Id: 1, Recommendation Id:1", iie.getMessage()); } else { fail("Expected a InvalidInputException as the root cause!"); } } assertEquals(1, (long)repository.count().block()); }
Example 11
Source File: ProductServiceApplicationTests.java From Hands-On-Microservices-with-Spring-Boot-and-Spring-Cloud with MIT License | 6 votes |
@Test public void duplicateError() { int productId = 1; assertNull(repository.findByProductId(productId).block()); sendCreateProductEvent(productId); assertNotNull(repository.findByProductId(productId).block()); try { sendCreateProductEvent(productId); fail("Expected a MessagingException here!"); } catch (MessagingException me) { if (me.getCause() instanceof InvalidInputException) { InvalidInputException iie = (InvalidInputException)me.getCause(); assertEquals("Duplicate key, Product Id: " + productId, iie.getMessage()); } else { fail("Expected a InvalidInputException as the root cause!"); } } }
Example 12
Source File: ReviewServiceApplicationTests.java From Hands-On-Microservices-with-Spring-Boot-and-Spring-Cloud with MIT License | 6 votes |
@Test public void duplicateError() { int productId = 1; int reviewId = 1; assertEquals(0, repository.count()); sendCreateReviewEvent(productId, reviewId); assertEquals(1, repository.count()); try { sendCreateReviewEvent(productId, reviewId); fail("Expected a MessagingException here!"); } catch (MessagingException me) { if (me.getCause() instanceof InvalidInputException) { InvalidInputException iie = (InvalidInputException)me.getCause(); assertEquals("Duplicate key, Product Id: 1, Review Id:1", iie.getMessage()); } else { fail("Expected a InvalidInputException as the root cause!"); } } assertEquals(1, repository.count()); }
Example 13
Source File: RecommendationServiceApplicationTests.java From Hands-On-Microservices-with-Spring-Boot-and-Spring-Cloud with MIT License | 6 votes |
@Test public void duplicateError() { int productId = 1; int recommendationId = 1; sendCreateRecommendationEvent(productId, recommendationId); assertEquals(1, (long)repository.count().block()); try { sendCreateRecommendationEvent(productId, recommendationId); fail("Expected a MessagingException here!"); } catch (MessagingException me) { if (me.getCause() instanceof InvalidInputException) { InvalidInputException iie = (InvalidInputException)me.getCause(); assertEquals("Duplicate key, Product Id: 1, Recommendation Id:1", iie.getMessage()); } else { fail("Expected a InvalidInputException as the root cause!"); } } assertEquals(1, (long)repository.count().block()); }
Example 14
Source File: ProductServiceApplicationTests.java From Hands-On-Microservices-with-Spring-Boot-and-Spring-Cloud with MIT License | 6 votes |
@Test public void duplicateError() { int productId = 1; assertNull(repository.findByProductId(productId).block()); sendCreateProductEvent(productId); assertNotNull(repository.findByProductId(productId).block()); try { sendCreateProductEvent(productId); fail("Expected a MessagingException here!"); } catch (MessagingException me) { if (me.getCause() instanceof InvalidInputException) { InvalidInputException iie = (InvalidInputException)me.getCause(); assertEquals("Duplicate key, Product Id: " + productId, iie.getMessage()); } else { fail("Expected a InvalidInputException as the root cause!"); } } }
Example 15
Source File: RecommendationServiceApplicationTests.java From Hands-On-Microservices-with-Spring-Boot-and-Spring-Cloud with MIT License | 6 votes |
@Test public void duplicateError() { int productId = 1; int recommendationId = 1; sendCreateRecommendationEvent(productId, recommendationId); assertEquals(1, (long)repository.count().block()); try { sendCreateRecommendationEvent(productId, recommendationId); fail("Expected a MessagingException here!"); } catch (MessagingException me) { if (me.getCause() instanceof InvalidInputException) { InvalidInputException iie = (InvalidInputException)me.getCause(); assertEquals("Duplicate key, Product Id: 1, Recommendation Id:1", iie.getMessage()); } else { fail("Expected a InvalidInputException as the root cause!"); } } assertEquals(1, (long)repository.count().block()); }
Example 16
Source File: RecommendationServiceApplicationTests.java From Hands-On-Microservices-with-Spring-Boot-and-Spring-Cloud with MIT License | 6 votes |
@Test public void duplicateError() { int productId = 1; int recommendationId = 1; sendCreateRecommendationEvent(productId, recommendationId); assertEquals(1, (long)repository.count().block()); try { sendCreateRecommendationEvent(productId, recommendationId); fail("Expected a MessagingException here!"); } catch (MessagingException me) { if (me.getCause() instanceof InvalidInputException) { InvalidInputException iie = (InvalidInputException)me.getCause(); assertEquals("Duplicate key, Product Id: 1, Recommendation Id:1", iie.getMessage()); } else { fail("Expected a InvalidInputException as the root cause!"); } } assertEquals(1, (long)repository.count().block()); }
Example 17
Source File: RecommendationServiceApplicationTests.java From Hands-On-Microservices-with-Spring-Boot-and-Spring-Cloud with MIT License | 6 votes |
@Test public void duplicateError() { int productId = 1; int recommendationId = 1; sendCreateRecommendationEvent(productId, recommendationId); assertEquals(1, (long)repository.count().block()); try { sendCreateRecommendationEvent(productId, recommendationId); fail("Expected a MessagingException here!"); } catch (MessagingException me) { if (me.getCause() instanceof InvalidInputException) { InvalidInputException iie = (InvalidInputException)me.getCause(); assertEquals("Duplicate key, Product Id: 1, Recommendation Id:1", iie.getMessage()); } else { fail("Expected a InvalidInputException as the root cause!"); } } assertEquals(1, (long)repository.count().block()); }
Example 18
Source File: ReviewServiceApplicationTests.java From Hands-On-Microservices-with-Spring-Boot-and-Spring-Cloud with MIT License | 6 votes |
@Test public void duplicateError() { int productId = 1; int reviewId = 1; assertEquals(0, repository.count()); sendCreateReviewEvent(productId, reviewId); assertEquals(1, repository.count()); try { sendCreateReviewEvent(productId, reviewId); fail("Expected a MessagingException here!"); } catch (MessagingException me) { if (me.getCause() instanceof InvalidInputException) { InvalidInputException iie = (InvalidInputException)me.getCause(); assertEquals("Duplicate key, Product Id: 1, Review Id:1", iie.getMessage()); } else { fail("Expected a InvalidInputException as the root cause!"); } } assertEquals(1, repository.count()); }
Example 19
Source File: RecommendationServiceApplicationTests.java From Hands-On-Microservices-with-Spring-Boot-and-Spring-Cloud with MIT License | 6 votes |
@Test public void duplicateError() { int productId = 1; int recommendationId = 1; sendCreateRecommendationEvent(productId, recommendationId); assertEquals(1, (long)repository.count().block()); try { sendCreateRecommendationEvent(productId, recommendationId); fail("Expected a MessagingException here!"); } catch (MessagingException me) { if (me.getCause() instanceof InvalidInputException) { InvalidInputException iie = (InvalidInputException)me.getCause(); assertEquals("Duplicate key, Product Id: 1, Recommendation Id:1", iie.getMessage()); } else { fail("Expected a InvalidInputException as the root cause!"); } } assertEquals(1, (long)repository.count().block()); }
Example 20
Source File: RecommendationServiceApplicationTests.java From Hands-On-Microservices-with-Spring-Boot-and-Spring-Cloud with MIT License | 6 votes |
@Test public void duplicateError() { int productId = 1; int recommendationId = 1; sendCreateRecommendationEvent(productId, recommendationId); assertEquals(1, (long)repository.count().block()); try { sendCreateRecommendationEvent(productId, recommendationId); fail("Expected a MessagingException here!"); } catch (MessagingException me) { if (me.getCause() instanceof InvalidInputException) { InvalidInputException iie = (InvalidInputException)me.getCause(); assertEquals("Duplicate key, Product Id: 1, Recommendation Id:1", iie.getMessage()); } else { fail("Expected a InvalidInputException as the root cause!"); } } assertEquals(1, (long)repository.count().block()); }