Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Loading…

Force language because JUnit tests depend on english language strings #45

Merged
merged 1 commit into from

2 participants

@smmmo
  • Fix in pom.xml to fix build for non-english environments (e.g. german)
  • Fix in RendererConfigurationTest.java for running JUnit tests in eclipse

Error message from failed maven build:

[...]
Running net.pms.test.RendererConfigurationTest
Tests run: 3, Failures: 1, Errors: 0, Skipped: 0, Time elapsed: 0.068 sec <<< FAILURE!

Results :

Failed tests: testBogusDefault(net.pms.test.RendererConfigurationTest): Expected renderer "Unknown renderer", instead renderer "Unbekannter DLNA Client" was returned for header "User-Agent: AirPlayer/1.0.09 CFNetwork/485.13.9 Darwin/11.0.0" expected: but was:
[...]

@Raptor399
Owner

Nicely spotted, thanks!

@Raptor399 Raptor399 merged commit 071b5e4 into ps3mediaserver:master
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
This page is out of date. Refresh to see the latest.
View
4 pom.xml
@@ -433,6 +433,10 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
+ <configuration>
+ <!-- Force language because JUnit tests depend on english language strings -->
+ <argLine>-Duser.language=en</argLine>
+ </configuration>
<version>2.11</version>
</plugin>
<!--This plugin's configuration is used to store Eclipse m2e settings only. It has no influence on the Maven build itself.-->
View
10 src/test/java/net/pms/test/RendererConfigurationTest.java
@@ -25,6 +25,7 @@
import java.io.IOException;
import java.util.HashMap;
import java.util.Iterator;
+import java.util.Locale;
import java.util.Map;
import java.util.Map.Entry;
import java.util.Set;
@@ -48,9 +49,12 @@
@Before
public void setUp() {
- // Silence all log messages from the PMS code that is being tested
- LoggerContext context = (LoggerContext) LoggerFactory.getILoggerFactory();
- context.reset();
+ // Silence all log messages from the PMS code that is being tested
+ LoggerContext context = (LoggerContext) LoggerFactory.getILoggerFactory();
+ context.reset();
+
+ // Set locale to EN to ignore translations for renderers
+ Locale.setDefault(Locale.ENGLISH);
// Cases that are too generic should not match anything
testCases.put("User-Agent: UPnP/1.0 DLNADOC/1.50", null);
Something went wrong with that request. Please try again.