View persistence.xml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?xml version="1.0" encoding="UTF-8"?> | |
<persistence xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | |
xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/persistence http://xmlns.jcp.org/xml/ns/persistence/persistence_2_1.xsd" | |
version="2.1" xmlns="http://xmlns.jcp.org/xml/ns/persistence"> | |
<persistence-unit name="default" transaction-type="JTA"> | |
<provider>org.hibernate.jpa.HibernatePersistenceProvider</provider> | |
<jta-data-source>java:jboss/datasources/ExampleDS</jta-data-source> | |
<exclude-unlisted-classes>false</exclude-unlisted-classes> | |
<properties> |
View JUnitAssertionTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@Test | |
public void assertjAssertion() throws Exception { | |
String openKnowledge = "offen, kundig, gut!"; | |
Assertions.assertThat(openKnowledge).startsWith("offen").contains("kundig").endsWith("gut!"); | |
} |
View JUnitAssertionTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@Test | |
public void hamcrestAssertion() throws Exception { | |
String openKnowledge = "offen, kundig, gut!"; | |
MatcherAssert.assertThat(openKnowledge, CoreMatchers.allOf(CoreMatchers.startsWith("offen"), | |
CoreMatchers.containsString("kundig"), | |
CoreMatchers.endsWith("gut!"))); | |
} |
View JUnitAssertionTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@Test | |
public void junitAssertion() throws Exception { | |
String openKnowledge = "offen, kundig, gut!"; | |
Assert.assertTrue(openKnowledge.startsWith("offen")); | |
Assert.assertTrue(openKnowledge.contains("kundig")); | |
Assert.assertTrue(openKnowledge.endsWith("gut!")); | |
} |
View TimeoutTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class TimeoutTest { | |
@Rule | |
public Timeout rule = new Timeout(7, TimeUnit.MILLISECONDS); | |
@Test(timeout = 5) | |
public void shouldFailWithTimeout() throws Exception { | |
CountDownLatch latch = new CountDownLatch(1); | |
assertThat(latch.await(10, TimeUnit.MILLISECONDS)).isTrue(); | |
} |
View CustomerBuilderAssertjTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class CustomerBuilderAssertjTest { | |
private Customer customer; | |
@Before | |
public void setUp() throws Exception { | |
customer = Customer.newBuilder() | |
.setFirstName("Max") | |
.setLastName("Mustermann") | |
.setEmail("max.mustermann@openknowledge.de") |
View CustomerBuilderHamcrestTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class CustomerBuilderHamcrestTest { | |
private Customer customer; | |
@Before | |
public void setUp() throws Exception { | |
customer = Customer.newBuilder() | |
.setFirstName("Max") | |
.setLastName("Mustermann") | |
.setEmail("max.mustermann@openknowledge.de") |
View Customer.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class Customer implements Serializable { | |
private Long id; | |
private String firstName; | |
private String lastName; | |
private String email; |
View SpecializedMailServiceIT.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@RunWith(Arquillian.class) | |
public class SpecializedMailServiceIT { | |
private static final Logger LOG = LoggerFactory.getLogger(SpecializedMailServiceIT.class); | |
@Deployment | |
public static Archive createDeployment() { | |
PomEquippedResolveStage pomFile = Maven.resolver().loadPomFromFile("pom.xml"); | |
WebArchive archive = ShrinkWrap.create(WebArchive.class) |
View SpecializedMailService.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@Specializes | |
public class SpecializedMailService extends MailService { | |
public static CountDownLatch latch; | |
@Override | |
public void sendMail(final String subject, final String body, final String... recipients) { | |
latch.countDown(); | |
} | |
} |
NewerOlder