-
Notifications
You must be signed in to change notification settings - Fork 18
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
SDK-590: Standardise Image functionality
- Loading branch information
Showing
11 changed files
with
105 additions
and
16 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
31 changes: 31 additions & 0 deletions
31
yoti-sdk-impl/src/test/java/com/yoti/api/client/spi/remote/JpegAttributeValueTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
package com.yoti.api.client.spi.remote; | ||
|
||
import static org.junit.Assert.assertArrayEquals; | ||
import static org.junit.Assert.assertEquals; | ||
import static org.junit.Assert.assertNotSame; | ||
|
||
import org.junit.Test; | ||
|
||
public class JpegAttributeValueTest { | ||
|
||
private static final byte[] IMAGE_DATA = new byte[] { 0, 1, 2, 3 }; | ||
|
||
JpegAttributeValue testObj = new JpegAttributeValue(IMAGE_DATA); | ||
|
||
@Test | ||
public void shouldReturnCopyOfTheData() { | ||
byte[] result = testObj.getContent(); | ||
|
||
assertArrayEquals(IMAGE_DATA, result); | ||
assertNotSame(IMAGE_DATA, result); | ||
} | ||
|
||
@Test | ||
public void shouldReturnBase64Selfie() { | ||
String result = testObj.getBase64Content(); | ||
|
||
String base64Data = Base64.getEncoder().encodeToString(IMAGE_DATA); | ||
assertEquals("data:image/jpeg;base64," + base64Data, result); | ||
} | ||
|
||
} |
31 changes: 31 additions & 0 deletions
31
yoti-sdk-impl/src/test/java/com/yoti/api/client/spi/remote/PngAttributeValueTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
package com.yoti.api.client.spi.remote; | ||
|
||
import static org.junit.Assert.assertArrayEquals; | ||
import static org.junit.Assert.assertEquals; | ||
import static org.junit.Assert.assertNotSame; | ||
|
||
import org.junit.Test; | ||
|
||
public class PngAttributeValueTest { | ||
|
||
private static final byte[] IMAGE_DATA = new byte[] { 0, 1, 2, 3 }; | ||
|
||
PngAttributeValue testObj = new PngAttributeValue(IMAGE_DATA); | ||
|
||
@Test | ||
public void shouldReturnCopyOfTheData() { | ||
byte[] result = testObj.getContent(); | ||
|
||
assertArrayEquals(IMAGE_DATA, result); | ||
assertNotSame(IMAGE_DATA, result); | ||
} | ||
|
||
@Test | ||
public void shouldReturnBase64Selfie() { | ||
String result = testObj.getBase64Content(); | ||
|
||
String base64Data = Base64.getEncoder().encodeToString(IMAGE_DATA); | ||
assertEquals("data:image/png;base64," + base64Data, result); | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters