Java Code Examples for org.junit.Assert#assertNotSame()
The following examples show how to use
org.junit.Assert#assertNotSame() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: LogbackTest.java From sofa-common-tools with Apache License 2.0 | 6 votes |
@Test public void testIndependentSpaceLogback() throws JoranException { URL url1 = LogbackTest.class.getResource("/com/alipay/sofa/rpc/log/logback/log-conf.xml"); LoggerContext loggerContext1 = new LoggerContext(); new ContextInitializer(loggerContext1).configureByResource(url1); ch.qos.logback.classic.Logger logger1 = loggerContext1.getLogger("com.foo.Bar"); logger1.info("log4j2 - 1"); Assert.assertNotNull(logger1); //logback logger 2 URL url2 = LogbackTest.class.getResource("/com/alipay/sofa/rpc/log/logback/logback_b.xml"); LoggerContext loggerContext2 = new LoggerContext(); new ContextInitializer(loggerContext2).configureByResource(url2); Logger logger2 = loggerContext2.getLogger("com.foo.Bar2"); logger2.info("log4j2 - 222"); Assert.assertNotNull(logger2); Assert.assertNotSame(logger1, logger2); }
Example 2
Source File: CollectionUtilsTest.java From AndroidUtilCode with Apache License 2.0 | 6 votes |
@Test public void subtract() { ArrayList<String> l0 = CollectionUtils.newArrayList("00", "01", "02"); ArrayList<String> l1 = CollectionUtils.newArrayList("00", "11", "12"); Collection subtractNullNull = CollectionUtils.subtract(null, null); Collection subtractL0Null = CollectionUtils.subtract(l0, null); Collection subtractNullL1 = CollectionUtils.subtract(null, l1); Collection subtractL0L1 = CollectionUtils.subtract(l0, l1); System.out.println(subtractNullNull); System.out.println(subtractL0Null); System.out.println(subtractNullL1); System.out.println(subtractL0L1); Assert.assertNotSame(l0, subtractL0Null); }
Example 3
Source File: ArbitraryCacheManagerTest.java From ehcache-shiro with Apache License 2.0 | 6 votes |
/** * Test showing issues: * <p> * https://github.com/ehcache/ehcache-shiro/issues/12 * https://github.com/ehcache/ehcache-shiro/issues/13 * * @throws Exception */ @Test public void testArbitraryCacheManager() throws Exception { ehcacheShiroManager.init(); CacheManager firstCacheManager = ehcacheShiroManager.getCacheManager(); Assert.assertNotNull(firstCacheManager); ehcacheShiroManager.setCacheManager(cacheManager); CacheManager secondCacheManager = ehcacheShiroManager.getCacheManager(); Assert.assertNotSame(firstCacheManager, secondCacheManager); Assert.assertNotEquals(firstCacheManager, secondCacheManager); ehcacheShiroManager.destroy(); Assert.assertEquals(Status.UNINITIALIZED, firstCacheManager.getStatus()); Assert.assertEquals(Status.AVAILABLE, secondCacheManager.getStatus()); }
Example 4
Source File: JrpipTestCase.java From jrpip with Apache License 2.0 | 6 votes |
protected Echo buildEchoProxy(int timeout) throws MalformedURLException { FastServletProxyFactory fspf = new FastServletProxyFactory(); fspf.setUseLocalService(false); Echo echo; if (timeout == 0) { echo = fspf.create(Echo.class, this.jrpipUrl); } else { echo = fspf.create(Echo.class, this.jrpipUrl, timeout); } Assert.assertNotSame(echo.getClass(), EchoImpl.class); return echo; }
Example 5
Source File: SocketTestCase.java From jrpip with Apache License 2.0 | 6 votes |
protected Echo buildEchoFromTransport(int timeout, SocketMessageTransport transport) throws MalformedURLException { MtProxyFactory factory = new MtProxyFactory(transport); factory.setUseLocalService(false); Echo echo; if (timeout == 0) { echo = factory.create(Echo.class, this.jrpipUrl); } else { echo = factory.create(Echo.class, this.jrpipUrl, timeout); } Assert.assertNotSame(echo.getClass(), EchoImpl.class); return echo; }
Example 6
Source File: UnivariateStatisticAbstractTest.java From hipparchus with Apache License 2.0 | 6 votes |
@Test public void testCopyData() { UnivariateStatistic stat = getUnivariateStatistic(); if (stat instanceof AbstractUnivariateStatistic) { AbstractUnivariateStatistic original = (AbstractUnivariateStatistic) stat; original.setData(testArray); Assert.assertEquals(expectedValue(), original.evaluate(), getTolerance()); AbstractUnivariateStatistic copy = (AbstractUnivariateStatistic) original.copy(); Assert.assertEquals(original.evaluate(), copy.evaluate(), getTolerance()); Assert.assertArrayEquals(original.getData(), copy.getData(), 1e-10); Assert.assertNotSame(original.getDataRef(), copy.getDataRef()); } }
Example 7
Source File: RelationIdAccessTestBase.java From crnk-framework with Apache License 2.0 | 6 votes |
private Schedule checkPatch(Schedule schedule) { project2 = new Project(); project2.setName("myProject2"); project2 = projectRepo.create(project2); schedule.setProjectId(project2.getId()); schedule.setProjectIds(Arrays.asList(project.getId(), project2.getId())); Schedule savedSchedule = scheduleRepo.save(schedule); Schedule serverSchedule = testContainer.getTestData(Schedule.class, 1L); Assert.assertEquals(project2.getId(), serverSchedule.getProjectId()); Assert.assertEquals(2, serverSchedule.getProjectIds().size()); Assert.assertEquals(project.getId(), serverSchedule.getProjectIds().get(0)); Assert.assertEquals(project2.getId(), serverSchedule.getProjectIds().get(1)); Assert.assertNull(serverSchedule.getProject()); Assert.assertNotSame(schedule, savedSchedule); Assert.assertEquals(project2.getId(), savedSchedule.getProjectId()); Assert.assertEquals(2, savedSchedule.getProjectIds().size()); return savedSchedule; }
Example 8
Source File: ODEStateInterpolatorAbstractTest.java From hipparchus with Apache License 2.0 | 6 votes |
protected void doRestrictPrevious(double epsilon, double epsilonDot) { AbstractODEStateInterpolator original = setUpInterpolator(new SinCos(), 0.0, new double[] { 0.0, 1.0 }, 0.125); Assert.assertEquals(false, original.isPreviousStateInterpolated()); Assert.assertEquals(false, original.isCurrentStateInterpolated()); AbstractODEStateInterpolator restricted = original.restrictStep(original.getInterpolatedState(1.0 / 32), original.getCurrentState()); Assert.assertSame(original.getPreviousState(), original.getGlobalPreviousState()); Assert.assertSame(original.getCurrentState(), original.getGlobalCurrentState()); Assert.assertSame(original.getGlobalPreviousState(), restricted.getGlobalPreviousState()); Assert.assertSame(original.getGlobalCurrentState(), restricted.getGlobalCurrentState()); Assert.assertNotSame(restricted.getPreviousState(), restricted.getGlobalPreviousState()); Assert.assertSame(restricted.getCurrentState(), restricted.getGlobalCurrentState()); Assert.assertEquals(1.0 / 32, restricted.getPreviousState().getTime(), 1.0e-15); Assert.assertEquals(true, restricted.isPreviousStateInterpolated()); Assert.assertEquals(false, restricted.isCurrentStateInterpolated()); checkRestricted(original, restricted, epsilon, epsilonDot); }
Example 9
Source File: SkolemIDTest.java From spf with GNU General Public License v2.0 | 5 votes |
@Test public void test4() { final LogicalExpression exp = TestServices.CATEGORY_SERVICES .readSemantics("(boo:<id,<<e,t>,t>> !5 (lambda $0:e (p:<e*,t> (io:<id,<<e,t>,e>> !6 (lambda $1:e false:t)) (io:<id,<<e,t>,e>> !5 (lambda $1:e true:t)))))"); final LogicalExpression exp2 = TestServices.CATEGORY_SERVICES .readSemantics("(boo:<id,<<e,t>,t>> !6 (lambda $0:e (p:<e*,t> (io:<id,<<e,t>,e>> !5 (lambda $1:e true:t)) (io:<id,<<e,t>,e>> !6 (lambda $1:e false:t)))))"); Assert.assertNotSame(exp, exp2); }
Example 10
Source File: IndentationAwarePartialParsingErrorTest.java From xtext-core with Eclipse Public License 2.0 | 5 votes |
@Test public void testResourceUpdate_02() { try { StringConcatenation _builder = new StringConcatenation(); _builder.append("a"); _builder.newLine(); _builder.append("\t"); _builder.append("x"); _builder.newLine(); _builder.append("\t\t"); _builder.append("b // two tabs"); _builder.newLine(); _builder.append("\t "); _builder.append("// tab and 8 spaces (eq 2 tabs)"); _builder.newLine(); _builder.append("\t"); _builder.append("y"); _builder.newLine(); final String model = _builder.toString(); final Tree tree = this.parseHelper.parse(model); Resource _eResource = tree.eResource(); final XtextResource resource = ((XtextResource) _eResource); final int idx = model.indexOf(" // tab"); resource.update(idx, 0, "c"); EObject _head = IterableExtensions.<EObject>head(resource.getContents()); final Tree reparsed = ((Tree) _head); Assert.assertNotSame(tree, reparsed); } catch (Throwable _e) { throw Exceptions.sneakyThrow(_e); } }
Example 11
Source File: TestDiscoveryTree.java From servicecomb-java-chassis with Apache License 2.0 | 5 votes |
@Test public void getOrCreateRoot_tempRoot() { Deencapsulation.setField(discoveryTree, "root", parent); VersionedCache inputCache = new VersionedCache().cacheVersion(parent.cacheVersion() - 1); DiscoveryTreeNode root = discoveryTree.getOrCreateRoot(inputCache); Assert.assertEquals(inputCache.cacheVersion(), root.cacheVersion()); Assert.assertNotSame(Deencapsulation.getField(discoveryTree, "root"), root); }
Example 12
Source File: SortSpecTest.java From crnk-framework with Apache License 2.0 | 5 votes |
@Test public void testClone() { SortSpec sortSpec = new SortSpec(Arrays.asList("sortAttr"), Direction.ASC); SortSpec duplicate = sortSpec.clone(); Assert.assertNotSame(sortSpec, duplicate); Assert.assertNotSame(sortSpec.getAttributePath(), duplicate.getAttributePath()); Assert.assertSame(sortSpec.getDirection(), duplicate.getDirection()); }
Example 13
Source File: VertxAssert.java From sfs with Apache License 2.0 | 5 votes |
public static void assertNotSame(TestContext context, Object expected, Object actual) { try { Assert.assertNotSame(expected, actual); } catch (Throwable e) { context.fail(e); } }
Example 14
Source File: TestSwaggerLoader.java From servicecomb-java-chassis with Apache License 2.0 | 5 votes |
@Test public void loadFromResource_sameApp_dirWithApp() { Swagger swagger = SwaggerGenerator.generate(Hello.class); mockLocalResource(swagger, String.format("applications/%s/%s/%s.yaml", appId, serviceName, schemaId)); RegistrationManager.INSTANCE.getSwaggerLoader().unregisterSwagger(appId, serviceName, schemaId); Microservice microservice = appManager.getOrCreateMicroserviceVersions(appId, serviceName) .getVersions().values().iterator().next().getMicroservice(); Swagger loadedSwagger = RegistrationManager.INSTANCE .getSwaggerLoader().loadSwagger(microservice, null, schemaId); Assert.assertNotSame(swagger, loadedSwagger); Assert.assertEquals(swagger, loadedSwagger); }
Example 15
Source File: BuiltInTypeScopeTest.java From n4js with Eclipse Public License 1.0 | 5 votes |
@SuppressWarnings("javadoc") @Test public void testResolveAllBuiltInTypes() { BuiltInTypeScope scope = BuiltInTypeScope.get(resourceSet); IEObjectDescription description = scope.getSingleElement(QualifiedName.create("any")); // trigger loading // assert that the built in resources are loaded into a delegate resource set Assert.assertEquals(0, resourceSet.getResources().size()); EObject objectOrProxy = description.getEObjectOrProxy(); Assert.assertFalse(objectOrProxy.eIsProxy()); ResourceSet builtInResourceSet = objectOrProxy.eResource().getResourceSet(); Assert.assertNotSame(resourceSet, builtInResourceSet); // trigger more loading GlobalObjectScope.get(resourceSet).getAllElements(); VirtualBaseTypeScope.get(resourceSet).getAllElements(); Assert.assertEquals(FluentIterable.from(builtInResourceSet.getResources()).transform(Resource::getURI) .join(Joiner.on('\n')), 7, builtInResourceSet.getResources().size()); EcoreUtil.resolveAll(builtInResourceSet); Map<EObject, Collection<Setting>> unresolvedProxies = EcoreUtil.UnresolvedProxyCrossReferencer .find(builtInResourceSet); Assert.assertTrue(unresolvedProxies.toString(), unresolvedProxies.isEmpty()); Assert.assertTrue(N4Scheme.isFromResourceWithN4Scheme(objectOrProxy)); EObject loadedViaPrimary = resourceSet.getEObject(description.getEObjectURI(), false); Assert.assertSame(objectOrProxy, loadedViaPrimary); }
Example 16
Source File: TestDefaultTcpClientMetrics.java From servicecomb-java-chassis with Apache License 2.0 | 5 votes |
@Test public void createEndpoint() { Assert.assertSame(endpointMetric_a_1, endpointMetric_b_1); Assert.assertNotSame(endpointMetric_a_1, endpointMetric_a_2); Assert.assertNotSame(endpointMetric_a_2, endpointMetric_b_1); Assert.assertSame(endpointMetric_a_2, endpointMetric_b_2); Assert.assertEquals(2, endpointMetric_a_1.getCurrentConnectionCount()); Assert.assertEquals(2, endpointMetric_a_2.getCurrentConnectionCount()); }
Example 17
Source File: TestSwaggerLoader.java From servicecomb-java-chassis with Apache License 2.0 | 5 votes |
@Test public void loadFromResource_sameApp_dirWithoutApp() { Swagger swagger = SwaggerGenerator.generate(Hello.class); mockLocalResource(swagger, String.format("microservices/%s/%s.yaml", serviceName, schemaId)); RegistrationManager.INSTANCE.getSwaggerLoader().unregisterSwagger(appId, serviceName, schemaId); Microservice microservice = appManager.getOrCreateMicroserviceVersions(appId, serviceName) .getVersions().values().iterator().next().getMicroservice(); Swagger loadedSwagger = RegistrationManager.INSTANCE .getSwaggerLoader().loadSwagger(microservice, null, schemaId); Assert.assertNotSame(swagger, loadedSwagger); Assert.assertEquals(swagger, loadedSwagger); }
Example 18
Source File: TestYarnCLI.java From big-c with Apache License 2.0 | 5 votes |
@Test public void testGetApplicationAttemptReportException() throws Exception { ApplicationCLI cli = createAndGetAppCLI(); ApplicationId applicationId = ApplicationId.newInstance(1234, 5); ApplicationAttemptId attemptId1 = ApplicationAttemptId.newInstance( applicationId, 1); when(client.getApplicationAttemptReport(attemptId1)).thenThrow( new ApplicationNotFoundException("History file for application" + applicationId + " is not found")); int exitCode = cli.run(new String[] { "applicationattempt", "-status", attemptId1.toString() }); verify(sysOut).println( "Application for AppAttempt with id '" + attemptId1 + "' doesn't exist in RM or Timeline Server."); Assert.assertNotSame("should return non-zero exit code.", 0, exitCode); ApplicationAttemptId attemptId2 = ApplicationAttemptId.newInstance( applicationId, 2); when(client.getApplicationAttemptReport(attemptId2)).thenThrow( new ApplicationAttemptNotFoundException( "History file for application attempt" + attemptId2 + " is not found")); exitCode = cli.run(new String[] { "applicationattempt", "-status", attemptId2.toString() }); verify(sysOut).println( "Application Attempt with id '" + attemptId2 + "' doesn't exist in RM or Timeline Server."); Assert.assertNotSame("should return non-zero exit code.", 0, exitCode); }
Example 19
Source File: AbstractBSPTreeTest.java From commons-geometry with Apache License 2.0 | 5 votes |
@Test public void testCopy_rootOnly() { // arrange TestBSPTree tree = new TestBSPTree(); // act TestBSPTree copy = new TestBSPTree(); copy.copy(tree); // assert Assert.assertNotSame(tree, copy); Assert.assertNotSame(tree.getRoot(), copy.getRoot()); Assert.assertEquals(tree.count(), copy.count()); }
Example 20
Source File: TestYarnCLI.java From big-c with Apache License 2.0 | 4 votes |
@Test public void testGetContainerReportException() throws Exception { ApplicationCLI cli = createAndGetAppCLI(); ApplicationId applicationId = ApplicationId.newInstance(1234, 5); ApplicationAttemptId attemptId = ApplicationAttemptId.newInstance( applicationId, 1); long cntId = 1; ContainerId containerId1 = ContainerId.newContainerId(attemptId, cntId++); when(client.getContainerReport(containerId1)).thenThrow( new ApplicationNotFoundException("History file for application" + applicationId + " is not found")); int exitCode = cli.run(new String[] { "container", "-status", containerId1.toString() }); verify(sysOut).println( "Application for Container with id '" + containerId1 + "' doesn't exist in RM or Timeline Server."); Assert.assertNotSame("should return non-zero exit code.", 0, exitCode); ContainerId containerId2 = ContainerId.newContainerId(attemptId, cntId++); when(client.getContainerReport(containerId2)).thenThrow( new ApplicationAttemptNotFoundException( "History file for application attempt" + attemptId + " is not found")); exitCode = cli.run(new String[] { "container", "-status", containerId2.toString() }); verify(sysOut).println( "Application Attempt for Container with id '" + containerId2 + "' doesn't exist in RM or Timeline Server."); Assert.assertNotSame("should return non-zero exit code.", 0, exitCode); ContainerId containerId3 = ContainerId.newContainerId(attemptId, cntId++); when(client.getContainerReport(containerId3)).thenThrow( new ContainerNotFoundException("History file for container" + containerId3 + " is not found")); exitCode = cli.run(new String[] { "container", "-status", containerId3.toString() }); verify(sysOut).println( "Container with id '" + containerId3 + "' doesn't exist in RM or Timeline Server."); Assert.assertNotSame("should return non-zero exit code.", 0, exitCode); }