Skip to content

Commit ccada82

Browse files
committed
remove duplicate variable and fix intendation
Signed-off-by: Manish Dait <[email protected]>
1 parent 11ce705 commit ccada82

File tree

1 file changed

+39
-44
lines changed

1 file changed

+39
-44
lines changed

hiero-enterprise-base/src/test/java/com/openelements/hiero/base/test/FileClientImplTest.java

Lines changed: 39 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@
1717
import org.junit.jupiter.api.Assertions;
1818
import org.junit.jupiter.api.BeforeEach;
1919
import org.junit.jupiter.api.Test;
20-
import org.mockito.Mock;
2120
import org.mockito.Mockito;
2221

2322
import java.time.Instant;
@@ -35,15 +34,11 @@
3534
public class FileClientImplTest {
3635
ProtocolLayerClient protocolLayerClient;
3736
FileClientImpl fileClientImpl;
38-
39-
@Mock
40-
private FileClientImpl fileClient;
4137

4238
@BeforeEach
4339
void setup() {
4440
protocolLayerClient = Mockito.mock(ProtocolLayerClient.class);
4541
fileClientImpl = new FileClientImpl(protocolLayerClient);
46-
fileClient = new FileClientImpl(protocolLayerClient);
4742
}
4843

4944
@Test
@@ -277,47 +272,47 @@ void testGetFileSizeThrowsExceptionForNullId() {
277272
}
278273

279274

280-
//tests for deletefile method
281-
@Test
282-
public void testIsDeleted_FileIsDeleted() throws HieroException {
283-
// Given
284-
FileId fileId = FileId.fromString("0.0.123");
285-
FileInfoResponse response = mock(FileInfoResponse.class);
286-
when(protocolLayerClient.executeFileInfoQuery(any(FileInfoRequest.class))).thenReturn(response);
287-
when(response.deleted()).thenReturn(true);
288-
289-
// When
290-
boolean result = fileClient.isDeleted(fileId);
291-
292-
// Then
293-
assertTrue(result);
294-
}
295-
296-
@Test
297-
public void testIsDeleted_FileIsNotDeleted() throws HieroException {
298-
// Given
299-
FileId fileId = FileId.fromString("0.0.123");
300-
FileInfoResponse response = mock(FileInfoResponse.class);
301-
when(protocolLayerClient.executeFileInfoQuery(any(FileInfoRequest.class))).thenReturn(response);
302-
when(response.deleted()).thenReturn(false);
303-
304-
// When
305-
boolean result = fileClient.isDeleted(fileId);
306-
307-
// Then
308-
assertFalse(result);
309-
}
275+
//tests for deletefile method
276+
@Test
277+
public void testIsDeleted_FileIsDeleted() throws HieroException {
278+
// Given
279+
FileId fileId = FileId.fromString("0.0.123");
280+
FileInfoResponse response = mock(FileInfoResponse.class);
281+
when(protocolLayerClient.executeFileInfoQuery(any(FileInfoRequest.class))).thenReturn(response);
282+
when(response.deleted()).thenReturn(true);
283+
284+
// When
285+
boolean result = fileClientImpl.isDeleted(fileId);
286+
287+
// Then
288+
assertTrue(result);
289+
}
310290

311-
@Test
312-
public void testIsDeleted_NullFileId() {
313-
// When
314-
NullPointerException exception = assertThrows(NullPointerException.class, () -> {
315-
fileClient.isDeleted(null);
316-
});
291+
@Test
292+
public void testIsDeleted_FileIsNotDeleted() throws HieroException {
293+
// Given
294+
FileId fileId = FileId.fromString("0.0.123");
295+
FileInfoResponse response = mock(FileInfoResponse.class);
296+
when(protocolLayerClient.executeFileInfoQuery(any(FileInfoRequest.class))).thenReturn(response);
297+
when(response.deleted()).thenReturn(false);
298+
299+
// When
300+
boolean result = fileClientImpl.isDeleted(fileId);
301+
302+
// Then
303+
assertFalse(result);
304+
}
317305

318-
// Then
319-
assertEquals("fileId must not be null", exception.getMessage());
320-
}
306+
@Test
307+
public void testIsDeleted_NullFileId() {
308+
// When
309+
NullPointerException exception = assertThrows(NullPointerException.class, () -> {
310+
fileClientImpl.isDeleted(null);
311+
});
312+
313+
// Then
314+
assertEquals("fileId must not be null", exception.getMessage());
315+
}
321316

322317

323318
@Test

0 commit comments

Comments
 (0)