/******************************************************************************************************************* * ******************************************************************************************************************/ @BeforeMethod public void setupFixture() throws Exception { MockResponseBuilder.setCurrentTime(currentTime); resourceFile = mock(ResourceFile.class); when(resourceFile.asBytes()).thenReturn("FILE CONTENT".getBytes()); when(resourceFile.getMimeType()).thenReturn("text/plain"); when(resourceFile.getLatestModificationTime()).thenReturn(resourceLatestModifiedTime); headers = new HashMap<>(); request = mock(Request.class); when(request.getHeader(anyString())).thenAnswer(new Answer<String>() { @Override @Nonnull public String answer (final @Nonnull InvocationOnMock invocation) throws NotFoundException { final String name = (String)invocation.getArguments()[0]; return NotFoundException.throwWhenNull(headers.get(name), "Not found " + name); } }); underTest = new MockResponseHolder(); }
verify(mediaFile, times(0)).getLatestModificationTime();
when(mediaFile.getLatestModificationTime()).thenReturn(now.plusMillis(1)); nextExpectedExpirationTime = now.plusSeconds(underTest.getMedatataExpirationTime()); verify(mediaFile, times(count)).getLatestModificationTime();
.withBody(content) .withContentType(mimeType) .withLatestModifiedTime(file.getLatestModificationTime()) .withExpirationTime(duration) .put();
when(mediaFile.getLatestModificationTime()).thenReturn(initialTime.minusMillis(1)); verify(mediaFile, times(count)).getLatestModificationTime();