This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
license: mit |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
license: mit |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
... | |
<flow name="greetingFlow" > | |
... | |
<invoke object-ref="greetingService" method="sayHello" | |
methodArguments="#[message.inboundProperties.'http.query.params'.name]" | |
doc:name="Invoke Component"/> | |
</flow> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Stock stock = spy(Stock.class); | |
doReturn(100.00).when(stock).getPrice(); // Mock implementation | |
doReturn(200).when(stock).getQuantity(); // Mock implementation | |
// All other method call will use the real implementations |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Stock stock = mock(Stock.class); | |
when(stock.getPrice()).thenReturn(100.00); // Mock implementation | |
when(stock.getQuantity()).thenReturn(200); // Mock implementation | |
when(stock.getValue()).thenCallRealMethod(); // Real implementation |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class Stock { | |
private final double price; | |
private final int quantity; | |
Stock(double price, int quantity) { | |
this.price = price; | |
this.quantity = quantity; | |
} | |
public double getPrice() { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public void lend(bookId, memberId) { | |
{ | |
// check preconditions and other logic | |
availableCopies - ; | |
domainEventBus.raise(new BookIssuedEvent(bookId, memberId)); | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
issueBook(IssueBooksCommand bookIssueCommand) { | |
Book book = bookRepository.geBookWithUid(bookId); | |
book.lend(member.getId(), booksAlreadyWithMember); | |
bookRepository.lend(book); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
issueBook(IssueBooksCommand bookIssueCommand) { | |
Book book = bookRepository.geBookWithUid(bookId); | |
book.lend(member.getId(), booksAlreadyWithMember); | |
bookRepository.lend(book); | |
// Action performed after a book has been issued | |
emailService.notifyMember(member, book); | |
// Action performed after a book has been issued | |
recordIntoBookLending(member, book); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#%RAML 1.0 | |
title: Sanford Events | |
baseUri: http://api.samplehost.com/{version} | |
version: v1 | |
types: | |
EventNotification: | |
type: object | |
properties: | |
eventId: | |
type: string |
NewerOlder