I started to be a
"We do see her fro
Fetal malformation
If we talk about t
Gamescom 2015: Fou
The present invent
Kings Cross
Kings
---
abstract: 'In
The present invent
Q:
How to create /*
* JBoss, Home of Professional Open Source.
* Copyright 2015, Red Hat, Inc., and individual contributors
* as indicated by the @author tags. See the copyright.txt file in the
* distribution for a full listing of individual contributors.
*
* This is free software; you can redistribute it and/or modify it
* under the terms of the GNU Lesser General Public License as
* published by the Free Software Foundation; either version 2.1 of
* the License, or (at your option) any later version.
*
* This software is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this software; if not, write to the Free
* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
*/
package org.jboss.as.jpa.model;
import javax.persistence.PersistenceUnit;
import org.junit.Assert;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.mockito.Mock;
import org.mockito.junit.MockitoJUnitRunner;
import static org.mockito.Mockito.*;
@RunWith(MockitoJUnitRunner.class)
public class EntityManagerFactoryUtilsTest {
@Mock
private PersistenceUnit persistenceUnit;
@Test
public void testPersistenceUnitFromModuleConfiguration() {
final String persistenceUnitName = "MyTestPU";
EntityManagerFactoryUtils.persistenceUnitFromModuleConfiguration(persistenceUnitName);
verify(persistenceUnit).getName();
Assert.assertEquals(persistenceUnitName, persistenceUnit.getName());
}
@Test
public void testPersistenceUnitFromModuleConfigurationWithNoName() {
final String persistenceUnitName = "MyTestPU";
EntityManagerFactoryUtils.persistenceUnitFromModuleConfiguration(persistenceUnitName, true);
Assert.assertEquals(persistenceUnitName, persistenceUnit.getName());
}
@Test
public void testPersistenceUnitFromModuleConfigurationWithNonPersistenceUnit() {
final String persistenceUnitName = "nonPersistenceUnitName";
EntityManagerFactoryUtils.persistenceUnitFromModuleConfiguration(persistenceUnitName);
Assert.assertNull(persistenceUnit);
}
}