List of usage examples for junit.framework Assert assertEquals
static public void assertEquals(int expected, int actual)
From source file:hr.fer.spocc.util.TokenListWriterTest.java
@Test public void test() throws IOException { MyClass mc = new MyClass(1, "first"); WRITER.print(mc, System.err); WRITER.print(mc);/* ww w. j a va 2 s . c o m*/ WRITER.print(mc, tmpFile); MyClass read = READER.read(tmpFile); Assert.assertEquals(mc, read); }
From source file:org.openxdata.server.service.impl.LocaleServiceTest.java
@Test public void saveLocale_shouldSaveLocaleList() throws Exception { final String localeName = "LocaleName"; final String localeKey = "LocaleKey"; List<Locale> locales = localeService.getLocales(); Assert.assertEquals(1, locales.size()); Assert.assertNull(getLocale(localeName, locales)); Locale locale = new Locale(); locale.setName(localeName);/*from w w w . jav a 2s . c om*/ locale.setKey(localeKey); locale.setCreator(userService.getUsers().get(0)); locale.setDateCreated(new Date()); locales = new ArrayList<Locale>(); locales.add(locale); localeService.saveLocale(locales); locales = localeService.getLocales(); Assert.assertEquals(2, locales.size()); Assert.assertNotNull(getLocale(localeName, locales)); }
From source file:forum.test.MessagepriveServiceJUnitTest.java
@Test public void Message1iOk() { Assert.assertEquals(1, serviceuser.find(1L).getMessagesPriveRecus().size()); }
From source file:com.exxonmobile.ace.hybris.core.suggestion.DefaultSimpleSuggestionServiceIntegrationTest.java
@Test public void testReferencesForPurchasedInCategory() { final UserModel user = userService.getUserForUID("deJol"); final CategoryModel category = categoryService.getCategoryForCode("cameras"); List<ProductModel> result = b2bSimpleSuggestionService.getReferencesForPurchasedInCategory(category, user, Collections.EMPTY_LIST, false, null); Assert.assertEquals(4, result.size()); result = b2bSimpleSuggestionService.getReferencesForPurchasedInCategory(category, user, Collections.EMPTY_LIST, false, NumberUtils.INTEGER_ONE); Assert.assertEquals(1, result.size()); result = b2bSimpleSuggestionService.getReferencesForPurchasedInCategory(category, user, Arrays.asList(ProductReferenceTypeEnum.SIMILAR), false, null); Assert.assertEquals(1, result.size()); result = b2bSimpleSuggestionService.getReferencesForPurchasedInCategory(category, user, Arrays.asList(ProductReferenceTypeEnum.ACCESSORIES), false, null); Assert.assertEquals(2, result.size()); result = b2bSimpleSuggestionService.getReferencesForPurchasedInCategory(category, user, Arrays.asList(ProductReferenceTypeEnum.ACCESSORIES), true, null); Assert.assertEquals(1, result.size()); final ProductModel product = result.get(0); Assert.assertEquals("adapterDC", product.getCode()); Assert.assertEquals("adapter", product.getName()); }
From source file:org.jasig.ssp.util.importer.job.twodottwo.ErrorReportingTest.java
@SuppressWarnings("unchecked") @Test//from w w w . j a v a2s .co m public void testJob() throws Exception { JobExecution jobExecution = jobLauncherTestUtils.launchJob(); Map<String, ReportEntry> report = (Map<String, ReportEntry>) jobExecution.getExecutionContext() .get("report"); Assert.assertNotNull(report); Set<Entry<String, ReportEntry>> entrySet = report.entrySet(); Assert.assertEquals(1, entrySet.size()); for (Entry<String, ReportEntry> entry : entrySet) { Assert.assertEquals(new Integer(0), entry.getValue().getNumberParsed()); Assert.assertEquals(new Integer(0), entry.getValue().getNumberSkippedOnParse()); Assert.assertEquals(new Integer(2), entry.getValue().getNumberSkippedOnDatabaseWrite()); Assert.assertEquals(new Integer(0), entry.getValue().getNumberInsertedUpdated()); } List<ErrorEntry> errors = (List<ErrorEntry>) jobExecution.getExecutionContext().get("errors"); Assert.assertEquals(2, errors.size()); }
From source file:org.ocpsoft.rewrite.servlet.wrapper.HttpForwardConfigurationTest.java
@Test public void testRequestParameterConditionRequired() throws Exception { HttpAction<HttpGet> action = get("/forward-fail?foo=bar"); Assert.assertEquals(404, action.getResponse().getStatusLine().getStatusCode()); }
From source file:com.ancientprogramming.fixedformat4j.format.impl.TestNullableFixedFormatManagerImpl.java
public void testLoadNonNullRecord() { MyNullableRecord loadedRecord = manager.load(MyNullableRecord.class, MY_NONNULL_RECORD_DATA); Assert.assertNotNull(loadedRecord);/* w ww . j a v a 2 s. c om*/ Assert.assertEquals("", loadedRecord.getStringData()); Assert.assertTrue(loadedRecord.isBooleanData()); }
From source file:de.r2soft.empires.framework.test.ObjectTreeTest.java
@Test public void testNearestOne() { Object obj = new Object(); tree.insert(new Vector2D(30, 30), obj); Object objT = tree.nearest(new Vector2D(31, 31)); Assert.assertEquals(obj, objT); }
From source file:com.ancientprogramming.fixedformat4j.format.impl.TestFixedFormatManagerImpl.java
public void testLoadRecord() { MyRecord loadedRecord = manager.load(MyRecord.class, MY_RECORD_DATA); Assert.assertNotNull(loadedRecord);/*from w ww . j a v a2 s. com*/ Assert.assertEquals(STR, loadedRecord.getStringData()); Assert.assertTrue(loadedRecord.isBooleanData()); }
From source file:edu.uci.ics.jung.algorithms.cluster.TestEdgeBetweennessClusterer.java
public void testRanker() { Graph<Number, Number> graph = new SparseMultigraph<Number, Number>(); for (int i = 0; i < 10; i++) { graph.addVertex(i + 1);//from w ww . j a v a2s.c o m } int j = 0; graph.addEdge(j++, 1, 2); graph.addEdge(j++, 1, 3); graph.addEdge(j++, 2, 3); graph.addEdge(j++, 5, 6); graph.addEdge(j++, 5, 7); graph.addEdge(j++, 6, 7); graph.addEdge(j++, 8, 10); graph.addEdge(j++, 7, 8); graph.addEdge(j++, 7, 10); graph.addEdge(j++, 3, 4); graph.addEdge(j++, 4, 6); graph.addEdge(j++, 4, 8); Assert.assertEquals(graph.getVertexCount(), 10); Assert.assertEquals(graph.getEdgeCount(), 12); EdgeBetweennessClusterer<Number, Number> clusterer = new EdgeBetweennessClusterer<Number, Number>(3); Collection<Set<Number>> clusters = clusterer.transform(graph); Assert.assertEquals(clusters.size(), 3); }