本文整理了Java中org.junit.Assert.assertEquals()
方法的一些代码示例,展示了Assert.assertEquals()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Assert.assertEquals()
方法的具体详情如下:
包路径:org.junit.Assert
类名称:Assert
方法名:assertEquals
暂无
代码示例来源:origin: spring-projects/spring-framework
@Test
public void testPrototypeListFactory() throws Exception {
List list = (List) this.beanFactory.getBean("pListFactory");
assertTrue(list instanceof LinkedList);
assertTrue(list.size() == 2);
assertEquals("bar", list.get(0));
assertEquals("jenny", list.get(1));
}
代码示例来源:origin: ReactiveX/RxJava
@Test
public void enumMethods() {
assertEquals(1, DisposableHelper.values().length);
assertNotNull(DisposableHelper.valueOf("DISPOSED"));
}
代码示例来源:origin: ReactiveX/RxJava
@Test
public void testSizeAndHasAnyValueEffectivelyUnboundedEmptyCompleted() {
ReplaySubject<Object> rs = ReplaySubject.createUnbounded();
rs.onComplete();
assertEquals(0, rs.size());
assertFalse(rs.hasValue());
}
代码示例来源:origin: spring-projects/spring-framework
@Test
public void testListFactory() throws Exception {
List list = (List) this.beanFactory.getBean("listFactory");
assertTrue(list instanceof LinkedList);
assertTrue(list.size() == 2);
assertEquals("bar", list.get(0));
assertEquals("jenny", list.get(1));
}
代码示例来源:origin: ReactiveX/RxJava
@Test
public void backpressureKind() {
assertEquals(6, BackpressureKind.values().length);
assertNotNull(BackpressureKind.valueOf("FULL"));
}
代码示例来源:origin: ReactiveX/RxJava
@Test
public void testSizeAndHasAnyValueUnboundedEmptyCompleted() {
ReplayProcessor<Object> rs = ReplayProcessor.create();
rs.onComplete();
assertEquals(0, rs.size());
assertFalse(rs.hasValue());
}
代码示例来源:origin: spring-projects/spring-framework
@Test
public void testListWithInconsistentElementType() {
ClassPathXmlApplicationContext ctx = new ClassPathXmlApplicationContext("spr7283.xml", getClass());
List<?> list = ctx.getBean("list", List.class);
assertEquals(2, list.size());
assertTrue(list.get(0) instanceof A);
assertTrue(list.get(1) instanceof B);
}
代码示例来源:origin: ReactiveX/RxJava
@Test
public void emptyObserverEnum() {
assertEquals(1, TestObserver.EmptyObserver.values().length);
assertNotNull(TestObserver.EmptyObserver.valueOf("INSTANCE"));
}
代码示例来源:origin: ReactiveX/RxJava
@Test
public void testSizeAndHasAnyValueEffectivelyUnboundedEmptyCompleted() {
ReplayProcessor<Object> rs = ReplayProcessor.createUnbounded();
rs.onComplete();
assertEquals(0, rs.size());
assertFalse(rs.hasValue());
}
代码示例来源:origin: spring-projects/spring-framework
@Test
public void testSunnyDaySetValue() throws Exception {
CustomCollectionEditor editor = new CustomCollectionEditor(ArrayList.class);
editor.setValue(new int[] {0, 1, 2});
Object value = editor.getValue();
assertNotNull(value);
assertTrue(value instanceof ArrayList);
List<?> list = (List<?>) value;
assertEquals("There must be 3 elements in the converted collection", 3, list.size());
assertEquals(new Integer(0), list.get(0));
assertEquals(new Integer(1), list.get(1));
assertEquals(new Integer(2), list.get(2));
}
代码示例来源:origin: ReactiveX/RxJava
@Test
public void checkEnum() {
assertEquals(2, EmptyDisposable.values().length);
assertNotNull(EmptyDisposable.valueOf("INSTANCE"));
assertNotNull(EmptyDisposable.valueOf("NEVER"));
}
}
代码示例来源:origin: ReactiveX/RxJava
@Test
public void normal() {
TestResourceObserver<Integer> tc = new TestResourceObserver<Integer>();
assertFalse(tc.isDisposed());
assertEquals(0, tc.start);
assertTrue(tc.values.isEmpty());
assertTrue(tc.errors.isEmpty());
Observable.just(1).subscribe(tc);
assertTrue(tc.isDisposed());
assertEquals(1, tc.start);
assertEquals(1, tc.values.get(0).intValue());
assertTrue(tc.errors.isEmpty());
}
代码示例来源:origin: ReactiveX/RxJava
@Test
public void normal() {
TestDisposableObserver<Integer> tc = new TestDisposableObserver<Integer>();
assertFalse(tc.isDisposed());
assertEquals(0, tc.start);
assertTrue(tc.values.isEmpty());
assertTrue(tc.errors.isEmpty());
Observable.just(1).subscribe(tc);
assertFalse(tc.isDisposed());
assertEquals(1, tc.start);
assertEquals(1, tc.values.get(0).intValue());
assertTrue(tc.errors.isEmpty());
}
代码示例来源:origin: spring-projects/spring-framework
@Test
public void testCollectionInjectionFromSameConfigurationClass() {
ApplicationContext ctx = new AnnotationConfigApplicationContext(CollectionInjectionConfiguration.class);
CollectionInjectionConfiguration bean = ctx.getBean(CollectionInjectionConfiguration.class);
assertNotNull(bean.testBeans);
assertEquals(1, bean.testBeans.size());
assertSame(ctx.getBean(TestBean.class), bean.testBeans.get(0));
}
代码示例来源:origin: spring-projects/spring-framework
@Test
@SuppressWarnings("unchecked")
public void testMultipleResults() {
// Add with JDBC
String firstName = "Tony";
insertPerson(firstName);
assertTrue(Proxy.isProxyClass(sharedEntityManager.getClass()));
Query q = sharedEntityManager.createQuery("select p from Person as p");
List<Person> people = q.getResultList();
assertEquals(1, people.size());
assertEquals(firstName, people.get(0).getFirstName());
}
代码示例来源:origin: spring-projects/spring-framework
@Test
public void loadFactoriesInCorrectOrder() {
List<DummyFactory> factories = SpringFactoriesLoader.loadFactories(DummyFactory.class, null);
assertEquals(2, factories.size());
assertTrue(factories.get(0) instanceof MyDummyFactory1);
assertTrue(factories.get(1) instanceof MyDummyFactory2);
}
代码示例来源:origin: spring-projects/spring-framework
@Test
public void loadPackagePrivateFactory() {
List<DummyPackagePrivateFactory> factories =
SpringFactoriesLoader.loadFactories(DummyPackagePrivateFactory.class, null);
assertEquals(1, factories.size());
assertTrue((factories.get(0).getClass().getModifiers() & Modifier.PUBLIC) == 0);
}
代码示例来源:origin: spring-projects/spring-framework
@Test
public void testCollectionArgumentOnBeanMethod() {
ApplicationContext ctx = new AnnotationConfigApplicationContext(CollectionArgumentConfiguration.class, TestBean.class);
CollectionArgumentConfiguration bean = ctx.getBean(CollectionArgumentConfiguration.class);
assertNotNull(bean.testBeans);
assertEquals(1, bean.testBeans.size());
assertSame(ctx.getBean(TestBean.class), bean.testBeans.get(0));
}
代码示例来源:origin: spring-projects/spring-framework
@Test
public void writeMultipleItems() throws Exception {
List<String> items = Arrays.asList("one", "two", "three");
Mono<Void> completion = Flux.fromIterable(items).as(this::sendOperator);
Signal<Void> signal = completion.materialize().block();
assertNotNull(signal);
assertTrue("Unexpected signal: " + signal, signal.isOnComplete());
assertEquals(3, this.writer.items.size());
assertEquals("one", this.writer.items.get(0));
assertEquals("two", this.writer.items.get(1));
assertEquals("three", this.writer.items.get(2));
assertTrue(this.writer.completed);
}
代码示例来源:origin: ReactiveX/RxJava
@Test
public void normal() {
TestSingle<Integer> tc = new TestSingle<Integer>();
assertFalse(tc.isDisposed());
assertEquals(0, tc.start);
assertTrue(tc.values.isEmpty());
assertTrue(tc.errors.isEmpty());
Single.just(1).subscribe(tc);
assertFalse(tc.isDisposed());
assertEquals(1, tc.start);
assertEquals(1, tc.values.get(0).intValue());
assertTrue(tc.errors.isEmpty());
}
内容来源于网络,如有侵权,请联系作者删除!