Polishing

This commit is contained in:
Juergen Hoeller
2019-04-02 20:04:07 +02:00
parent 95a84bbad1
commit 0babc1fb64
11 changed files with 176 additions and 126 deletions

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2002-2013 the original author or authors.
* Copyright 2002-2019 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -33,12 +33,12 @@ import static org.junit.Assert.*;
public class BeanPropertySqlParameterSourceTests {
@Test(expected = IllegalArgumentException.class)
public void withNullBeanPassedToCtor() throws Exception {
public void withNullBeanPassedToCtor() {
new BeanPropertySqlParameterSource(null);
}
@Test(expected = IllegalArgumentException.class)
public void getValueWhereTheUnderlyingBeanHasNoSuchProperty() throws Exception {
public void getValueWhereTheUnderlyingBeanHasNoSuchProperty() {
BeanPropertySqlParameterSource source = new BeanPropertySqlParameterSource(new TestBean());
source.getValue("thisPropertyDoesNotExist");
}
@@ -65,19 +65,19 @@ public class BeanPropertySqlParameterSourceTests {
}
@Test
public void hasValueWhereTheUnderlyingBeanHasNoSuchProperty() throws Exception {
public void hasValueWhereTheUnderlyingBeanHasNoSuchProperty() {
BeanPropertySqlParameterSource source = new BeanPropertySqlParameterSource(new TestBean());
assertFalse(source.hasValue("thisPropertyDoesNotExist"));
}
@Test(expected = IllegalArgumentException.class)
public void getValueWhereTheUnderlyingBeanPropertyIsNotReadable() throws Exception {
public void getValueWhereTheUnderlyingBeanPropertyIsNotReadable() {
BeanPropertySqlParameterSource source = new BeanPropertySqlParameterSource(new NoReadableProperties());
source.getValue("noOp");
}
@Test
public void hasValueWhereTheUnderlyingBeanPropertyIsNotReadable() throws Exception {
public void hasValueWhereTheUnderlyingBeanPropertyIsNotReadable() {
BeanPropertySqlParameterSource source = new BeanPropertySqlParameterSource(new NoReadableProperties());
assertFalse(source.hasValue("noOp"));
}

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2002-2006 the original author or authors.
* Copyright 2002-2019 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -29,18 +29,18 @@ import static org.junit.Assert.*;
public class MapSqlParameterSourceTests {
@Test
public void nullParameterValuesPassedToCtorIsOk() throws Exception {
public void nullParameterValuesPassedToCtorIsOk() {
new MapSqlParameterSource(null);
}
@Test(expected = IllegalArgumentException.class)
public void getValueChokesIfParameterIsNotPresent() throws Exception {
public void getValueChokesIfParameterIsNotPresent() {
MapSqlParameterSource source = new MapSqlParameterSource();
source.getValue("pechorin was right!");
}
@Test
public void sqlParameterValueRegistersSqlType() throws Exception {
public void sqlParameterValueRegistersSqlType() {
MapSqlParameterSource msps = new MapSqlParameterSource("FOO", new SqlParameterValue(2, "Foo"));
assertEquals("Correct SQL Type not registered", 2, msps.getSqlType("FOO"));
MapSqlParameterSource msps2 = new MapSqlParameterSource();