This file contains hidden or 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
#!/bin/bash | |
true |
This file contains hidden or 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
#!/bin/bash | |
download_yuml_image() { | |
local file="$1" | |
local output_directory="$2" | |
instructions=$(tr "\\n" "," < <(cat $file)) | |
image_basename=$(basename $(echo $file | sed -E "s/(.+)\.yuml$/\1/")) | |
image_filename="${output_directory}/${image_basename}.png" |
This file contains hidden or 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
new RollbackOnExceptionAction(new JtaTransactionService()) | |
.executeInTransaction(new Closure() { | |
@Override | |
public void execute(Object... arguments) { | |
// cast arguments | |
// perform action | |
// throw exception if there's a problem | |
} | |
}); |
This file contains hidden or 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
@Test | |
public void ioFailure() throws Exception { | |
final IOException ioFailure = new IOException("Simulating a failure writing to the file."); | |
try { | |
new WriteTextToFileActionImpl() { | |
@Override | |
protected FileWriter fileWriterOn(File path) throws IOException { | |
return new FileWriter(path) { | |
@Override | |
public void write(String str, int off, int len) throws IOException { |
This file contains hidden or 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
it "should render a partial for all the items" do | |
assign(:parent, parent_with_many_items) | |
# Ewww! Stubs aren't mocks! | |
stub_template "_item.html.erb" => %Q{<span class="item"><%= item.nil? %></span>} | |
render | |
rendered.all("span.item").map(&:text).should == ["false", "false", "false"] | |
end |
This file contains hidden or 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 BusinessObject { | |
/** @deprecated */ | |
public void actionMethod() { | |
actionMethod(Service.getInstance()); | |
} | |
// A SEAM! A SEAM! New clients should use me!! | |
public void actionMethod(ServiceDelegate serviceDelegate) { | |
// Other things | |
serviceDelegate.doService(); |
This file contains hidden or 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
package ca.jbrains.junit; | |
import static org.junit.Assert.assertTrue; | |
import java.util.ArrayList; | |
import java.util.LinkedList; | |
import java.util.List; | |
import org.junit.Test; |
This file contains hidden or 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
class UserGestureListener | |
def on_barcode_scanned(barcode) | |
product = @catalog.find(barcode) | |
if product.nil? | |
@display.display_message(ProductNotFoundMessage.with(barcode)) | |
else | |
@display.display_product(product) | |
accumulate_cost(product) | |
end | |
end |
This file contains hidden or 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
package ca.jbrains.auction.test; | |
public class Main { | |
public interface AuctionEventListener { | |
void handleNewBiddingState(BiddingState biddingState); | |
void handleGenericEvent(Object object); | |
} | |
public static class AuctionEventSourceMessageListener implements |
This file contains hidden or 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
package ca.jbrains.auction.test; | |
public class Main { | |
public static abstract class FooMessageListener implements MessageListener { | |
@Override | |
public void processMessage(Chat chat, Message message) { | |
final Object event = Messages.parse(message); | |
if (event instanceof BiddingState) { | |
BiddingState biddingState = (BiddingState) event; | |
handleBiddingStateEvent(chat, biddingState); |