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
if(length < 8 && length > 50){ | |
throw new IllegalArgumentException(); | |
} |
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
if(length < 8 && length > 50){ | |
throw new IllegalArgumentException(); | |
} |
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
@Test | |
public void cannotRequestSequencesShorterThanEight() throws Exception { | |
try | |
{ | |
new FibonacciGenerator().getSequenceOfLength(7); | |
fail(); | |
} | |
catch(Exception e) | |
{ | |
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
if(length < 8){ | |
throw new RuntimeException(); | |
} |
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
@Test(expected=IllegalArgumentException.class) | |
public void cannotRequestSequencesShorterThanEight() throws Exception { | |
new FibonacciGenerator().getSequenceOfLength(7); | |
} |
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
def tick(cell, number_of_neighbors) | |
if number_of_neighbors < 2 || number_of_neighbors > 3 | |
cell.setAlive false | |
end | |
if number_of_neighbors == 3 | |
cell.setAlive true | |
end | |
end |
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 CustomerServices | |
{ | |
public string FetchCustomerXmlById(int customerId) | |
{ | |
Customer customer = DataRepository.GetCustomer(customerId); | |
string xml = "<Error>Customer not found</Error>"; | |
if(customer != null) | |
{ | |
xml = "<Customer id='" + customerId + "'>" + customer.Name + "</Customer>"; | |
} |
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 CustomerServices | |
{ | |
public string FetchCustomerXmlById(int customerId) | |
{ | |
Customer customer = new DataRepository().GetCustomer(customerId); | |
string xml = "<Error>Customer not found</Error>"; | |
if(customer != null) | |
{ | |
xml = "<Customer id='" + customerId + "'>" + customer.Name + "</Customer>"; | |
} |
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 interface IDataRepository | |
{ | |
Customer GetCustomer(int customerId); | |
IList<Customer> FindCustomers(string nameToMatch); | |
} |
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 CustomerServices | |
{ | |
private readonly IDataRepository dataRepository; | |
public CustomerServices(IDataRepository repository) | |
{ | |
dataRepository = repository; | |
} | |
public string FetchCustomerXmlById(int customerId) |