Browse Source

Changed use of AssertThrows to @Test(expected = ...)

git-svn-id: https://src.springframework.org/svn/spring-framework/trunk@247 50f2f4bb-b051-0410-bef5-90022cba6387
pull/1/head
Arjen Poutsma 17 years ago
parent
commit
55ae5dd68e
  1. 24
      org.springframework.testsuite/src/test/java/org/springframework/jdbc/core/namedparam/MapSqlParameterSourceTests.java

24
org.springframework.testsuite/src/test/java/org/springframework/jdbc/core/namedparam/MapSqlParameterSourceTests.java

@ -16,30 +16,30 @@ @@ -16,30 +16,30 @@
package org.springframework.jdbc.core.namedparam;
import junit.framework.TestCase;
import static org.junit.Assert.assertEquals;
import org.junit.Test;
import org.springframework.test.AssertThrows;
import org.springframework.jdbc.core.SqlParameterValue;
/**
* @author Rick Evans
* @author Arjen Poutsma
*/
public final class MapSqlParameterSourceTests extends TestCase {
public final class MapSqlParameterSourceTests {
public void testNullParameterValuesPassedToCtorIsOk() throws Exception {
@Test
public void nullParameterValuesPassedToCtorIsOk() throws Exception {
new MapSqlParameterSource(null);
}
public void testGetValueChokesIfParameterIsNotPresent() throws Exception {
new AssertThrows(IllegalArgumentException.class) {
public void test() throws Exception {
MapSqlParameterSource source = new MapSqlParameterSource();
source.getValue("pechorin was right!");
}
}.runTest();
@Test(expected = IllegalArgumentException.class)
public void getValueChokesIfParameterIsNotPresent() throws Exception {
MapSqlParameterSource source = new MapSqlParameterSource();
source.getValue("pechorin was right!");
}
public void testSqlParameterValueRegistersSqlType() throws Exception {
@Test
public void sqlParameterValueRegistersSqlType() throws Exception {
MapSqlParameterSource msps = new MapSqlParameterSource("FOO", new SqlParameterValue(2, "Foo"));
assertEquals("Correct SQL Type not registered", 2, msps.getSqlType("FOO"));
MapSqlParameterSource msps2 = new MapSqlParameterSource();

Loading…
Cancel
Save