List of usage examples for junit.framework Assert assertEquals
static public void assertEquals(int expected, int actual)
From source file:com.mitre.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:de.hybris.platform.importcockpit.services.login.impl.LoginServiceImplTest.java
@Test public void testGetDefaultUserPassword() { final Configuration mockedConfiguration = Mockito.mock(Configuration.class); given(configurationService.getConfiguration()).willReturn(mockedConfiguration); given(mockedConfiguration.getString("importcockpit.default.password")).willReturn(DEFAULT_USER_PASS); Assert.assertEquals(DEFAULT_USER_PASS, loginServiceImpl.getDefaultUserPassword()); }
From source file:org.duracloud.id.generator.ldap.impl.LdapImplTest.java
@Test public void testMaxGroupId() throws Exception { String base = "ou=groups"; String filter = "objectClass=x-idp-group"; int max = createMockTemplate(base, filter); ldap.setLdapTemplate(template);/*from w ww. j a v a 2s .com*/ replayMocks(); int id = ldap.maxGroupId(); Assert.assertEquals(max, id); }
From source file:org.ocpsoft.rewrite.servlet.config.ResourceTest.java
@Test public void testResourceParamNotMatchingCondition() throws Exception { HttpAction<HttpGet> action = get("/missing.css"); Assert.assertEquals(404, action.getResponse().getStatusLine().getStatusCode()); }
From source file:io.druid.segment.IndexMergerTest.java
@Test public void testPersist() throws Exception { final long timestamp = System.currentTimeMillis(); IncrementalIndex toPersist = IncrementalIndexTest.createIndex(true, null); IncrementalIndexTest.populateIndex(timestamp, toPersist); final File tempDir = Files.createTempDir(); try {/*from ww w.j a v a 2 s. c o m*/ QueryableIndex index = IndexIO.loadIndex(IndexMerger.persist(toPersist, tempDir)); Assert.assertEquals(2, index.getColumn(Column.TIME_COLUMN_NAME).getLength()); Assert.assertEquals(Arrays.asList("dim1", "dim2"), Lists.newArrayList(index.getAvailableDimensions())); Assert.assertEquals(3, index.getColumnNames().size()); } finally { tempDir.delete(); } }
From source file:com.cloud.agent.dao.impl.PropertiesStorageTest.java
@Test public void configureWithExistingFile() throws IOException { String fileName = "target/existingfile" + System.currentTimeMillis(); File file = new File(fileName); FileUtils.writeStringToFile(file, "a=b\n\n"); PropertiesStorage storage = new PropertiesStorage(); HashMap<String, Object> params = new HashMap<String, Object>(); params.put("path", fileName); Assert.assertTrue(storage.configure("test", params)); Assert.assertEquals("b", storage.get("a")); Assert.assertTrue(file.exists());/* w w w. j av a 2 s. c om*/ storage.persist("foo", "bar"); Assert.assertEquals("bar", storage.get("foo")); storage.stop(); file.delete(); }
From source file:com.rackspacecloud.blueflood.io.serializers.astyanax.GaugeRollupSerializerTest.java
@Test public void testSerializerDeserializerV1() throws Exception { BluefloodGaugeRollup gauge1 = BluefloodGaugeRollup.buildFromRawSamples( Rollups.asPoints(SimpleNumber.class, System.currentTimeMillis(), 300, new SimpleNumber(10L))); BluefloodGaugeRollup gauge2 = BluefloodGaugeRollup.buildFromRawSamples(Rollups.asPoints(SimpleNumber.class, System.currentTimeMillis() - 100, 300, new SimpleNumber(1234567L))); BluefloodGaugeRollup gauge3 = BluefloodGaugeRollup.buildFromRawSamples(Rollups.asPoints(SimpleNumber.class, System.currentTimeMillis() - 200, 300, new SimpleNumber(10.4D))); BluefloodGaugeRollup gaugesRollup = BluefloodGaugeRollup.buildFromGaugeRollups(Rollups .asPoints(BluefloodGaugeRollup.class, System.currentTimeMillis(), 300, gauge1, gauge2, gauge3)); Assert.assertEquals(3, gaugesRollup.getCount()); ByteArrayOutputStream baos = new ByteArrayOutputStream(); baos.write(Base64.encodeBase64(Serializers.gaugeRollupInstance.toByteBuffer(gauge1).array())); baos.write("\n".getBytes()); baos.write(Base64.encodeBase64(Serializers.gaugeRollupInstance.toByteBuffer(gauge2).array())); baos.write("\n".getBytes()); baos.write(Base64.encodeBase64(Serializers.gaugeRollupInstance.toByteBuffer(gauge3).array())); baos.write("\n".getBytes()); baos.write(Base64.encodeBase64(Serializers.gaugeRollupInstance.toByteBuffer(gaugesRollup).array())); baos.write("\n".getBytes()); baos.close();/*from w w w .j a v a 2 s . c om*/ BufferedReader reader = new BufferedReader( new InputStreamReader(new ByteArrayInputStream(baos.toByteArray()))); ByteBuffer bb = ByteBuffer.wrap(Base64.decodeBase64(reader.readLine().getBytes())); BluefloodGaugeRollup deserializedGauge1 = Serializers.serializerFor(BluefloodGaugeRollup.class) .fromByteBuffer(bb); Assert.assertEquals(gauge1, deserializedGauge1); bb = ByteBuffer.wrap(Base64.decodeBase64(reader.readLine().getBytes())); BluefloodGaugeRollup deserializedGauge2 = Serializers.serializerFor(BluefloodGaugeRollup.class) .fromByteBuffer(bb); Assert.assertEquals(gauge2, deserializedGauge2); bb = ByteBuffer.wrap(Base64.decodeBase64(reader.readLine().getBytes())); BluefloodGaugeRollup deserializedGauge3 = Serializers.serializerFor(BluefloodGaugeRollup.class) .fromByteBuffer(bb); Assert.assertEquals(gauge3, deserializedGauge3); bb = ByteBuffer.wrap(Base64.decodeBase64(reader.readLine().getBytes())); BluefloodGaugeRollup deserializedGauge4 = Serializers.serializerFor(BluefloodGaugeRollup.class) .fromByteBuffer(bb); Assert.assertEquals(gaugesRollup, deserializedGauge4); Assert.assertFalse(deserializedGauge1.equals(deserializedGauge2)); }
From source file:org.ocpsoft.rewrite.spring.SpringFeaturesTest.java
@Test public void testSpringFeatures() throws Exception { HttpAction<HttpGet> action = get("/name-christian"); Assert.assertEquals(200, action.getResponse().getStatusLine().getStatusCode()); Assert.assertEquals("/hello/CHRISTIAN", action.getCurrentContextRelativeURL()); }
From source file:org.jasig.ssp.util.importer.job.twodottwo.StageSuccessWithSkipTest.java
@Test public void testStageSuccessWithSkip() throws Exception { //Test file should have 1 step which should write successfully but skip 1 line JobExecution jobExecution = jobLauncherTestUtils.launchJob(); Collection<StepExecution> stepExecutions = jobExecution.getStepExecutions(); for (StepExecution stepExecution : stepExecutions) { Assert.assertEquals(1, stepExecution.getWriteCount()); Assert.assertEquals(1, stepExecution.getSkipCount()); }//from ww w .j a v a2 s . c o m BatchStatus exitStatus = jobExecution.getStatus(); Assert.assertEquals(BatchStatus.COMPLETED, exitStatus); }
From source file:org.obiba.onyx.core.domain.participant.ParticipantAttributeReaderTest.java
@Test public void testAttributesInSameOrderAsXmlFile() { Assert.assertEquals("Doctor First Name", participantAttributes.get(0).getName()); Assert.assertEquals("Doctor Last Name", participantAttributes.get(1).getName()); Assert.assertEquals("Special Needs", participantAttributes.get(2).getName()); Assert.assertEquals("Family Member First Name", participantAttributes.get(3).getName()); Assert.assertEquals("Family Member Last Name", participantAttributes.get(4).getName()); Assert.assertEquals("Marital Status", participantAttributes.get(5).getName()); }