Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Martin Westergaard Lassen
committed
Sep 16, 2012
1 parent
a260c0a
commit c3fa60b
Showing
2 changed files
with
46 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
45 changes: 45 additions & 0 deletions
45
sc-web/src/test/java/dk/sst/snomedcave/controllers/DrugControllerTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Original file line | Diff line number | Diff line change |
---|---|---|---|
@@ -0,0 +1,45 @@ | |||
package dk.sst.snomedcave.controllers; | |||
|
|||
import com.google.gson.Gson; | |||
import com.google.gson.GsonBuilder; | |||
import org.junit.Test; | |||
import org.junit.runner.RunWith; | |||
import org.springframework.context.annotation.Bean; | |||
import org.springframework.context.annotation.Configuration; | |||
import org.springframework.context.annotation.ImportResource; | |||
import org.springframework.test.context.ContextConfiguration; | |||
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; | |||
import org.springframework.transaction.annotation.Transactional; | |||
|
|||
import javax.inject.Inject; | |||
|
|||
import static org.junit.Assert.assertEquals; | |||
import static org.junit.Assert.assertNotNull; | |||
|
|||
@RunWith(SpringJUnit4ClassRunner.class) | |||
@ContextConfiguration(classes = DrugControllerTest.TestConfig.class) | |||
@Transactional | |||
public class DrugControllerTest { | |||
Gson gson = new GsonBuilder().create(); | |||
|
|||
@Configuration | |||
@ImportResource("classpath:/Neo4jConfig.xml") | |||
public static class TestConfig { | |||
@Bean | |||
public DrugController drugController() { | |||
return new DrugController(); | |||
} | |||
} | |||
|
|||
@Inject | |||
DrugController drugController; | |||
|
|||
@Test | |||
public void willAlwaysReturnNonCombinedDrug() throws Exception { | |||
for (int i = 0; i < 10; i++) { | |||
String json = drugController.tree("Paracetamol").getBody(); | |||
assertNotNull(json); | |||
assertEquals(i + " of 10", "293584003", gson.fromJson(json, String.class)); | |||
} | |||
} | |||
} |