Polish Conventions
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2015 the original author or authors.
|
||||
* Copyright 2002-2017 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.
|
||||
@@ -17,9 +17,7 @@
|
||||
package org.springframework.core;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
import org.junit.Rule;
|
||||
import org.junit.Test;
|
||||
@@ -27,9 +25,11 @@ import org.junit.rules.ExpectedException;
|
||||
|
||||
import org.springframework.tests.sample.objects.TestObject;
|
||||
|
||||
import static org.junit.Assert.*;
|
||||
import static org.junit.Assert.assertEquals;
|
||||
|
||||
|
||||
/**
|
||||
* Unit tests for {@link Conventions}.
|
||||
* @author Rob Harrop
|
||||
* @author Sam Brannen
|
||||
*/
|
||||
@@ -41,29 +41,32 @@ public class ConventionsTests {
|
||||
|
||||
@Test
|
||||
public void simpleObject() {
|
||||
assertEquals("Incorrect singular variable name", "testObject", Conventions.getVariableName(new TestObject()));
|
||||
assertEquals("Incorrect singular variable name",
|
||||
"testObject", Conventions.getVariableName(new TestObject()));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void array() {
|
||||
assertEquals("Incorrect plural array form", "testObjectList", Conventions.getVariableName(new TestObject[0]));
|
||||
assertEquals("Incorrect plural array form",
|
||||
"testObjectList", Conventions.getVariableName(new TestObject[0]));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void list() {
|
||||
List<TestObject> list = Arrays.asList(new TestObject());
|
||||
assertEquals("Incorrect plural List form", "testObjectList", Conventions.getVariableName(list));
|
||||
assertEquals("Incorrect plural List form", "testObjectList",
|
||||
Conventions.getVariableName(Collections.singletonList(new TestObject())));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void emptyList() {
|
||||
exception.expect(IllegalArgumentException.class);
|
||||
this.exception.expect(IllegalArgumentException.class);
|
||||
Conventions.getVariableName(new ArrayList<>());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void set() {
|
||||
assertEquals("Incorrect plural Set form", "testObjectList", Conventions.getVariableName(Collections.singleton(new TestObject())));
|
||||
assertEquals("Incorrect plural Set form", "testObjectList",
|
||||
Conventions.getVariableName(Collections.singleton(new TestObject())));
|
||||
}
|
||||
|
||||
@Test
|
||||
|
||||
Reference in New Issue
Block a user