Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
36 changes: 36 additions & 0 deletions src/test/java/com/josdem/jmetadata/util/ImageIconBaseTests.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
package com.josdem.jmetadata.util;

import static org.junit.jupiter.api.Assertions.assertNotNull;
import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.when;

import javax.swing.ImageIcon;

import org.junit.jupiter.api.BeforeAll;
import org.junit.jupiter.api.Test;

class ImageIconBaseTests {
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Following name conventions this class should be named: ImageIconBaseTest please change it


private static ImageIconBase imageIconBase;

@BeforeAll
static void init() {
imageIconBase = mock(ImageIconBase.class);
}

@Test
void testGetImageIcon() {
// Given
String imagePath = "path/to/image.png";
var expectedImageIcon = new ImageIcon(imagePath);
when(imageIconBase.getImageIcon()).thenReturn(expectedImageIcon);

// When
ImageIcon result = imageIconBase.getImageIcon();
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This could be var result = imageIconBase.getImageIcon(); please change it


// Then
assertNotNull(result);
assertEquals(expectedImageIcon.getDescription(), result.getDescription());
}
}