Commit 174b654f authored by sopov.ivan's avatar sopov.ivan Committed by Dave Syer

minor test fixes

Reverting arguments in assertEquals where constant was placed on
the "actual" place. Replacing assertEquals with assertFalse, assertTrue
and assertNull where applicable.

Fixes gh-735
parent 72ff1dd1
...@@ -58,7 +58,7 @@ import static org.junit.Assert.assertTrue; ...@@ -58,7 +58,7 @@ import static org.junit.Assert.assertTrue;
/** /**
* Tests for {@link CrshAutoConfiguration}. * Tests for {@link CrshAutoConfiguration}.
* *
* @author Christian Dupuis * @author Christian Dupuis
*/ */
@SuppressWarnings({ "rawtypes", "unchecked" }) @SuppressWarnings({ "rawtypes", "unchecked" })
...@@ -117,7 +117,7 @@ public class CrshAutoConfigurationTests { ...@@ -117,7 +117,7 @@ public class CrshAutoConfigurationTests {
PluginLifeCycle lifeCycle = this.context.getBean(PluginLifeCycle.class); PluginLifeCycle lifeCycle = this.context.getBean(PluginLifeCycle.class);
assertEquals(lifeCycle.getConfig().getProperty("crash.ssh.port"), "3333"); assertEquals("3333", lifeCycle.getConfig().getProperty("crash.ssh.port"));
} }
@Test @Test
...@@ -132,8 +132,7 @@ public class CrshAutoConfigurationTests { ...@@ -132,8 +132,7 @@ public class CrshAutoConfigurationTests {
PluginLifeCycle lifeCycle = this.context.getBean(PluginLifeCycle.class); PluginLifeCycle lifeCycle = this.context.getBean(PluginLifeCycle.class);
assertEquals(lifeCycle.getConfig().getProperty("crash.ssh.keypath"), assertEquals("~/.ssh/id.pem", lifeCycle.getConfig().getProperty("crash.ssh.keypath"));
"~/.ssh/id.pem");
} }
@Test @Test
...@@ -194,7 +193,7 @@ public class CrshAutoConfigurationTests { ...@@ -194,7 +193,7 @@ public class CrshAutoConfigurationTests {
this.context.refresh(); this.context.refresh();
PluginLifeCycle lifeCycle = this.context.getBean(PluginLifeCycle.class); PluginLifeCycle lifeCycle = this.context.getBean(PluginLifeCycle.class);
assertEquals(lifeCycle.getConfig().get("crash.auth"), "simple"); assertEquals("simple", lifeCycle.getConfig().get("crash.auth"));
} }
@Test @Test
...@@ -210,9 +209,8 @@ public class CrshAutoConfigurationTests { ...@@ -210,9 +209,8 @@ public class CrshAutoConfigurationTests {
this.context.refresh(); this.context.refresh();
PluginLifeCycle lifeCycle = this.context.getBean(PluginLifeCycle.class); PluginLifeCycle lifeCycle = this.context.getBean(PluginLifeCycle.class);
assertEquals(lifeCycle.getConfig().get("crash.auth"), "jaas"); assertEquals("jaas", lifeCycle.getConfig().get("crash.auth"));
assertEquals(lifeCycle.getConfig().get("crash.auth.jaas.domain"), assertEquals("my-test-domain", lifeCycle.getConfig().get("crash.auth.jaas.domain"));
"my-test-domain");
} }
@Test @Test
...@@ -228,8 +226,8 @@ public class CrshAutoConfigurationTests { ...@@ -228,8 +226,8 @@ public class CrshAutoConfigurationTests {
this.context.refresh(); this.context.refresh();
PluginLifeCycle lifeCycle = this.context.getBean(PluginLifeCycle.class); PluginLifeCycle lifeCycle = this.context.getBean(PluginLifeCycle.class);
assertEquals(lifeCycle.getConfig().get("crash.auth"), "key"); assertEquals("key", lifeCycle.getConfig().get("crash.auth"));
assertEquals(lifeCycle.getConfig().get("crash.auth.key.path"), "~/test.pem"); assertEquals("~/test.pem", lifeCycle.getConfig().get("crash.auth.key.path"));
} }
@Test @Test
...@@ -246,7 +244,7 @@ public class CrshAutoConfigurationTests { ...@@ -246,7 +244,7 @@ public class CrshAutoConfigurationTests {
this.context.refresh(); this.context.refresh();
PluginLifeCycle lifeCycle = this.context.getBean(PluginLifeCycle.class); PluginLifeCycle lifeCycle = this.context.getBean(PluginLifeCycle.class);
assertEquals(lifeCycle.getConfig().get("crash.auth"), "simple"); assertEquals("simple", lifeCycle.getConfig().get("crash.auth"));
AuthenticationPlugin<String> authenticationPlugin = null; AuthenticationPlugin<String> authenticationPlugin = null;
String authentication = lifeCycle.getConfig().getProperty("crash.auth"); String authentication = lifeCycle.getConfig().getProperty("crash.auth");
...@@ -260,8 +258,7 @@ public class CrshAutoConfigurationTests { ...@@ -260,8 +258,7 @@ public class CrshAutoConfigurationTests {
} }
assertNotNull(authenticationPlugin); assertNotNull(authenticationPlugin);
assertTrue(authenticationPlugin.authenticate("user", "password")); assertTrue(authenticationPlugin.authenticate("user", "password"));
assertFalse(authenticationPlugin.authenticate(UUID.randomUUID().toString(), assertFalse(authenticationPlugin.authenticate(UUID.randomUUID().toString(), "password"));
"password"));
} }
@Test @Test
...@@ -287,11 +284,9 @@ public class CrshAutoConfigurationTests { ...@@ -287,11 +284,9 @@ public class CrshAutoConfigurationTests {
break; break;
} }
} }
assertTrue(authenticationPlugin.authenticate(SecurityConfiguration.USERNAME, assertTrue(authenticationPlugin.authenticate(SecurityConfiguration.USERNAME, SecurityConfiguration.PASSWORD));
SecurityConfiguration.PASSWORD));
assertFalse(authenticationPlugin.authenticate(UUID.randomUUID().toString(), assertFalse(authenticationPlugin.authenticate(UUID.randomUUID().toString(), SecurityConfiguration.PASSWORD));
SecurityConfiguration.PASSWORD));
} }
@Test @Test
...@@ -316,11 +311,9 @@ public class CrshAutoConfigurationTests { ...@@ -316,11 +311,9 @@ public class CrshAutoConfigurationTests {
break; break;
} }
} }
assertTrue(authenticationPlugin.authenticate(SecurityConfiguration.USERNAME, assertTrue(authenticationPlugin.authenticate(SecurityConfiguration.USERNAME, SecurityConfiguration.PASSWORD));
SecurityConfiguration.PASSWORD));
assertFalse(authenticationPlugin.authenticate(UUID.randomUUID().toString(), assertFalse(authenticationPlugin.authenticate(UUID.randomUUID().toString(), SecurityConfiguration.PASSWORD));
SecurityConfiguration.PASSWORD));
} }
@Configuration @Configuration
......
...@@ -58,7 +58,7 @@ public class RabbitAutoconfigurationTests { ...@@ -58,7 +58,7 @@ public class RabbitAutoconfigurationTests {
assertNotNull(connectionFactory); assertNotNull(connectionFactory);
assertNotNull(amqpAdmin); assertNotNull(amqpAdmin);
assertEquals(rabbitTemplate.getConnectionFactory(), connectionFactory); assertEquals(rabbitTemplate.getConnectionFactory(), connectionFactory);
assertEquals(connectionFactory.getHost(), "localhost"); assertEquals("localhost", connectionFactory.getHost());
} }
@Test @Test
...@@ -72,9 +72,9 @@ public class RabbitAutoconfigurationTests { ...@@ -72,9 +72,9 @@ public class RabbitAutoconfigurationTests {
this.context.refresh(); this.context.refresh();
CachingConnectionFactory connectionFactory = this.context CachingConnectionFactory connectionFactory = this.context
.getBean(CachingConnectionFactory.class); .getBean(CachingConnectionFactory.class);
assertEquals(connectionFactory.getHost(), "remote-server"); assertEquals("remote-server", connectionFactory.getHost());
assertEquals(connectionFactory.getPort(), 9000); assertEquals(9000, connectionFactory.getPort());
assertEquals(connectionFactory.getVirtualHost(), "/vhost"); assertEquals("/vhost", connectionFactory.getVirtualHost());
} }
@Test @Test
...@@ -86,7 +86,7 @@ public class RabbitAutoconfigurationTests { ...@@ -86,7 +86,7 @@ public class RabbitAutoconfigurationTests {
this.context.refresh(); this.context.refresh();
CachingConnectionFactory connectionFactory = this.context CachingConnectionFactory connectionFactory = this.context
.getBean(CachingConnectionFactory.class); .getBean(CachingConnectionFactory.class);
assertEquals(connectionFactory.getVirtualHost(), "/"); assertEquals("/", connectionFactory.getVirtualHost());
} }
@Test @Test
...@@ -98,7 +98,7 @@ public class RabbitAutoconfigurationTests { ...@@ -98,7 +98,7 @@ public class RabbitAutoconfigurationTests {
this.context.refresh(); this.context.refresh();
CachingConnectionFactory connectionFactory = this.context CachingConnectionFactory connectionFactory = this.context
.getBean(CachingConnectionFactory.class); .getBean(CachingConnectionFactory.class);
assertEquals(connectionFactory.getVirtualHost(), "/foo"); assertEquals("/foo", connectionFactory.getVirtualHost());
} }
@Test @Test
...@@ -110,7 +110,7 @@ public class RabbitAutoconfigurationTests { ...@@ -110,7 +110,7 @@ public class RabbitAutoconfigurationTests {
this.context.refresh(); this.context.refresh();
CachingConnectionFactory connectionFactory = this.context CachingConnectionFactory connectionFactory = this.context
.getBean(CachingConnectionFactory.class); .getBean(CachingConnectionFactory.class);
assertEquals(connectionFactory.getVirtualHost(), "/"); assertEquals("/", connectionFactory.getVirtualHost());
} }
@Test @Test
...@@ -122,8 +122,8 @@ public class RabbitAutoconfigurationTests { ...@@ -122,8 +122,8 @@ public class RabbitAutoconfigurationTests {
CachingConnectionFactory connectionFactory = this.context CachingConnectionFactory connectionFactory = this.context
.getBean(CachingConnectionFactory.class); .getBean(CachingConnectionFactory.class);
assertEquals(rabbitTemplate.getConnectionFactory(), connectionFactory); assertEquals(rabbitTemplate.getConnectionFactory(), connectionFactory);
assertEquals(connectionFactory.getHost(), "otherserver"); assertEquals("otherserver", connectionFactory.getHost());
assertEquals(connectionFactory.getPort(), 8001); assertEquals(8001, connectionFactory.getPort());
} }
@Test @Test
......
...@@ -19,6 +19,7 @@ package org.springframework.boot.autoconfigure.amqp; ...@@ -19,6 +19,7 @@ package org.springframework.boot.autoconfigure.amqp;
import org.junit.Test; import org.junit.Test;
import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNull;
/** /**
* Tests for {@link RabbitProperties}. * Tests for {@link RabbitProperties}.
...@@ -45,7 +46,7 @@ public class RabbitPropertiesTests { ...@@ -45,7 +46,7 @@ public class RabbitPropertiesTests {
@Test @Test
public void addressesDoubleValued() { public void addressesDoubleValued() {
this.properties.setAddresses("myhost:9999,otherhost:1111"); this.properties.setAddresses("myhost:9999,otherhost:1111");
assertEquals(null, this.properties.getHost()); assertNull(this.properties.getHost());
assertEquals(9999, this.properties.getPort()); assertEquals(9999, this.properties.getPort());
} }
......
...@@ -26,6 +26,7 @@ import org.springframework.context.annotation.AnnotationConfigApplicationContext ...@@ -26,6 +26,7 @@ import org.springframework.context.annotation.AnnotationConfigApplicationContext
import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotNull; import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertTrue;
/** /**
* Tests for {@link CommonsDataSourceConfiguration}. * Tests for {@link CommonsDataSourceConfiguration}.
...@@ -62,9 +63,9 @@ public class CommonsDataSourceConfigurationTests { ...@@ -62,9 +63,9 @@ public class CommonsDataSourceConfigurationTests {
this.context.refresh(); this.context.refresh();
BasicDataSource ds = this.context.getBean(BasicDataSource.class); BasicDataSource ds = this.context.getBean(BasicDataSource.class);
assertEquals("jdbc:foo//bar/spam", ds.getUrl()); assertEquals("jdbc:foo//bar/spam", ds.getUrl());
assertEquals(true, ds.getTestWhileIdle()); assertTrue(ds.getTestWhileIdle());
assertEquals(true, ds.getTestOnBorrow()); assertTrue(ds.getTestOnBorrow());
assertEquals(true, ds.getTestOnReturn()); assertTrue(ds.getTestOnReturn());
assertEquals(10000, ds.getTimeBetweenEvictionRunsMillis()); assertEquals(10000, ds.getTimeBetweenEvictionRunsMillis());
assertEquals(12345, ds.getMinEvictableIdleTimeMillis()); assertEquals(12345, ds.getMinEvictableIdleTimeMillis());
assertEquals(1234, ds.getMaxWait()); assertEquals(1234, ds.getMaxWait());
......
...@@ -33,6 +33,7 @@ import org.springframework.util.ReflectionUtils; ...@@ -33,6 +33,7 @@ import org.springframework.util.ReflectionUtils;
import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotNull; import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertTrue;
import static org.junit.Assert.fail; import static org.junit.Assert.fail;
/** /**
...@@ -80,9 +81,9 @@ public class TomcatDataSourceConfigurationTests { ...@@ -80,9 +81,9 @@ public class TomcatDataSourceConfigurationTests {
org.apache.tomcat.jdbc.pool.DataSource ds = this.context org.apache.tomcat.jdbc.pool.DataSource ds = this.context
.getBean(org.apache.tomcat.jdbc.pool.DataSource.class); .getBean(org.apache.tomcat.jdbc.pool.DataSource.class);
assertEquals("jdbc:foo//bar/spam", ds.getUrl()); assertEquals("jdbc:foo//bar/spam", ds.getUrl());
assertEquals(true, ds.isTestWhileIdle()); assertTrue(ds.isTestWhileIdle());
assertEquals(true, ds.isTestOnBorrow()); assertTrue(ds.isTestOnBorrow());
assertEquals(true, ds.isTestOnReturn()); assertTrue(ds.isTestOnReturn());
assertEquals(10000, ds.getTimeBetweenEvictionRunsMillis()); assertEquals(10000, ds.getTimeBetweenEvictionRunsMillis());
assertEquals(12345, ds.getMinEvictableIdleTimeMillis()); assertEquals(12345, ds.getMinEvictableIdleTimeMillis());
assertEquals(1234, ds.getMaxWait()); assertEquals(1234, ds.getMaxWait());
......
...@@ -36,7 +36,7 @@ import static org.junit.Assert.assertTrue; ...@@ -36,7 +36,7 @@ import static org.junit.Assert.assertTrue;
/** /**
* Tests for {@link JmsTemplateAutoConfiguration}. * Tests for {@link JmsTemplateAutoConfiguration}.
* *
* @author Greg Turnquist * @author Greg Turnquist
*/ */
public class JmsTemplateAutoConfigurationTests { public class JmsTemplateAutoConfigurationTests {
...@@ -55,10 +55,7 @@ public class JmsTemplateAutoConfigurationTests { ...@@ -55,10 +55,7 @@ public class JmsTemplateAutoConfigurationTests {
assertNotNull(jmsTemplate); assertNotNull(jmsTemplate);
assertNotNull(connectionFactory); assertNotNull(connectionFactory);
assertEquals(jmsTemplate.getConnectionFactory(), connectionFactory); assertEquals(jmsTemplate.getConnectionFactory(), connectionFactory);
assertEquals( assertEquals("vm://localhost", ((ActiveMQConnectionFactory) jmsTemplate.getConnectionFactory()).getBrokerURL());
((ActiveMQConnectionFactory) jmsTemplate.getConnectionFactory())
.getBrokerURL(),
"vm://localhost");
} }
@Test @Test
...@@ -144,10 +141,8 @@ public class JmsTemplateAutoConfigurationTests { ...@@ -144,10 +141,8 @@ public class JmsTemplateAutoConfigurationTests {
assertNotNull(jmsTemplate); assertNotNull(jmsTemplate);
assertNotNull(connectionFactory); assertNotNull(connectionFactory);
assertEquals(jmsTemplate.getConnectionFactory(), connectionFactory); assertEquals(jmsTemplate.getConnectionFactory(), connectionFactory);
assertEquals( assertEquals("tcp://localhost:61616",
((ActiveMQConnectionFactory) jmsTemplate.getConnectionFactory()) ((ActiveMQConnectionFactory) jmsTemplate.getConnectionFactory()).getBrokerURL());
.getBrokerURL(),
"tcp://localhost:61616");
} }
@Test @Test
...@@ -165,10 +160,8 @@ public class JmsTemplateAutoConfigurationTests { ...@@ -165,10 +160,8 @@ public class JmsTemplateAutoConfigurationTests {
assertNotNull(jmsTemplate); assertNotNull(jmsTemplate);
assertNotNull(connectionFactory); assertNotNull(connectionFactory);
assertEquals(jmsTemplate.getConnectionFactory(), connectionFactory); assertEquals(jmsTemplate.getConnectionFactory(), connectionFactory);
assertEquals( assertEquals("tcp://remote-host:10000",
((ActiveMQConnectionFactory) jmsTemplate.getConnectionFactory()) ((ActiveMQConnectionFactory) jmsTemplate.getConnectionFactory()).getBrokerURL());
.getBrokerURL(),
"tcp://remote-host:10000");
} }
@Test @Test
......
...@@ -162,14 +162,14 @@ public class MultipartAutoConfigurationTests { ...@@ -162,14 +162,14 @@ public class MultipartAutoConfigurationTests {
this.context.register(ContainerWithNoMultipartTomcat.class, this.context.register(ContainerWithNoMultipartTomcat.class,
BaseConfiguration.class); BaseConfiguration.class);
this.context.refresh(); this.context.refresh();
assertEquals(this.context.getBeansOfType(MultipartConfigElement.class).size(), 0); assertEquals(0, this.context.getBeansOfType(MultipartConfigElement.class).size());
} }
private void verifyServletWorks() { private void verifyServletWorks() {
RestTemplate restTemplate = new RestTemplate(); RestTemplate restTemplate = new RestTemplate();
assertEquals(restTemplate.getForObject("http://localhost:" assertEquals("Hello", restTemplate.getForObject("http://localhost:"
+ this.context.getEmbeddedServletContainer().getPort() + "/", + this.context.getEmbeddedServletContainer().getPort() + "/",
String.class), "Hello"); String.class));
} }
@Configuration @Configuration
......
...@@ -31,6 +31,7 @@ import org.springframework.boot.cli.command.core.HintCommand; ...@@ -31,6 +31,7 @@ import org.springframework.boot.cli.command.core.HintCommand;
import static org.hamcrest.Matchers.equalTo; import static org.hamcrest.Matchers.equalTo;
import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNull;
import static org.junit.Assert.assertThat; import static org.junit.Assert.assertThat;
import static org.mockito.BDDMockito.given; import static org.mockito.BDDMockito.given;
import static org.mockito.BDDMockito.willThrow; import static org.mockito.BDDMockito.willThrow;
...@@ -124,7 +125,7 @@ public class CommandRunnerTests { ...@@ -124,7 +125,7 @@ public class CommandRunnerTests {
verify(this.regularCommand).run("--", "--debug", "bar"); verify(this.regularCommand).run("--", "--debug", "bar");
// When handled by the command itself it shouldn't cause the system property to be // When handled by the command itself it shouldn't cause the system property to be
// set // set
assertEquals(null, System.getProperty("debug")); assertNull(System.getProperty("debug"));
} }
@Test @Test
......
...@@ -32,6 +32,7 @@ import org.springframework.test.util.ReflectionTestUtils; ...@@ -32,6 +32,7 @@ import org.springframework.test.util.ReflectionTestUtils;
import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotNull; import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertNull;
import static org.junit.Assert.assertTrue; import static org.junit.Assert.assertTrue;
/** /**
...@@ -71,7 +72,7 @@ public class PropertiesLauncherTests { ...@@ -71,7 +72,7 @@ public class PropertiesLauncherTests {
public void testUserSpecifiedMain() throws Exception { public void testUserSpecifiedMain() throws Exception {
PropertiesLauncher launcher = new PropertiesLauncher(); PropertiesLauncher launcher = new PropertiesLauncher();
assertEquals("demo.Application", launcher.getMainClass()); assertEquals("demo.Application", launcher.getMainClass());
assertEquals(null, System.getProperty("loader.main")); assertNull(System.getProperty("loader.main"));
} }
@Test @Test
......
...@@ -54,6 +54,7 @@ import org.springframework.validation.beanvalidation.LocalValidatorFactoryBean; ...@@ -54,6 +54,7 @@ import org.springframework.validation.beanvalidation.LocalValidatorFactoryBean;
import static java.lang.annotation.RetentionPolicy.RUNTIME; import static java.lang.annotation.RetentionPolicy.RUNTIME;
import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse; import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertNull;
/** /**
* Tests for {@link RelaxedDataBinder}. * Tests for {@link RelaxedDataBinder}.
...@@ -185,7 +186,7 @@ public class RelaxedDataBinderTests { ...@@ -185,7 +186,7 @@ public class RelaxedDataBinderTests {
BindingResult result = bind(binder, target, "foo: bar\n" + "value: 123\n" BindingResult result = bind(binder, target, "foo: bar\n" + "value: 123\n"
+ "bar: spam"); + "bar: spam");
assertEquals(123, target.getValue()); assertEquals(123, target.getValue());
assertEquals(null, target.getFoo()); assertNull(target.getFoo());
assertEquals(0, result.getErrorCount()); assertEquals(0, result.getErrorCount());
} }
......
...@@ -24,6 +24,7 @@ import org.springframework.context.ConfigurableApplicationContext; ...@@ -24,6 +24,7 @@ import org.springframework.context.ConfigurableApplicationContext;
import org.springframework.context.annotation.AnnotationConfigApplicationContext; import org.springframework.context.annotation.AnnotationConfigApplicationContext;
import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNull;
/** /**
* Tests for {@link VcapApplicationListener}. * Tests for {@link VcapApplicationListener}.
...@@ -52,7 +53,7 @@ public class VcapApplicationListenerTests { ...@@ -52,7 +53,7 @@ public class VcapApplicationListenerTests {
public void testUnparseableApplicationProperties() { public void testUnparseableApplicationProperties() {
EnvironmentTestUtils.addEnvironment(this.context, "VCAP_APPLICATION:"); EnvironmentTestUtils.addEnvironment(this.context, "VCAP_APPLICATION:");
this.initializer.onApplicationEvent(this.event); this.initializer.onApplicationEvent(this.event);
assertEquals(null, this.context.getEnvironment().getProperty("vcap")); assertNull(this.context.getEnvironment().getProperty("vcap"));
} }
@Test @Test
...@@ -62,7 +63,7 @@ public class VcapApplicationListenerTests { ...@@ -62,7 +63,7 @@ public class VcapApplicationListenerTests {
this.context, this.context,
"VCAP_APPLICATION:{\"application_users\":null,\"instance_id\":\"bb7935245adf3e650dfb7c58a06e9ece\",\"instance_index\":0,\"version\":\"3464e092-1c13-462e-a47c-807c30318a50\",\"name\":\"foo\",\"uris\":[\"foo.cfapps.io\"],\"started_at\":\"2013-05-29 02:37:59 +0000\",\"started_at_timestamp\":1369795079,\"host\":\"0.0.0.0\",\"port\":61034,\"limits\":{\"mem\":128,\"disk\":1024,\"fds\":16384},\"version\":\"3464e092-1c13-462e-a47c-807c30318a50\",\"name\":\"dsyerenv\",\"uris\":[\"dsyerenv.cfapps.io\"],\"users\":[],\"start\":\"2013-05-29 02:37:59 +0000\",\"state_timestamp\":1369795079}"); "VCAP_APPLICATION:{\"application_users\":null,\"instance_id\":\"bb7935245adf3e650dfb7c58a06e9ece\",\"instance_index\":0,\"version\":\"3464e092-1c13-462e-a47c-807c30318a50\",\"name\":\"foo\",\"uris\":[\"foo.cfapps.io\"],\"started_at\":\"2013-05-29 02:37:59 +0000\",\"started_at_timestamp\":1369795079,\"host\":\"0.0.0.0\",\"port\":61034,\"limits\":{\"mem\":128,\"disk\":1024,\"fds\":16384},\"version\":\"3464e092-1c13-462e-a47c-807c30318a50\",\"name\":\"dsyerenv\",\"uris\":[\"dsyerenv.cfapps.io\"],\"users\":[],\"start\":\"2013-05-29 02:37:59 +0000\",\"state_timestamp\":1369795079}");
this.initializer.onApplicationEvent(this.event); this.initializer.onApplicationEvent(this.event);
assertEquals(null, this.context.getEnvironment().getProperty("vcap")); assertNull(this.context.getEnvironment().getProperty("vcap"));
} }
@Test @Test
......
...@@ -32,6 +32,7 @@ import org.springframework.validation.Errors; ...@@ -32,6 +32,7 @@ import org.springframework.validation.Errors;
import org.springframework.validation.ValidationUtils; import org.springframework.validation.ValidationUtils;
import org.springframework.validation.Validator; import org.springframework.validation.Validator;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotNull; import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertTrue; import static org.junit.Assert.assertTrue;
import static org.junit.Assert.fail; import static org.junit.Assert.fail;
...@@ -64,7 +65,7 @@ public class ConfigurationPropertiesBindingPostProcessorTests { ...@@ -64,7 +65,7 @@ public class ConfigurationPropertiesBindingPostProcessorTests {
} }
catch (BeanCreationException ex) { catch (BeanCreationException ex) {
BindException bex = (BindException) ex.getRootCause(); BindException bex = (BindException) ex.getRootCause();
assertTrue(1 == bex.getErrorCount()); assertEquals(1, bex.getErrorCount());
} }
} }
...@@ -78,7 +79,7 @@ public class ConfigurationPropertiesBindingPostProcessorTests { ...@@ -78,7 +79,7 @@ public class ConfigurationPropertiesBindingPostProcessorTests {
} }
catch (BeanCreationException ex) { catch (BeanCreationException ex) {
BindException bex = (BindException) ex.getRootCause(); BindException bex = (BindException) ex.getRootCause();
assertTrue(1 == bex.getErrorCount()); assertEquals(1, bex.getErrorCount());
} }
} }
...@@ -92,7 +93,7 @@ public class ConfigurationPropertiesBindingPostProcessorTests { ...@@ -92,7 +93,7 @@ public class ConfigurationPropertiesBindingPostProcessorTests {
} }
catch (BeanCreationException ex) { catch (BeanCreationException ex) {
BindException bex = (BindException) ex.getRootCause(); BindException bex = (BindException) ex.getRootCause();
assertTrue(2 == bex.getErrorCount()); assertEquals(2, bex.getErrorCount());
} }
} }
......
...@@ -103,7 +103,7 @@ public class YamlMapFactoryBeanTests { ...@@ -103,7 +103,7 @@ public class YamlMapFactoryBeanTests {
@SuppressWarnings("unchecked") @SuppressWarnings("unchecked")
Map<String, Object> sub = (Map<String, Object>) object; Map<String, Object> sub = (Map<String, Object>) object;
assertTrue(sub.containsKey("key1.key2")); assertTrue(sub.containsKey("key1.key2"));
assertTrue(sub.get("key1.key2").equals("value")); assertEquals("value", sub.get("key1.key2"));
} }
} }
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment