From d0cfc943eeeebeb61a9dd50ab6f43a8499dc9765 Mon Sep 17 00:00:00 2001 From: Karim Elmosalamy Date: Sun, 12 May 2024 15:58:38 +0300 Subject: [PATCH] formating --- .../contracts/ContractsApplicationTests.java | 74 ++++++++----------- .../com/workup/contracts/TestConfigBase.java | 8 +- 2 files changed, 35 insertions(+), 47 deletions(-) diff --git a/services/contracts/src/test/java/com/workup/contracts/ContractsApplicationTests.java b/services/contracts/src/test/java/com/workup/contracts/ContractsApplicationTests.java index f73c83f8..ac6e5ec8 100644 --- a/services/contracts/src/test/java/com/workup/contracts/ContractsApplicationTests.java +++ b/services/contracts/src/test/java/com/workup/contracts/ContractsApplicationTests.java @@ -3,10 +3,7 @@ import com.workup.contracts.repositories.ContractMilestoneRepository; import com.workup.contracts.repositories.ContractRepository; import com.workup.contracts.repositories.TerminationRequestRepository; -import com.workup.shared.commands.jobs.requests.CreateJobRequest; -import com.workup.shared.commands.jobs.responses.CreateJobResponse; -import com.workup.shared.enums.HttpStatusCode; -import com.workup.shared.enums.ServiceQueueNames; +import java.text.ParseException; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; import org.springframework.amqp.core.AmqpTemplate; @@ -20,12 +17,6 @@ import org.testcontainers.junit.jupiter.Container; import org.testcontainers.junit.jupiter.Testcontainers; -import java.text.ParseException; -import java.util.UUID; - -import static org.junit.Assert.assertNotNull; -import static org.junit.Assert.assertTrue; - @SpringBootTest @Testcontainers @Import(TestConfigBase.class) @@ -33,7 +24,7 @@ class ContractsApplicationTests { @Container static CassandraContainer cassandraContainer = - new CassandraContainer<>("cassandra:4.0.7").withConfigurationOverride("cassandra-config"); + new CassandraContainer<>("cassandra:4.0.7").withConfigurationOverride("cassandra-config"); @Container static RabbitMQContainer rabbitMQContainer = new RabbitMQContainer("rabbitmq:3.13-management"); @@ -44,7 +35,8 @@ static String GetCassandraContactPoint() { @DynamicPropertySource static void datasourceProperties(DynamicPropertyRegistry registry) { - registry.add("spring.cassandra.contact-points", ContractsApplicationTests::GetCassandraContactPoint); + registry.add( + "spring.cassandra.contact-points", ContractsApplicationTests::GetCassandraContactPoint); registry.add("spring.rabbitmq.host", rabbitMQContainer::getHost); registry.add("spring.rabbitmq.port", rabbitMQContainer::getFirstMappedPort); @@ -56,14 +48,10 @@ static void datasourceProperties(DynamicPropertyRegistry registry) { private static final String CLIENT_TWO_ID = "456"; private static final String FREELANCER_ONE_ID = "789"; - @Autowired - AmqpTemplate template; - @Autowired - ContractRepository contractRepository; - @Autowired - ContractMilestoneRepository contractMilestoneRepository; - @Autowired - TerminationRequestRepository terminationRequestRepository; + @Autowired AmqpTemplate template; + @Autowired ContractRepository contractRepository; + @Autowired ContractMilestoneRepository contractMilestoneRepository; + @Autowired TerminationRequestRepository terminationRequestRepository; @BeforeEach void clearAll() { @@ -72,7 +60,6 @@ void clearAll() { terminationRequestRepository.deleteAll(); } - /** * Creates a job request. * @@ -81,27 +68,28 @@ void clearAll() { @Test void testCreateJob() { // Example test from jobs -// CreateJobRequest createJobRequest = -// CreateJobRequest.builder() -// .withTitle("Convert HTML Template to React 3") -// .withDescription( -// "I have an HTML template that I have purchased and own the rights to. I would like" -// + " it converted into a React application.") -// .withSkills(new String[] {"HTML", "CSS", "JavaScript", "React"}) -// .withUserId(CLIENT_ONE_ID) -// .build(); -// -// CreateJobResponse response = -// (CreateJobResponse) -// template.convertSendAndReceive(ServiceQueueNames.JOBS, createJobRequest); -// -// assertNotNull(response); -// assertTrue(response.getStatusCode() == HttpStatusCode.CREATED); -// -// jobRepository -// .findById(UUID.fromString(response.getJobId())) -// .ifPresentOrElse( -// job -> assertTrue(job.getTitle().equals(createJobRequest.getTitle())), -// () -> new RuntimeException("Job not found")); + // CreateJobRequest createJobRequest = + // CreateJobRequest.builder() + // .withTitle("Convert HTML Template to React 3") + // .withDescription( + // "I have an HTML template that I have purchased and own the rights + // to. I would like" + // + " it converted into a React application.") + // .withSkills(new String[] {"HTML", "CSS", "JavaScript", "React"}) + // .withUserId(CLIENT_ONE_ID) + // .build(); + // + // CreateJobResponse response = + // (CreateJobResponse) + // template.convertSendAndReceive(ServiceQueueNames.JOBS, createJobRequest); + // + // assertNotNull(response); + // assertTrue(response.getStatusCode() == HttpStatusCode.CREATED); + // + // jobRepository + // .findById(UUID.fromString(response.getJobId())) + // .ifPresentOrElse( + // job -> assertTrue(job.getTitle().equals(createJobRequest.getTitle())), + // () -> new RuntimeException("Job not found")); } } diff --git a/services/contracts/src/test/java/com/workup/contracts/TestConfigBase.java b/services/contracts/src/test/java/com/workup/contracts/TestConfigBase.java index 92856494..acf2801d 100644 --- a/services/contracts/src/test/java/com/workup/contracts/TestConfigBase.java +++ b/services/contracts/src/test/java/com/workup/contracts/TestConfigBase.java @@ -7,8 +7,8 @@ @TestConfiguration public class TestConfigBase { - @Bean - public Queue contractsQueueMock() { - return new Queue(ServiceQueueNames.CONTRACTS); - } + @Bean + public Queue contractsQueueMock() { + return new Queue(ServiceQueueNames.CONTRACTS); + } }