#237 Improving test/method names

This commit is contained in:
Gunnar Morling 2014-06-24 22:43:04 +02:00
parent 02c81ae651
commit 9a21198265
8 changed files with 35 additions and 45 deletions

View File

@ -16,12 +16,11 @@
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * limitations under the License.
*/ */
package org.mapstruct.ap.test.npe; package org.mapstruct.ap.test.nullcheck;
import java.math.BigInteger; import java.math.BigInteger;
/** /**
*
* @author Sjaak Derksen * @author Sjaak Derksen
*/ */
public class MyBigIntMapper { public class MyBigIntMapper {

View File

@ -16,12 +16,11 @@
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * limitations under the License.
*/ */
package org.mapstruct.ap.test.npe; package org.mapstruct.ap.test.nullcheck;
import java.math.BigInteger; import java.math.BigInteger;
/** /**
*
* @author Sjaak Derksen * @author Sjaak Derksen
*/ */
public class MyBigIntWrapper { public class MyBigIntWrapper {

View File

@ -16,15 +16,16 @@
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * limitations under the License.
*/ */
package org.mapstruct.ap.test.npe; package org.mapstruct.ap.test.nullcheck;
import static org.fest.assertions.Assertions.assertThat;
import org.junit.Test; import org.junit.Test;
import org.junit.runner.RunWith; import org.junit.runner.RunWith;
import org.mapstruct.ap.testutil.IssueKey; import org.mapstruct.ap.testutil.IssueKey;
import org.mapstruct.ap.testutil.WithClasses; import org.mapstruct.ap.testutil.WithClasses;
import org.mapstruct.ap.testutil.runner.AnnotationProcessorTestRunner; import org.mapstruct.ap.testutil.runner.AnnotationProcessorTestRunner;
import static org.fest.assertions.Assertions.assertThat;
/** /**
* Test for correct handling of null checks. * Test for correct handling of null checks.
* *
@ -40,10 +41,10 @@ import org.mapstruct.ap.testutil.runner.AnnotationProcessorTestRunner;
Target.class Target.class
}) })
@RunWith(AnnotationProcessorTestRunner.class) @RunWith(AnnotationProcessorTestRunner.class)
public class NullPtrCheckTest { public class NullCheckTest {
@IssueKey( "214" )
@Test(expected = NullPointerException.class) @Test(expected = NullPointerException.class)
@IssueKey("214")
public void shouldThrowNullptrWhenCustomMapperIsInvoked() { public void shouldThrowNullptrWhenCustomMapperIsInvoked() {
Source source = new Source(); Source source = new Source();
@ -52,9 +53,9 @@ public class NullPtrCheckTest {
SourceTargetMapper.INSTANCE.sourceToTarget( source ); SourceTargetMapper.INSTANCE.sourceToTarget( source );
} }
@IssueKey( "214" )
@Test @Test
public void shouldSurroundTypeConversionWithNPECheck() { @IssueKey("214")
public void shouldSurroundTypeConversionWithNullCheck() {
Source source = new Source(); Source source = new Source();
source.setSomeObject( new NullObject() ); source.setSomeObject( new NullObject() );
@ -65,9 +66,9 @@ public class NullPtrCheckTest {
} }
@IssueKey( "214" )
@Test @Test
public void shouldSurroundArrayListConstructionWithNPECheck() { @IssueKey("214")
public void shouldSurroundArrayListConstructionWithNullCheck() {
Source source = new Source(); Source source = new Source();
source.setSomeObject( new NullObject() ); source.setSomeObject( new NullObject() );
@ -77,9 +78,9 @@ public class NullPtrCheckTest {
assertThat( target.getSomeList() ).isNull(); assertThat( target.getSomeList() ).isNull();
} }
@IssueKey( "237" )
@Test @Test
public void shouldMapMappedTypeConversion() { @IssueKey("237")
public void shouldSurroundConversionPassedToMappingMethodWithNullCheck() {
Source source = new Source(); Source source = new Source();
source.setSomeObject( new NullObject() ); source.setSomeObject( new NullObject() );
@ -88,5 +89,4 @@ public class NullPtrCheckTest {
assertThat( target.getSomeList() ).isNull(); assertThat( target.getSomeList() ).isNull();
assertThat( target.getSomeInteger() ).isNull(); assertThat( target.getSomeInteger() ).isNull();
} }
} }

View File

@ -16,10 +16,9 @@
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * limitations under the License.
*/ */
package org.mapstruct.ap.test.npe; package org.mapstruct.ap.test.nullcheck;
/** /**
*
* @author Sjaak Derksen * @author Sjaak Derksen
*/ */
public class NullObject { public class NullObject {

View File

@ -16,10 +16,9 @@
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * limitations under the License.
*/ */
package org.mapstruct.ap.test.npe; package org.mapstruct.ap.test.nullcheck;
/** /**
*
* @author Sjaak Derksen * @author Sjaak Derksen
*/ */
public class NullObjectMapper { public class NullObjectMapper {

View File

@ -16,12 +16,11 @@
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * limitations under the License.
*/ */
package org.mapstruct.ap.test.npe; package org.mapstruct.ap.test.nullcheck;
import java.util.List; import java.util.List;
/** /**
*
* @author Sjaak Derksen * @author Sjaak Derksen
*/ */
public class Source { public class Source {

View File

@ -16,13 +16,12 @@
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * limitations under the License.
*/ */
package org.mapstruct.ap.test.npe; package org.mapstruct.ap.test.nullcheck;
import org.mapstruct.Mapper; import org.mapstruct.Mapper;
import org.mapstruct.factory.Mappers; import org.mapstruct.factory.Mappers;
/** /**
*
* @author Sjaak Derksen * @author Sjaak Derksen
*/ */
@Mapper(uses = { NullObjectMapper.class, MyBigIntMapper.class }) @Mapper(uses = { NullObjectMapper.class, MyBigIntMapper.class })

View File

@ -16,12 +16,11 @@
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * limitations under the License.
*/ */
package org.mapstruct.ap.test.npe; package org.mapstruct.ap.test.nullcheck;
import java.util.List; import java.util.List;
/** /**
*
* @author Sjaak Derksen * @author Sjaak Derksen
*/ */
public class Target { public class Target {
@ -62,7 +61,4 @@ public class Target {
public void setSomeInteger(MyBigIntWrapper someInteger) { public void setSomeInteger(MyBigIntWrapper someInteger) {
this.someInteger = someInteger; this.someInteger = someInteger;
} }
} }