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 CharityControllerTest extends WithServer { | |
private Clock clock; | |
@Override | |
protected Application provideApplication() { | |
return new GuiceApplicationBuilder() | |
.overrides(bindClockToMockInstance()) | |
.build(); | |
} |
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
GET / controllers.CharityController.index() |
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 CharityController { | |
private final CharityRepository charityRepository; | |
private final HttpExecutionContext ec; | |
private final LocalDateTime endDateTime; | |
private final Clock clock; | |
@Inject | |
public CharityController(CharityRepository charityRepository, | |
HttpExecutionContext ec, |
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 DatabaseExecutionContext extends CustomExecutionContext { | |
@Inject | |
public DatabaseExecutionContext(ActorSystem actorSystem) { | |
super(actorSystem, "database.dispatcher"); | |
} | |
} |
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
private <T> CompletionStage<T> wrapContext(Supplier<T> toRun) { | |
return supplyAsync(toRun, executionContext); | |
} | |
public CompletionStage<List<Charity>> findList() { | |
return wrapContext(() -> ebeanServer.find(Charity.class).findList()); | |
} |
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
@Entity | |
@Table(name="charity") | |
public class Charity extends Model { | |
@Id | |
public Integer id; | |
@Column(name="name") | |
public String name; |
NewerOlder