use of org.junit.jupiter.api.BeforeAll in project java-design-patterns by iluwatar.
the class IntegrationTest method initializeAndPopulateDatabase.
@BeforeAll
public static void initializeAndPopulateDatabase() {
commandService = new CommandServiceImpl();
queryService = new QueryServiceImpl();
// create first author1
commandService.authorCreated("username1", "name1", "email1");
// create author1 and update all its data
commandService.authorCreated("username2", "name2", "email2");
commandService.authorEmailUpdated("username2", "new_email2");
commandService.authorNameUpdated("username2", "new_name2");
commandService.authorUsernameUpdated("username2", "new_username2");
// add book1 to author1
commandService.bookAddedToAuthor("title1", 10, "username1");
// add book2 to author1 and update all its data
commandService.bookAddedToAuthor("title2", 20, "username1");
commandService.bookPriceUpdated("title2", 30);
commandService.bookTitleUpdated("title2", "new_title2");
}
use of org.junit.jupiter.api.BeforeAll in project java-design-patterns by iluwatar.
the class DateFormatCallableTest method setup.
/**
* Run Callable and prepare results for usage in the test methods
*/
@BeforeAll
public static void setup() {
// Create a callable
DateFormatCallable callableDf = new DateFormatCallable("dd/MM/yyyy", "15/12/2015");
// start thread using the Callable instance
ExecutorService executor = Executors.newCachedThreadPool();
Future<Result> futureResult = executor.submit(callableDf);
try {
result = futureResult.get();
createdDateValues = convertDatesToString(result);
} catch (Exception e) {
fail("Setup failed: " + e);
}
executor.shutdown();
}
use of org.junit.jupiter.api.BeforeAll in project VocabHunter by VocabHunter.
the class AnalysisSystemTest method setUpClass.
@BeforeAll
public static void setUpClass() throws Exception {
Analyser analyser = new SimpleAnalyser();
FileStreamer target = new FileStreamer(analyser);
URL resource = FileStreamerTest.class.getResource("/" + INPUT_DOCUMENT);
Path file = Paths.get(resource.toURI());
EnrichedSessionState enrichedSession = target.createNewSession(file);
SessionState sessionState = enrichedSession.getState();
words = sessionState.getOrderedUses();
}
use of org.junit.jupiter.api.BeforeAll in project java-design-patterns by iluwatar.
the class DateFormatCallableTestIncorrectDateFormat method setup.
/**
* Run Callable and prepare results for usage in the test methods
*/
@BeforeAll
public static void setup() {
// Create a callable. Pass a string date value not matching the format string
DateFormatCallable callableDf = new DateFormatCallable("dd/MM/yyyy", "15.12.2015");
// start thread using the Callable instance
ExecutorService executor = Executors.newCachedThreadPool();
Future<Result> futureResult = executor.submit(callableDf);
try {
result = futureResult.get();
} catch (Exception e) {
fail("Setup failed: " + e);
}
executor.shutdown();
}
use of org.junit.jupiter.api.BeforeAll in project java-design-patterns by iluwatar.
the class DateFormatCallableTestMultiThread method setup.
/**
* Run Callable and prepare results for usage in the test methods
*/
@BeforeAll
public static void setup() {
// Create a callable
DateFormatCallable callableDf = new DateFormatCallable("dd/MM/yyyy", "15/12/2015");
// start thread using the Callable instance
ExecutorService executor = Executors.newCachedThreadPool();
Future<Result> futureResult1 = executor.submit(callableDf);
Future<Result> futureResult2 = executor.submit(callableDf);
Future<Result> futureResult3 = executor.submit(callableDf);
Future<Result> futureResult4 = executor.submit(callableDf);
try {
result[0] = futureResult1.get();
result[1] = futureResult2.get();
result[2] = futureResult3.get();
result[3] = futureResult4.get();
for (int i = 0; i < result.length; i++) {
createdDateValues[i] = convertDatesToString(result[i]);
}
} catch (Exception e) {
fail("Setup failed: " + e);
}
executor.shutdown();
}
Aggregations