From 55ae5dd68e516926d22de1a2de25e97ce345d6a7 Mon Sep 17 00:00:00 2001 From: Arjen Poutsma Date: Fri, 31 Oct 2008 09:57:49 +0000 Subject: [PATCH] Changed use of AssertThrows to @Test(expected = ...) git-svn-id: https://src.springframework.org/svn/spring-framework/trunk@247 50f2f4bb-b051-0410-bef5-90022cba6387 --- .../MapSqlParameterSourceTests.java | 24 +++++++++---------- 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/org.springframework.testsuite/src/test/java/org/springframework/jdbc/core/namedparam/MapSqlParameterSourceTests.java b/org.springframework.testsuite/src/test/java/org/springframework/jdbc/core/namedparam/MapSqlParameterSourceTests.java index 707c20447ef..d7a761323a5 100644 --- a/org.springframework.testsuite/src/test/java/org/springframework/jdbc/core/namedparam/MapSqlParameterSourceTests.java +++ b/org.springframework.testsuite/src/test/java/org/springframework/jdbc/core/namedparam/MapSqlParameterSourceTests.java @@ -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();