class ViewCustomizer {

    public StartingPosition getStartingPosition() {
        final String requestedAction = consumeRequest.getAction();

        switch (requestedAction) {
            case "head":
                return StartingPosition.newHeadPosition();
            case "tail":
                return StartingPosition.newTailPosition();
            case "timestamp":
                return StartingPosition.newPositionFromTimestamp(consumeRequest.getTimestamp());
            case "offsets":
                // todo
            default:
                // Fall back to resume from existing
                return StartingPosition.newResumeFromExistingState();
        }
    }

}

class ViewCustomizerTest {

    @Test
    public void testStartingPositionTimestamp() {

        final long timestamp = 2432323L;

        // Create consume request
        final ConsumeRequest consumeRequest = new ConsumeRequest();
        consumeRequest.setAction("timestamp");
        consumeRequest.setTimestamp(timestamp);

        // Create instance & override
        final ViewCustomizer viewCustomizer = new ViewCustomizer(new View(), consumeRequest);
        final StartingPosition startingPosition = viewCustomizer.getStartingPosition();

        // validate
        assertNotNull(startingPosition);
        assertFalse(startingPosition.isStartFromTail());
        assertFalse(startingPosition.isStartFromOffsets());
        assertTrue(startingPosition.isStartFromTimestamp());
        assertFalse(startingPosition.isStartFromHead());
        assertEquals("Has expected timestamp", timestamp, startingPosition.getTimestamp());
    }

}