BAEL-2565 move code to different project (#6099)

* BAEL-2565

* BAEL-2565
Test code consistency

* BAEL-2565
Move code to different project
This commit is contained in:
pandachris
2019-01-08 22:18:47 +07:00
committed by maibin
parent 5faa406cb0
commit f1fa9c8253
9 changed files with 0 additions and 0 deletions
@@ -0,0 +1,48 @@
package com.baeldung.enums.values;
import org.junit.After;
import org.junit.AfterClass;
import org.junit.Before;
import org.junit.BeforeClass;
import org.junit.Test;
import static org.junit.Assert.*;
/**
*
* @author chris
*/
public class Element1UnitTest {
public Element1UnitTest() {
}
@BeforeClass
public static void setUpClass() {
}
@AfterClass
public static void tearDownClass() {
}
@Before
public void setUp() {
}
@After
public void tearDown() {
}
@Test
public void whenAccessingToString_thenItShouldEqualName() {
for (Element1 e1 : Element1.values()) {
assertEquals(e1.name(), e1.toString());
}
}
@Test
public void whenCallingValueOf_thenReturnTheCorrectEnum() {
for (Element1 e1 : Element1.values()) {
assertSame(e1, Element1.valueOf(e1.name()));
}
}
}
@@ -0,0 +1,59 @@
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package com.baeldung.enums.values;
import org.junit.After;
import org.junit.AfterClass;
import org.junit.Before;
import org.junit.BeforeClass;
import org.junit.Test;
import static org.junit.Assert.*;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
/**
*
* @author chris
*/
public class Element2UnitTest {
private static final Logger LOGGER = LoggerFactory.getLogger(Element2UnitTest.class);
public Element2UnitTest() {
}
@BeforeClass
public static void setUpClass() {
}
@AfterClass
public static void tearDownClass() {
}
@Before
public void setUp() {
}
@After
public void tearDown() {
}
@Test
public void whenLocatebyLabel_thenReturnCorrectValue() {
for (Element2 e2 : Element2.values()) {
assertSame(e2, Element2.valueOfLabel(e2.label));
}
}
/**
* Test of toString method, of class Element2.
*/
@Test
public void whenCallingToString_thenReturnLabel() {
for (Element2 e2 : Element2.values()) {
assertEquals(e2.label, e2.toString());
}
}
}
@@ -0,0 +1,57 @@
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package com.baeldung.enums.values;
import org.junit.After;
import org.junit.AfterClass;
import org.junit.Before;
import org.junit.BeforeClass;
import org.junit.Test;
import static org.junit.Assert.*;
/**
*
* @author chris
*/
public class Element3UnitTest {
public Element3UnitTest() {
}
@BeforeClass
public static void setUpClass() {
}
@AfterClass
public static void tearDownClass() {
}
@Before
public void setUp() {
}
@After
public void tearDown() {
}
@Test
public void whenLocatebyLabel_thenReturnCorrectValue() {
for (Element3 e3 : Element3.values()) {
assertSame(e3, Element3.valueOfLabel(e3.label));
}
}
/**
* Test of toString method, of class Element3.
*/
@Test
public void whenCallingToString_thenReturnLabel() {
for (Element3 e3 : Element3.values()) {
assertEquals(e3.label, e3.toString());
}
}
}
@@ -0,0 +1,71 @@
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package com.baeldung.enums.values;
import org.junit.After;
import org.junit.AfterClass;
import org.junit.Before;
import org.junit.BeforeClass;
import org.junit.Test;
import static org.junit.Assert.*;
/**
*
* @author chris
*/
public class Element4UnitTest {
public Element4UnitTest() {
}
@BeforeClass
public static void setUpClass() {
}
@AfterClass
public static void tearDownClass() {
}
@Before
public void setUp() {
}
@After
public void tearDown() {
}
@Test
public void whenLocatebyLabel_thenReturnCorrectValue() {
for (Element4 e4 : Element4.values()) {
assertSame(e4, Element4.valueOfLabel(e4.label));
}
}
@Test
public void whenLocatebyAtmNum_thenReturnCorrectValue() {
for (Element4 e4 : Element4.values()) {
assertSame(e4, Element4.valueOfAtomicNumber(e4.atomicNumber));
}
}
@Test
public void whenLocatebyAtmWt_thenReturnCorrectValue() {
for (Element4 e4 : Element4.values()) {
assertSame(e4, Element4.valueOfAtomicWeight(e4.atomicWeight));
}
}
/**
* Test of toString method, of class Element4.
*/
@Test
public void whenCallingToString_thenReturnLabel() {
for (Element4 e4 : Element4.values()) {
assertEquals(e4.label, e4.toString());
}
}
}