How to deal with properties in Spring context tests?

@ComponentScan("my.company.example*")
@Configuration
@PropertySource("classpath:/my/company/props/from/file/test.properties")
public class MyTestConfig {

static {
System.setProperty("my.company.hard.coded.props.example", "true"); 
}

/** properties loading */
@Bean
public static PropertySourcesPlaceholderConfigurer properties() {
final PropertySourcesPlaceholderConfigurer pspc = new PropertySourcesPlaceholderConfigurer();
pspc.setProperties(System.getProperties());
return pspc;
}
}

Usage:

@RunWith(SpringJUnit4ClassRunner.class)
@SpringApplicationConfiguration(classes = MyTestConfig.class)
public class MySpringTest {

Java SSH Client

http://www.yegor256.com/2014/09/02/java-ssh-client.html

String hello = new Shell.Plain(
  new SSH(
    "ssh.example.com", 22,
    "yegor", "-----BEGIN RSA PRIVATE KEY-----..."
  )
).exec("echo 'Hello, world!'");

Java console program + Maven

Use “Assembler Plugin”:

http://www.mojohaus.org/appassembler/appassembler-maven-plugin/usage-program.html

How it looks:

$ mvn package appassembler:assemble
...
$ sh target/appassembler/bin/app
Hello World!

Linux renaming many files

My task was to rename many i18n files, because of technology migration. I found following solution:

rename 's/app_/messages_/' app*properties

Example of result:

app_it.properties -> messages_it.properties