Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: openmrs/openmrs-core
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: 1fa7ebd15c64
Choose a base ref
...
head repository: openmrs/openmrs-core
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: b2889f14e85a
Choose a head ref
  • 2 commits
  • 7 files changed
  • 1 contributor

Commits on Mar 28, 2013

  1. TRUNK-3944: Incorrect mockito, hamcrest and junit dependencies

    (cherry picked from commit 11ba110)
    rkorytkowski committed Mar 28, 2013
    Copy the full SHA
    0a53179 View commit details
  2. TRUNK-3944: Updated junit to 4.11 and fixed tests

    (cherry picked from commit 1171746)
    rkorytkowski committed Mar 28, 2013
    Copy the full SHA
    b2889f1 View commit details
38 changes: 25 additions & 13 deletions api/src/test/java/org/openmrs/api/ConceptServiceTest.java
Original file line number Diff line number Diff line change
@@ -13,10 +13,12 @@
*/
package org.openmrs.api;

import static org.hamcrest.Matchers.containsInAnyOrder;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertNull;
import static org.junit.Assert.assertThat;
import static org.junit.Assert.assertTrue;
import static org.openmrs.test.TestUtil.containsId;

@@ -33,6 +35,9 @@
import junit.framework.Assert;

import org.apache.commons.collections.CollectionUtils;
import org.hamcrest.Description;
import org.hamcrest.Matcher;
import org.hamcrest.TypeSafeMatcher;
import org.junit.Before;
import org.junit.Test;
import org.openmrs.Concept;
@@ -57,6 +62,7 @@
import org.openmrs.GlobalProperty;
import org.openmrs.Location;
import org.openmrs.Obs;
import org.openmrs.OpenmrsObject;
import org.openmrs.Patient;
import org.openmrs.Person;
import org.openmrs.User;
@@ -924,8 +930,6 @@ public void getConceptByName_shouldFindConceptsWithNamesInMoreGenericLocales() t
@Verifies(value = "should find concepts with names in same specific locale", method = "getConceptByName(String)")
public void getConceptByName_shouldFindConceptsWithNamesInSameSpecificLocale() throws Exception {
executeDataSet(INITIAL_CONCEPTS_XML);
// sanity check
Assert.assertEquals(Context.getLocale(), Locale.UK);

// make sure that concepts are found that have a specific locale on them
Assert.assertNotNull(Context.getConceptService().getConceptByName("Numeric name with en_GB locale"));
@@ -1379,12 +1383,21 @@ public void getConceptsByConceptSet_shouldReturnAllConceptsInSet() throws Except

List<Concept> conceptSet = conceptService.getConceptsByConceptSet(concept);

Assert.assertEquals(5, conceptSet.size());
Assert.assertEquals(true, conceptSet.contains(conceptService.getConcept(2)));
Assert.assertEquals(true, conceptSet.contains(conceptService.getConcept(3)));
Assert.assertEquals(true, conceptSet.contains(conceptService.getConcept(4)));
Assert.assertEquals(true, conceptSet.contains(conceptService.getConcept(5)));
Assert.assertEquals(true, conceptSet.contains(conceptService.getConcept(6)));
assertThat(conceptSet, containsInAnyOrder(hasId(2), hasId(3), hasId(4), hasId(5), hasId(6)));
}

private Matcher<? super OpenmrsObject> hasId(final Integer id) {
return new TypeSafeMatcher<OpenmrsObject>() {

@Override
public void describeTo(Description description) {
}

@Override
protected boolean matchesSafely(OpenmrsObject item) {
return id.equals(item.getId());
}
};
}

