Skip to content

Commit bec76b0

Browse files
committed
refact: rename
1 parent bdf49b5 commit bec76b0

File tree

3 files changed

+52
-2
lines changed

3 files changed

+52
-2
lines changed

pom.xml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,8 @@
77
<description>Meant for enabling applications to use HTTP at ease, without having to compromise the clean state of the overall architecture.</description>
88
<url>https://github.com/clean-arch-enablers-project/cae-utils-http-client/blob/main/README.md</url>
99
<groupId>com.clean-arch-enablers</groupId>
10-
<artifactId>http-client</artifactId>
11-
<version>1.1.1</version>
10+
<artifactId>cae-http-client</artifactId>
11+
<version>1.0.0</version>
1212
<packaging>jar</packaging>
1313
<licenses>
1414
<license>
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
package com.cae.http_client;
2+
3+
import com.cae.http_client.implementations.HttpRequestStarterImplementation;
4+
import lombok.AccessLevel;
5+
import lombok.NoArgsConstructor;
6+
7+
@NoArgsConstructor(access = AccessLevel.PRIVATE)
8+
public class CaeHttpClientFactory {
9+
10+
public static final HttpRequestStarter REQUEST_STARTER = new HttpRequestStarterImplementation();
11+
12+
public static HttpRequestStarter getSingletonClient(){
13+
return CaeHttpClientFactory.REQUEST_STARTER;
14+
}
15+
16+
}
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
package com.cae.http_client;
2+
3+
import org.junit.jupiter.api.Assertions;
4+
import org.junit.jupiter.api.Test;
5+
import org.junit.jupiter.api.extension.ExtendWith;
6+
import org.mockito.junit.jupiter.MockitoExtension;
7+
8+
@ExtendWith(MockitoExtension.class)
9+
class CaeHttpClientFactoryTest {
10+
11+
@Test
12+
void shouldReturnFilledInstance(){
13+
Assertions.assertNotNull(CaeHttpClientFactory.REQUEST_STARTER);
14+
}
15+
16+
@Test
17+
void shouldReturnSingletonInstanceWhenDirectlyCallingAttribute(){
18+
var resultFromCallOne = CaeHttpClientFactory.REQUEST_STARTER;
19+
var resultFromCallTwo = CaeHttpClientFactory.REQUEST_STARTER;
20+
var resultFromCallThree = CaeHttpClientFactory.REQUEST_STARTER;
21+
Assertions.assertEquals(resultFromCallOne, resultFromCallTwo);
22+
Assertions.assertEquals(resultFromCallTwo, resultFromCallThree);
23+
}
24+
25+
@Test
26+
void shouldReturnSingletonInstanceWhenCallingGetter(){
27+
var resultFromCallOne = CaeHttpClientFactory.getSingletonClient();
28+
var resultFromCallTwo = CaeHttpClientFactory.getSingletonClient();
29+
var resultFromCallThree = CaeHttpClientFactory.getSingletonClient();
30+
Assertions.assertEquals(resultFromCallOne, resultFromCallTwo);
31+
Assertions.assertEquals(resultFromCallTwo, resultFromCallThree);
32+
}
33+
34+
}

0 commit comments

Comments
 (0)