public void testAsPngSetAsExtras() { builder.asPng(true); Intent intent = builder.getIntent(activity); assertThat(intent.getBooleanExtra("as_png", false)).isEqualTo(true); } }
@Test public void shouldHaveCorrectConfiguration() { if ("debug".equals(BuildConfig.BUILD_TYPE)) { assertThat(BuildConfig.DEBUG).isTrue(); } else if ("release".equals(BuildConfig.BUILD_TYPE)) { assertThat(BuildConfig.DEBUG).isFalse(); } else { fail("build type configuration not tested or supported?"); } } }
@Test public void testThatWorks() { assertThat(true).isTrue(); } }
@Test public void checkIsHidden() throws IOException { final SimpleFileSystemProvider fsProvider = new SimpleFileSystemProvider(); final Path path = GeneralPathImpl.create( fsProvider.getFileSystem( URI.create( "file:///" ) ), "/path/to/file.txt", false ); assertThat( fsProvider.isHidden( path ) ).isFalse(); final File tempFile = File.createTempFile( "foo", "bar" ); final Path path2 = GeneralPathImpl.newFromFile( fsProvider.getFileSystem( URI.create( "file:///" ) ), tempFile ); assertThat( fsProvider.isHidden( path2 ) ).isEqualTo( tempFile.isHidden() ); }
public ProcessInstanceAssert isStarted() { isNotNull(); Assertions.assertThat(actual.isEnded()). overridingErrorMessage("Expected processExecution %s to be started but it is not!", actual.getId()). isFalse(); return this; }
@Test public void testOnlyAllowLowercase() throws Exception { String lowercase = "a"; String uppercase = "A"; boolean valid = haikuReview.validateHaikuCharacters(lowercase); assertThat(valid).isTrue(); boolean invalid = haikuReview.validateHaikuCharacters(uppercase); assertThat(invalid).isFalse(); }
@Test public void openCreatesDirectoryIfNecessary() throws Exception { cache.close(); File dir = tempDir.newFolder("testOpenCreatesDirectoryIfNecessary"); cache = DiskLruCache.open(dir, appVersion, 2, Integer.MAX_VALUE); set("a", "a", "a"); assertThat(new File(dir, "a.0").exists()).isTrue(); assertThat(new File(dir, "a.1").exists()).isTrue(); assertThat(new File(dir, "journal").exists()).isTrue(); }
@Test public void testInvalidWhenLessThenThreeWords() throws Exception { boolean validated = haikuReview.validateLineCount("a//c"); assertThat(validated).isFalse(); }
@Test public void checkDeleteIfExists() throws IOException { final SimpleFileSystemProvider fsProvider = new SimpleFileSystemProvider(); final File tempFile = File.createTempFile( "foo", "bar" ); final Path path = GeneralPathImpl.newFromFile( fsProvider.getFileSystem( URI.create( "file:///" ) ), tempFile ); assertThat( path.toFile().exists() ).isTrue(); assertThat( fsProvider.deleteIfExists( path ) ).isTrue(); assertThat( path.toFile().exists() ).isFalse(); }
@Test public void testForwardSlashIsAValidCharacter() throws Exception { String forwardSlash = "/"; boolean invalid = haikuReview.validateHaikuCharacters(forwardSlash); assertThat(invalid).isTrue(); }
@Test public void testIncorrectNumberOfSyllablesInThirdLineInNotHaiku() throws Exception { boolean isHaiku = haikuReview.isHaiku(INVALID_THIRD_LINE); assertThat(isHaiku).isFalse(); }
/** * Verifies that the actual value is {@code true}. * @return {@code this} assertion object. * @throws AssertionError if the actual value is {@code null}. * @throws AssertionError if the actual value is not {@code true}. */ public BooleanAssert isTrue() { return isEqualTo(true); }
@Test public void checkCreateDirectory() { final SimpleFileSystemProvider fsProvider = new SimpleFileSystemProvider(); final String userBasedPath = System.getProperty( "user.dir" ) + "/temp"; final Path path = GeneralPathImpl.create( fsProvider.getFileSystem( URI.create( "file:///" ) ), userBasedPath, false ); path.toFile().delete(); assertThat( path.toFile().exists() ).isFalse(); fsProvider.createDirectory( path ); assertThat( path.toFile().exists() ).isTrue(); path.toFile().delete(); assertThat( path.toFile().exists() ).isFalse(); }
@Test public void testAllow200Characters() throws Exception { String haiku = "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa" + "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa" + "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa" + "aaaaaaaaaaaaaaatwohundred"; boolean valid = haikuReview.validateHaikuCharacters(haiku); assertThat(valid).isTrue(); }
@Test public void whenContentIsSecure_thenRequiresSecureDecoderIsFalse() throws MediaCodecUtil.DecoderQueryException { SecurityDowngradingCodecSelector securityDowngradingCodecSelector = new SecurityDowngradingCodecSelector(internalMediaCodecUtil); securityDowngradingCodecSelector.getDecoderInfos(ANY_MIME_TYPE, CONTENT_SECURE); ArgumentCaptor<Boolean> argumentCaptor = ArgumentCaptor.forClass(Boolean.class); verify(internalMediaCodecUtil).getDecoderInfos(eq(ANY_MIME_TYPE), argumentCaptor.capture()); assertThat(argumentCaptor.getValue()).isFalse(); }
/** * Verifies that the actual value is {@code false}. * @return {@code this} assertion object. * @throws AssertionError if the actual value is {@code null}. * @throws AssertionError if the actual value is not {@code false}. */ public BooleanAssert isFalse() { return isEqualTo(false); }
@Test public void checkDelete() throws IOException { final SimpleFileSystemProvider fsProvider = new SimpleFileSystemProvider(); final File tempFile = File.createTempFile( "foo", "bar" ); final Path path = GeneralPathImpl.newFromFile( fsProvider.getFileSystem( URI.create( "file:///" ) ), tempFile ); assertThat( path.toFile().exists() ).isTrue(); fsProvider.delete( path ); assertThat( path.toFile().exists() ).isFalse(); }
@Test public void testAllowLessThan200Characters() throws Exception { String haiku = "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa" + "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa" + "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa" + "aaaaaaaaaaaaaaaaaaaaaaaaoneninenine"; boolean valid = haikuReview.validateHaikuCharacters(haiku); assertThat(valid).isTrue(); }
@Test public void whenContentIsInsecure_thenRequiresSecureDecoderIsFalse() throws MediaCodecUtil.DecoderQueryException { SecurityDowngradingCodecSelector securityDowngradingCodecSelector = new SecurityDowngradingCodecSelector(internalMediaCodecUtil); securityDowngradingCodecSelector.getDecoderInfos(ANY_MIME_TYPE, CONTENT_INSECURE); ArgumentCaptor<Boolean> argumentCaptor = ArgumentCaptor.forClass(Boolean.class); verify(internalMediaCodecUtil).getDecoderInfos(eq(ANY_MIME_TYPE), argumentCaptor.capture()); assertThat(argumentCaptor.getValue()).isFalse(); }