Source format and clean-up
This commit is contained in:
@@ -20,25 +20,24 @@ import org.springframework.data.annotation.Id;
|
||||
|
||||
public class Customer {
|
||||
|
||||
@Id
|
||||
private String id;
|
||||
@Id
|
||||
private String id;
|
||||
|
||||
private String firstName;
|
||||
private String lastName;
|
||||
private String firstName;
|
||||
private String lastName;
|
||||
|
||||
public Customer() {}
|
||||
public Customer() {
|
||||
}
|
||||
|
||||
public Customer(String firstName, String lastName) {
|
||||
this.firstName = firstName;
|
||||
this.lastName = lastName;
|
||||
}
|
||||
public Customer(String firstName, String lastName) {
|
||||
this.firstName = firstName;
|
||||
this.lastName = lastName;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return String.format(
|
||||
"Customer[id=%s, firstName='%s', lastName='%s']",
|
||||
id, firstName, lastName);
|
||||
}
|
||||
@Override
|
||||
public String toString() {
|
||||
return String.format("Customer[id=%s, firstName='%s', lastName='%s']", id,
|
||||
firstName, lastName);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -22,8 +22,8 @@ import org.springframework.data.mongodb.repository.MongoRepository;
|
||||
|
||||
public interface CustomerRepository extends MongoRepository<Customer, String> {
|
||||
|
||||
public Customer findByFirstName(String firstName);
|
||||
public Customer findByFirstName(String firstName);
|
||||
|
||||
public List<Customer> findByLastName(String lastName);
|
||||
public List<Customer> findByLastName(String lastName);
|
||||
|
||||
}
|
||||
|
||||
@@ -27,7 +27,7 @@ import org.springframework.core.NestedCheckedException;
|
||||
|
||||
/**
|
||||
* Tests for {@link SampleMongoApplication}.
|
||||
*
|
||||
*
|
||||
* @author Dave Syer
|
||||
*/
|
||||
public class SampleMongoApplicationTests {
|
||||
@@ -39,13 +39,15 @@ public class SampleMongoApplicationTests {
|
||||
public void testDefaultSettings() throws Exception {
|
||||
try {
|
||||
SampleMongoApplication.main(new String[0]);
|
||||
} catch (IllegalStateException ex) {
|
||||
}
|
||||
catch (IllegalStateException ex) {
|
||||
if (serverNotRunning(ex)) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
String output = this.outputCapture.toString();
|
||||
assertTrue("Wrong output: " + output, output.contains("firstName='Alice', lastName='Smith'"));
|
||||
assertTrue("Wrong output: " + output,
|
||||
output.contains("firstName='Alice', lastName='Smith'"));
|
||||
}
|
||||
|
||||
private boolean serverNotRunning(IllegalStateException e) {
|
||||
|
||||
Reference in New Issue
Block a user