public FragmentManagerAssert doesNotHaveFragmentWithId(int id) { isNotNull(); assertThat(actual.findFragmentById(id)) .overridingErrorMessage("Expected fragment with ID <%s> not to be present but was.", id) .isNull(); return this; }
@Test public void resourceNameTest() throws IOException{ JarFile guavaFile = new JarFile(FilePathUtil.getJarPath(Files.class)); assertThat(guavaFile.getEntry("META-INF/MANIFEST.MF")).isNotNull(); assertThat(guavaFile.getEntry("/META-INF/MANIFEST.MF")).isNull(); guavaFile.close(); }
@Test public void general() { List<String> list1 = ListUtil.newArrayList(); List<String> list2 = ListUtil.newArrayList("a", "b", "c"); List<String> list3 = ListUtil.newArrayList("a"); assertThat(ListUtil.isEmpty(list1)).isTrue(); assertThat(ListUtil.isEmpty(null)).isTrue(); assertThat(ListUtil.isEmpty(list2)).isFalse(); assertThat(ListUtil.isNotEmpty(list1)).isFalse(); assertThat(ListUtil.isNotEmpty(null)).isFalse(); assertThat(ListUtil.isNotEmpty(list2)).isTrue(); assertThat(ListUtil.getFirst(list2)).isEqualTo("a"); assertThat(ListUtil.getLast(list2)).isEqualTo("c"); assertThat(ListUtil.getFirst(list3)).isEqualTo("a"); assertThat(ListUtil.getLast(list3)).isEqualTo("a"); assertThat(ListUtil.getFirst(list1)).isNull(); assertThat(ListUtil.getFirst(null)).isNull(); }
@Test public void testEmpty() { final OutputUnitsAffinityGroup<Object> group = new OutputUnitsAffinityGroup<>(); assertThat(group.size()).isZero(); assertThat(group.get(OutputUnitType.CONTENT)).isNull(); assertThat(group.get(OutputUnitType.BACKGROUND)).isNull(); assertThat(group.get(OutputUnitType.FOREGROUND)).isNull(); assertThat(group.get(OutputUnitType.BORDER)).isNull(); assertThat(group.get(OutputUnitType.HOST)).isNull(); }
@Test public void testLayoutOutputsForEnabledFalseDoesntWrap() { final Component component = new InlineLayoutSpec() { @Override protected Component onCreateLayout(final ComponentContext c) { return create(c) .child(create(c).child(TestDrawableComponent.create(c).enabled(false))) .build(); } }; final LayoutState layoutState = calculateLayoutState( application, component, -1, makeSizeSpec(100, EXACTLY), makeSizeSpec(100, EXACTLY)); assertThat(layoutState.getMountableOutputCount()).isEqualTo(2); assertThat(layoutState.getMountableOutputAt(0).getNodeInfo()).isNull(); assertThat(layoutState.getMountableOutputAt(0).getComponent().getSimpleName()) .isEqualTo("HostComponent"); assertThat(layoutState.getMountableOutputAt(1).getComponent().getSimpleName()) .isEqualTo("TestDrawableComponent"); assertThat(MountItem.isTouchableDisabled(layoutState.getMountableOutputAt(1).getFlags())) .isTrue(); }
@Test public void testGetIfEligible() throws Exception { assertThat(ConstructorBasedConverter.getIfEligible(Person.class)).isNotNull(); assertThat(ConstructorBasedConverter.getIfEligible(Object.class)).isNull(); }
@Test public void test() { List<String> list1 = ListUtil.newArrayList(); List<String> list2 = ListUtil.newArrayList("a", "b", "c"); List<String> list3 = ListUtil.newArrayList("a"); Set<String> set1 = SetUtil.newSortedSet(); set1.add("a"); set1.add("b"); set1.add("c"); Set<String> set2 = SetUtil.newSortedSet(); set2.add("a"); assertThat(CollectionUtil.isEmpty(list1)).isTrue(); assertThat(CollectionUtil.isEmpty(null)).isTrue(); assertThat(CollectionUtil.isEmpty(list2)).isFalse(); assertThat(CollectionUtil.isNotEmpty(list1)).isFalse(); assertThat(CollectionUtil.isNotEmpty(null)).isFalse(); assertThat(CollectionUtil.isNotEmpty(list2)).isTrue(); assertThat(CollectionUtil.getFirst(list2)).isEqualTo("a"); assertThat(CollectionUtil.getLast(list2)).isEqualTo("c"); assertThat(CollectionUtil.getFirst(set1)).isEqualTo("a"); assertThat(CollectionUtil.getLast(set1)).isEqualTo("c"); assertThat(CollectionUtil.getFirst(list3)).isEqualTo("a"); assertThat(CollectionUtil.getLast(list3)).isEqualTo("a"); assertThat(CollectionUtil.getFirst(set2)).isEqualTo("a"); assertThat(CollectionUtil.getLast(set2)).isEqualTo("a"); assertThat(CollectionUtil.getFirst(list1)).isNull(); assertThat(CollectionUtil.getFirst(null)).isNull(); assertThat(CollectionUtil.getLast(list1)).isNull(); assertThat(CollectionUtil.getLast(null)).isNull(); }
public FragmentManagerAssert doesNotHaveFragmentWithId(int id) { isNotNull(); assertThat(actual.findFragmentById(id)) .overridingErrorMessage("Expected fragment with ID <%s> not to be present but was.", id) .isNull(); return this; }
@Test public void loadFactoryOrNull() throws Exception { NotImplementedSPI factory = ServiceHelper.loadFactoryOrNull(NotImplementedSPI.class); assertThat(factory).isNull(); FakeFactory fake = ServiceHelper.loadFactoryOrNull(FakeFactory.class); assertThat(fake).isNotNull(); assertThat(fake.classloader()).isEqualTo(ServiceHelperTest.class.getClassLoader()); }
@Test public void gracefulShutdown() throws InterruptedException { pool.execute(task); ThreadPoolUtil.gracefulShutdown(pool, 1000, TimeUnit.MILLISECONDS); assertThat(pool.isTerminated()).isTrue(); assertThat(appender.getFirstLog()).isNull(); pool.execute(task); ThreadPoolUtil.gracefulShutdown(pool, 500, TimeUnit.MILLISECONDS); assertThat(pool.isTerminated()).isTrue(); assertThat(appender.getFirstLog().getMessage()).isEqualTo("InterruptedException"); thread.interrupt(); ThreadUtil.sleep(500); assertThat(appender.getFirstLog().getMessage()).isEqualTo("InterruptedException");
private void verifyCommDisplayMsg(IntSlider widget) { assertThat(groovyKernel.getPublishedMessages().size()).isEqualTo(1); Message message = groovyKernel.getPublishedMessages().get(0); assertThat(getData(message).get(Widget.APPLICATION_VND_JUPYTER_WIDGET_VIEW_JSON)).isNotNull(); assertThat(message.type()).isEqualTo(JupyterMessages.DISPLAY_DATA); assertThat(getContent(message).get(COMM_ID)).isNull(); } }
@Test public void testGetNonExistingIncindent() throws Exception { assertThat(elasticsearchIncidentRepository.getIncidentByCheckId("test 1")).isNull(); }
@Before public void setUp() throws Exception { tracingPlugin = mock(TracingPlugin.class); final ConfigurationRegistry configuration = mock(ConfigurationRegistry.class); final CorePlugin corePlugin = mock(CorePlugin.class); when(configuration.getConfig(TracingPlugin.class)).thenReturn(tracingPlugin); when(configuration.getConfig(CorePlugin.class)).thenReturn(corePlugin); when(tracingPlugin.isPseudonymizeUserNames()).thenReturn(true); when(tracingPlugin.isAnonymizeIPs()).thenReturn(true); when(tracingPlugin.getDiscloseUsers()).thenReturn(Collections.emptySet()); when(corePlugin.getThreadPoolQueueCapacityLimit()).thenReturn(1000); assertThat(mockTracer.scopeManager().active()).isNull(); }
@Test public void testGetPersistenceSpaceIdentifier() throws CachePersistenceException { assertThat(service.getPersistenceSpaceIdentifier("test", null)).isNull(); }
@Test public void testComponentClickListener() { assertThat(mHost.getComponentClickListener()).isNull(); ComponentClickListener listener = new ComponentClickListener(); mHost.setComponentClickListener(listener); assertThat(mHost.getComponentClickListener()).isEqualTo(listener); mHost.setComponentClickListener(null); assertThat(mHost.getComponentClickListener()).isNull(); }
@After public void tearDown() throws Exception { assertThat(mockTracer.scopeManager().active()).isNull(); }
@Test public void createConstantLineByEmptyConstructor_hasXandYisNull() { //when ConstantLine constantLine = new ConstantLine(); //then Assertions.assertThat(constantLine.getX()).isNull(); Assertions.assertThat(constantLine.getY()).isNull(); }