@Test public void testRetainsSpans() { SpannableStringBuilder ssb = new SpannableStringBuilder("Hello {name}, you are {age} years old."); ssb.setSpan("bold", 5, 28, 0); CharSequence formatted = Phrase.from(ssb).put("name", "Abe").put("age", 20).format(); assertThat(formatted.toString()).isEqualTo("Hello Abe, you are 20 years old."); assertThat(formatted).isInstanceOf(Spannable.class); }
public LongAssert asLong() { Assertions.assertThat(actual.getValue()) .overridingErrorMessage("Unable to convert processInstance processVariable '%s' to an instance of class '%s'", actual.getName(), Long.class) .isInstanceOf(Long.class); return Assertions.assertThat((Long) actual.getValue()); }
public StringAssert asString() { Assertions.assertThat(actual.getValue()) .overridingErrorMessage("Unable to convert processInstance processVariable '%s' to an instance of class '%s'", actual.getName(), String.class) .isInstanceOf(String.class); return Assertions.assertThat((String) actual.getValue()); }
@Test public void givenDrmTypeNone_whenCreatingDrmSessionCreator_thenReturnsNoDrmSession() throws DrmSessionCreatorException { DrmSessionCreator drmSessionCreator = drmSessionCreatorFactory.createFor(DrmType.NONE, IGNORED_DRM_HANDLER); assertThat(drmSessionCreator).isInstanceOf(NoDrmSessionCreator.class); }
@Test public void givenDrmTypeWidevineClassic_whenCreatingDrmSessionCreator_thenReturnsNoDrmSession() throws DrmSessionCreatorException { DrmSessionCreator drmSessionCreator = drmSessionCreatorFactory.createFor(DrmType.WIDEVINE_CLASSIC, IGNORED_DRM_HANDLER); assertThat(drmSessionCreator).isInstanceOf(NoDrmSessionCreator.class); }
@Test public void givenDrmTypeWidevineModularDownload_whenCreatingDrmSessionCreator_thenReturnsDownload() throws DrmSessionCreatorException { DrmSessionCreator drmSessionCreator = drmSessionCreatorFactory.createFor(DrmType.WIDEVINE_MODULAR_DOWNLOAD, downloadedModularDrm); assertThat(drmSessionCreator).isInstanceOf(DownloadDrmSessionCreator.class); }
@Test public void givenDrmTypeWidevineModularStream_whenCreatingDrmSessionCreator_thenReturnsStreaming() throws DrmSessionCreatorException { DrmSessionCreator drmSessionCreator = drmSessionCreatorFactory.createFor(DrmType.WIDEVINE_MODULAR_STREAM, streamingModularDrm); assertThat(drmSessionCreator).isInstanceOf(StreamingDrmSessionCreator.class); }
public void testGetSettings() throws Throwable { SearchClient client = createSearchClient(); SearchClient.Settings settings = client.getSettings(); assertThat(settings).isNotNull(); // Parcel the settings object and recreate it from the bundle. final Bundle bundle = new Bundle(); bundle.putParcelable("settings", settings); settings = bundle.getParcelable("settings"); // Recreate SearchClient from the settings object and test it. client = settings.createSearchClient(getInstrumentation().getContext()); assertThat(client).isInstanceOf(createSearchClient().getClass()); }
@RequiresApi(api = Build.VERSION_CODES.KITKAT) @Test public void givenOpeningSessionError_whenAcquiringSession_thenReturnsInvalidDrmSession() throws MediaDrmException { ResourceBusyException resourceBusyException = new ResourceBusyException("resource is busy"); given(mediaDrm.openSession()).willThrow(resourceBusyException); DrmSession<FrameworkMediaCrypto> drmSession = localDrmSessionManager.acquireSession(IGNORED_LOOPER, IGNORED_DRM_DATA); assertThat(drmSession).isInstanceOf(InvalidDrmSession.class); assertThat(drmSession.getError().getCause()).isEqualTo(resourceBusyException); }
@Test public void checkGetFileStore() { final Path path = GeneralPathImpl.create( fsProvider.getFileSystem( URI.create( "file:///" ) ), "c:\\path\\to\\file.txt", false ); assertThat( fsProvider.getFileStore( path ) ).isNotNull().isInstanceOf( SimpleWindowsFileStore.class ); assertThat( fsProvider.getFileStore( path ).name() ).isNotNull().isEqualTo( "c:\\" ); }
@Test public void simpleStateTest() { assertThat( fsProvider ).isNotNull(); assertThat( fsProvider.getScheme() ).isNotEmpty().isEqualTo( "file" ); final Path path = GeneralPathImpl.create( fsProvider.getFileSystem( URI.create( "file:///" ) ), "c:\\path\\to\\file.txt", false ); assertThat( path.getFileSystem() ).isNotNull().isInstanceOf( SimpleWindowsFileSystem.class ); }