/**
@@ -1407,7 +1420,7 @@ public void saveConceptStopWord_shouldSaveConceptStopWordIntoDatabase() throws E
@Test
@Verifies(value = "should assign default Locale ", method = "saveConceptStopWord(ConceptStopWord)")
public void saveConceptStopWord_shouldSaveConceptStopWordAssignDefaultLocaleIsItNull() throws Exception {
ConceptStopWord conceptStopWord = new ConceptStopWord("The");
ConceptStopWord conceptStopWord = new ConceptStopWord("The", Locale.UK);
conceptService.saveConceptStopWord(conceptStopWord);

List<String> conceptStopWords = conceptService.getConceptStopWords(Locale.UK);
@@ -1430,7 +1443,7 @@ public void getConceptStopWords_shouldReturnDefaultLocaleConceptStopWordsIfLocal
@Test
@Verifies(value = "should put generated concept stop word id onto returned concept stop word", method = "saveConceptStopWord(ConceptStopWord)")
public void saveConceptStopWord_shouldSaveReturnConceptStopWordWithId() throws Exception {
ConceptStopWord conceptStopWord = new ConceptStopWord("A");
ConceptStopWord conceptStopWord = new ConceptStopWord("A", Locale.UK);
ConceptStopWord savedConceptStopWord = conceptService.saveConceptStopWord(conceptStopWord);

assertNotNull(savedConceptStopWord.getId());
@@ -1473,9 +1486,8 @@ public void saveConceptStopWord_shouldSaveConceptStopWordInUppercase() throws Ex
@Verifies(value = "should return list of concept stop word for given locale", method = "getConceptStopWords(Locale)")
public void getConceptStopWords_shouldReturnListOfConceptStopWordsForGivenLocale() throws Exception {
List<String> conceptStopWords = conceptService.getConceptStopWords(Locale.ENGLISH);
assertEquals(2, conceptStopWords.size());
assertEquals("A", conceptStopWords.get(0));
assertEquals("AN", conceptStopWords.get(1));

assertThat(conceptStopWords, containsInAnyOrder("A", "AN"));
}

/**
4 changes: 4 additions & 0 deletions api/src/test/java/org/openmrs/hl7/HL7ServiceTest.java
Original file line number Diff line number Diff line change
@@ -24,6 +24,7 @@
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.junit.Assert;
import org.junit.Ignore;
import org.junit.Test;
import org.openmrs.Concept;
import org.openmrs.GlobalProperty;
@@ -39,6 +40,7 @@
import org.openmrs.test.Verifies;
import org.openmrs.util.OpenmrsConstants;
import org.openmrs.util.OpenmrsUtil;
import org.springframework.test.annotation.DirtiesContext;

import ca.uhn.hl7v2.HL7Exception;
import ca.uhn.hl7v2.app.Application;
@@ -185,6 +187,7 @@ public void parseHL7String_shouldParseTheGivenStringIntoMessage() throws Excepti
* @see {@link HL7Service#processHL7Message(Message)}
*/
@Test
@Ignore("TRUNK-3945")
@Verifies(value = "should parse message type supplied by module", method = "processHL7Message(Message)")
public void processHL7Message_shouldParseMessageTypeSuppliedByModule() throws Exception {
Properties props = super.getRuntimeProperties();
@@ -234,6 +237,7 @@ public void processHL7Message_shouldParseMessageTypeSuppliedByModule() throws Ex
* @see {@link HL7Service#processHL7InQueue(HL7InQueue)}
*/
@Test
@Ignore("TRUNK-3945")
@Verifies(value = "should parse oru r01 message using overridden parser provided by a module", method = "processHL7InQueue(HL7InQueue)")
public void processHL7InQueue_shouldParseOruR01MessageUsingOverriddenParserProvidedByAModule() throws Exception {
executeDataSet("org/openmrs/hl7/include/ORUTest-initialData.xml");
Original file line number Diff line number Diff line change
@@ -37,7 +37,6 @@ public class ModuleInteroperabilityTest extends BaseContextSensitiveTest {
*/
@Test
public void shouldAllowModuleAToLoadModuleBIfARequiresB() throws Exception {

OpenmrsClassLoader loader = OpenmrsClassLoader.getInstance();
Class<?> atdServiceClass = loader.loadClass("org.openmrs.module.atdproducer.service.ATDService");
Class<?> dssServiceClass = loader.loadClass("org.openmrs.module.dssmodule.DssService");
@@ -60,7 +59,6 @@ public void shouldAllowModuleAToLoadModuleBIfARequiresB() throws Exception {
Class<?> dssServiceClass2 = atdClassLoader.loadClass("org.openmrs.module.dssmodule.DssService");
ModuleClassLoader dssServiceClassLoader = (ModuleClassLoader) dssServiceClass2.getClassLoader();
assertEquals("dssmodule", dssServiceClassLoader.getModule().getModuleId());

}

}
Original file line number Diff line number Diff line change
@@ -15,11 +15,12 @@

import junit.framework.Assert;

import org.junit.Ignore;
import org.junit.Test;
import org.openmrs.api.context.Context;

@StartModule( { "org/openmrs/module/include/dssmodule-1.44.omod", "org/openmrs/module/include/atd-0.51.omod" })
public class StartModuleAnnotatioTest extends BaseModuleContextSensitiveTest {
public class StartModuleAnnotatioTest extends BaseContextSensitiveTest {

@Test
public void shouldStartModules() throws Exception {
Original file line number Diff line number Diff line change
@@ -65,6 +65,8 @@ public void prepareTestInstance(TestContext testContext) throws Exception {
if (!Context.isSessionOpen())
Context.openSession();

ModuleUtil.shutdown();

// load the omods that the dev defined for this class
String modulesToLoad = StringUtils.join(startModuleAnnotation.value(), " ");

48 changes: 29 additions & 19 deletions pom.xml
Original file line number Diff line number Diff line change
@@ -626,26 +626,37 @@
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.8.1</version>
<version>4.11</version>
</dependency>
<dependency>
<groupId>org.mockito</groupId>
<artifactId>mockito-all</artifactId>
<version>1.8.5</version>
<artifactId>mockito-core</artifactId>
<version>1.9.5</version>
</dependency>
<dependency>
<groupId>org.powermock</groupId>
<artifactId>powermock-module-junit4</artifactId>
<version>1.4.10</version>
<version>1.5</version>
</dependency>
<dependency>
<groupId>org.powermock</groupId>
<artifactId>powermock-api-mockito</artifactId>
<version>1.4.10</version>
<version>1.5</version>
<exclusions>
<exclusion>
<artifactId>mockito-all</artifactId>
<groupId>org.mockito</groupId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.hamcrest</groupId>
<artifactId>hamcrest-all</artifactId>
<artifactId>hamcrest-core</artifactId>
<version>1.3</version>
</dependency>
<dependency>
<groupId>org.hamcrest</groupId>
<artifactId>hamcrest-library</artifactId>
<version>1.3</version>
</dependency>
<dependency>
@@ -996,18 +1007,17 @@
</snapshotRepository>
</distributionManagement>

<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<javaCompilerVersion>1.6</javaCompilerVersion>
<maven.build.timestamp.format>yyyy-MM-dd HH:mm</maven.build.timestamp.format>
<TIMESTAMP>${maven.build.timestamp}</TIMESTAMP>
<openmrs.version.long>${parsedVersion.majorVersion}.${parsedVersion.minorVersion}.${parsedVersion.incrementalVersion} ${parsedVersion.qualifier} Build ${revisionNumber}</openmrs.version.long>
<openmrs.version.short>${parsedVersion.majorVersion}.${parsedVersion.minorVersion}.${parsedVersion.incrementalVersion}.${revisionNumber}-${parsedVersion.qualifier}</openmrs.version.short>
<openmrs.version.shortnumericonly>${parsedVersion.majorVersion}.${parsedVersion.minorVersion}.${parsedVersion.incrementalVersion}.${revisionNumber}</openmrs.version.shortnumericonly>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<javaCompilerVersion>1.6</javaCompilerVersion>
<maven.build.timestamp.format>yyyy-MM-dd HH:mm</maven.build.timestamp.format>
<TIMESTAMP>${maven.build.timestamp}</TIMESTAMP>

<openmrs.version.long>${parsedVersion.majorVersion}.${parsedVersion.minorVersion}.${parsedVersion.incrementalVersion} ${parsedVersion.qualifier} Build ${revisionNumber}</openmrs.version.long>
<openmrs.version.short>${parsedVersion.majorVersion}.${parsedVersion.minorVersion}.${parsedVersion.incrementalVersion}.${revisionNumber}-${parsedVersion.qualifier}</openmrs.version.short>
<openmrs.version.shortnumericonly>${parsedVersion.majorVersion}.${parsedVersion.minorVersion}.${parsedVersion.incrementalVersion}.${revisionNumber}</openmrs.version.shortnumericonly>

<springVersion>3.0.5.RELEASE</springVersion>
<customArgLineForTesting />
</properties>

<springVersion>3.0.5.RELEASE</springVersion>
<customArgLineForTesting></customArgLineForTesting>
</properties>
</project>
15 changes: 10 additions & 5 deletions test/pom.xml
Original file line number Diff line number Diff line change
@@ -35,9 +35,10 @@
<groupId>xmlunit</groupId>
<artifactId>xmlunit</artifactId>
</dependency>

<dependency>
<groupId>org.mockito</groupId>
<artifactId>mockito-all</artifactId>
<artifactId>mockito-core</artifactId>
</dependency>
<dependency>
<groupId>org.powermock</groupId>
@@ -47,9 +48,13 @@
<groupId>org.powermock</groupId>
<artifactId>powermock-api-mockito</artifactId>
</dependency>
<dependency>
<groupId>org.hamcrest</groupId>
<artifactId>hamcrest-all</artifactId>
</dependency>
<dependency>
<groupId>org.hamcrest</groupId>
<artifactId>hamcrest-core</artifactId>
</dependency>
<dependency>
<groupId>org.hamcrest</groupId>
<artifactId>hamcrest-library</artifactId>
</dependency>
</dependencies>
</project>