forked from awslabs/amazon-kinesis-client
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fixup! Enables property for setting AT_TIMESTAMP shard iterator initi…
…al timestamp (awslabs#341)
- Loading branch information
Showing
3 changed files
with
132 additions
and
2 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
68 changes: 68 additions & 0 deletions
68
...ava/com/amazonaws/services/kinesis/clientlibrary/config/DatePropertyValueDecoderTest.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,68 @@ | ||
/* | ||
* Copyright 2018 Amazon.com, Inc. or its affiliates. All Rights Reserved. | ||
* | ||
* Licensed under the Amazon Software License (the "License"). | ||
* You may not use this file except in compliance with the License. | ||
* A copy of the License is located at | ||
* | ||
* http://aws.amazon.com/asl/ | ||
* | ||
* or in the "license" file accompanying this file. This file is distributed | ||
* on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either | ||
* express or implied. See the License for the specific language governing | ||
* permissions and limitations under the License. | ||
*/ | ||
package com.amazonaws.services.kinesis.clientlibrary.config; | ||
|
||
import static org.junit.Assert.assertEquals; | ||
import static org.junit.Assert.fail; | ||
|
||
import java.util.Date; | ||
|
||
import org.junit.Test; | ||
|
||
import com.amazonaws.services.kinesis.clientlibrary.config.DatePropertyValueDecoder; | ||
|
||
public class DatePropertyValueDecoderTest { | ||
|
||
private DatePropertyValueDecoder decoder = new DatePropertyValueDecoder(); | ||
|
||
private static final String TEST_VALUE = "1527267472"; | ||
|
||
@Test | ||
public void testNumericValue() { | ||
Date timestamp = decoder.decodeValue(TEST_VALUE); | ||
assertEquals(timestamp.getClass(), Date.class); | ||
assertEquals(timestamp, new Date(Long.parseLong(TEST_VALUE) * 1000L)); | ||
} | ||
|
||
@Test | ||
public void testEmptyValue() { | ||
try { | ||
Date timestamp = decoder.decodeValue(""); | ||
fail("Expect IllegalArgumentException on empty value"); | ||
} catch (IllegalArgumentException e) { | ||
// success | ||
} | ||
} | ||
|
||
@Test | ||
public void testNullValue() { | ||
try { | ||
Date timestamp = decoder.decodeValue(null); | ||
fail("Expect IllegalArgumentException on null value"); | ||
} catch (IllegalArgumentException e) { | ||
// success | ||
} | ||
} | ||
|
||
@Test | ||
public void testNonNumericValue() { | ||
try { | ||
Date timestamp = decoder.decodeValue("123abc"); | ||
fail("Expect IllegalArgumentException on non numeric value"); | ||
} catch (IllegalArgumentException e) { | ||
// success | ||
} | ||
} | ||
} |
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