List of usage examples for junit.framework AssertionFailedError AssertionFailedError
public AssertionFailedError(String message)
From source file:org.intermine.modelviewer.jaxb.ConfigParserTest.java
/** * Test whether the model read from <code>src/test/(no)schema/genomic_additions.xml</code> * is correct.//from www . j a v a 2 s . co m * * @param classes The top level Classes object. * * @param sourceFile The source file. */ private void genomicAdditionsCorrect(Classes classes, File sourceFile) { try { assertEquals("Wrong number of classes", 23, classes.getClazz().size()); Map<String, Class> classMap = new HashMap<String, Class>(); for (Class c : classes.getClazz()) { classMap.put(c.getName(), c); } Class transcript = classMap.get("Transcript"); assertNotNull("Class 'Transcript' not found", transcript); assertNull("Transcript extends wrong", transcript.getExtends()); assertTrue("Transcript interface wrong", transcript.isIsInterface()); assertEquals("Transcript should have 1 attribute", 1, transcript.getAttribute().size()); Attribute att = transcript.getAttribute().get(0); assertEquals("Attribute name wrong", "exonCount", att.getName()); assertEquals("Attribute type wrong", Integer.class.getName(), att.getType()); assertEquals("Transcript should have 1 reference", 1, transcript.getReference().size()); ClassReference ref = transcript.getReference().get(0); assertEquals("Reference name wrong", "protein", ref.getName()); assertEquals("Reference type wrong", "Protein", ref.getReferencedType()); assertEquals("Reference reverse wrong", "transcripts", ref.getReverseReference()); assertNotNull("Transcript should have 2 collections (list unset)", transcript.getCollection()); assertEquals("Transcript should have 2 collections", 2, transcript.getCollection().size()); ClassReference col = transcript.getCollection().get(0); assertEquals("Collection name wrong", "introns", col.getName()); assertEquals("Collection type wrong", "Intron", col.getReferencedType()); assertEquals("Collection reverse wrong", "transcripts", col.getReverseReference()); } catch (AssertionFailedError e) { AssertionFailedError addition = new AssertionFailedError( "Failure with file " + sourceFile.getAbsolutePath() + " :\n" + e.getMessage()); addition.initCause(e.getCause()); addition.setStackTrace(e.getStackTrace()); throw addition; } }
From source file:org.intermine.modelviewer.jaxb.ConfigParserTest.java
/** * Test whether the project read from <code>src/test/(no)schema/project.xml</code> * is correct.//from ww w . j av a 2 s . c o m * * @param project The Project. * * @param sourceFile The source file. */ private void projectCorrect(Project project, File sourceFile) { try { assertEquals("Project type wrong", "bio", project.getType()); assertEquals("Wrong number of project properties", 6, project.getProperty().size()); // Ignore duplicate source.location Map<String, Property> propMap = new HashMap<String, Property>(); for (Property p : project.getProperty()) { propMap.put(p.getName(), p); } Property propsFile = propMap.get("default.intermine.properties.file"); assertNotNull("Property 'default.intermine.properties.file' missing", propsFile); assertEquals("'default.intermine.properties.file' location wrong", "../default.intermine.integrate.properties", propsFile.getLocation()); assertNull("'default.intermine.properties.file' value set", propsFile.getValue()); Property targetModel = propMap.get("target.model"); assertNotNull("Property 'target.model' missing", targetModel); assertEquals("'target.model' value wrong", "genomic", targetModel.getValue()); assertNull("'target.model' location set", targetModel.getLocation()); assertEquals("Wrong number of project sources", 8, project.getSources().getSource().size()); Map<String, Source> sourceMap = new HashMap<String, Source>(); for (Source s : project.getSources().getSource()) { sourceMap.put(s.getName(), s); } Source chromoFasta = sourceMap.get("malaria-chromosome-fasta"); assertNotNull("Source 'malaria-chromosome-fasta' missing", chromoFasta); assertEquals("'malaria-chromosome-fasta' type wrong", "fasta", chromoFasta.getType()); assertEquals("'malaria-chromosome-fasta' dump wrong", Boolean.TRUE, chromoFasta.isDump()); assertEquals("'malaria-chromosome-fasta' source has wrong number of properties", 6, chromoFasta.getProperty().size()); propMap.clear(); for (Property p : chromoFasta.getProperty()) { propMap.put(p.getName(), p); } Property srcDataDir = propMap.get("src.data.dir"); assertNotNull("Property 'src.data.dir' missing from source 'malaria-chromosome-fasta'", srcDataDir); assertEquals("'src.data.dir' location wrong", "/home/richard/malaria/genome/fasta", srcDataDir.getLocation()); assertNull("'src.data.dir' value set", srcDataDir.getValue()); Property fastaTitle = propMap.get("fasta.dataSourceName"); assertNotNull("Property 'fasta.dataSourceName' missing from source " + "'malaria-chromosome-fasta'", fastaTitle); assertEquals("'fasta.dataSourceName' value wrong", "PlasmoDB", fastaTitle.getValue()); assertNull("'fasta.dataSourceName' location set", fastaTitle.getLocation()); Source gff = sourceMap.get("malaria-gff"); assertNotNull("Source 'malaria-gff' missing", gff); assertEquals("'malaria-gff' type wrong", "malaria-gff", gff.getType()); assertEquals("'malaria-gff' dump wrong", Boolean.FALSE, gff.isDump()); assertEquals("Wrong number of post processors", 5, project.getPostProcessing().getPostProcess().size()); Map<String, PostProcess> postProcessMap = new HashMap<String, PostProcess>(); for (PostProcess pp : project.getPostProcessing().getPostProcess()) { postProcessMap.put(pp.getName(), pp); } PostProcess transfer = postProcessMap.get("transfer-sequences"); assertNotNull("Post processor 'transfer-sequences' missing", transfer); assertEquals("'transfer-sequences' dump flag wrong", Boolean.TRUE, transfer.isDump()); PostProcess doSources = postProcessMap.get("do-sources"); assertNotNull("Post processor 'do-sources' missing", doSources); assertEquals("'do-sources' dump flag wrong", Boolean.FALSE, doSources.isDump()); } catch (AssertionFailedError e) { AssertionFailedError addition = new AssertionFailedError( "Failure with file " + sourceFile.getAbsolutePath() + " :\n" + e.getMessage()); addition.initCause(e.getCause()); addition.setStackTrace(e.getStackTrace()); throw addition; } }
From source file:org.jtalks.tests.jcommune.webdriver.action.PrivateMessages.java
private static void openDraft(PrivateMessage pm) { mainPage.openPrivateMessages();// w ww. j av a 2 s .co m pmPage.clickOpenDrafts(); if (!openMessageOnCurrentPage(pm)) { throw new AssertionFailedError("The draft is not present in drafts folder. " + "Receiver: [" + pm.getReceiver() + "], " + "Subject: [" + StringUtils.left(pm.getMessageSubject(), 10) + "], " + "Content: [" + StringUtils.left(pm.getMessageContent(), 10) + "]"); } }
From source file:org.jtalks.tests.jcommune.webdriver.action.PrivateMessages.java
@Step public static void removeMultipleMessagesFromInbox(int messageCount, List<PrivateMessage> pmList) { info("Start to remove " + messageCount + " messages from inbox folder."); if (messageCount > pmList.size()) { throw new AssertionFailedError( "The number of messages to be removed exceeds the number of created messages."); }// w w w .j a va 2 s . co m mainPage.openPrivateMessages(); removeMultiplePm(messageCount, pmList); }
From source file:org.jtalks.tests.jcommune.webdriver.action.PrivateMessages.java
@Step public static void removeMultipleMessagesFromOutbox(int messageCount, List<PrivateMessage> pmList) { info("Start to remove " + messageCount + " messages from outbox folder."); if (messageCount > pmList.size()) { throw new AssertionFailedError( "The number of messages to be removed exceeds the number of created messages."); }/*from w w w .ja v a 2 s .c om*/ mainPage.openPrivateMessages(); pmPage.clickOpenOutboxMessages(); removeMultiplePm(messageCount, pmList); }
From source file:org.jtalks.tests.jcommune.webdriver.action.PrivateMessages.java
@Step public static void assertPmExistsInRemoteInbox(User receiver, PrivateMessage pm) { Users.logout();/* w ww. j a v a 2s. c o m*/ Users.signIn(receiver); info("Asserting that PM was received"); mainPage.openPrivateMessages(); if (!pmExists(pm)) { throw new AssertionFailedError("The PM is not present in inbox folder. " + "Receiver: [" + pm.getReceiver() + "], " + "Subject: [" + StringUtils.left(pm.getMessageSubject(), 10) + "], " + "Content: [" + StringUtils.left(pm.getMessageContent(), 10) + "]"); } info("Success. PM exists in inbox folder."); }
From source file:org.jtalks.tests.jcommune.webdriver.action.PrivateMessages.java
@Step public static void assertPmExistsInOutbox(PrivateMessage pm) { info("Asserting that sent PM was saved in outbox"); mainPage.openPrivateMessages();/*from w w w .j av a2 s. c o m*/ pmPage.clickOpenOutboxMessages(); if (!pmExists(pm)) { throw new AssertionFailedError("The PM is not present in outbox folder. " + "Receiver: [" + pm.getReceiver() + "], " + "Subject: [" + StringUtils.left(pm.getMessageSubject(), 10) + "], " + "Content: [" + StringUtils.left(pm.getMessageContent(), 10) + "]"); } info("Success. PM exists in outbox folder."); }
From source file:org.jtalks.tests.jcommune.webdriver.action.PrivateMessages.java
@Step public static void assertPmExistsInDraft(PrivateMessage pm) { info("Asserting that draft was really saved"); mainPage.openPrivateMessages();//from w w w .j ava2s .c o m pmPage.clickOpenDrafts(); if (!pmExists(pm)) { throw new AssertionFailedError("The draft is not present in drafts folder. " + "Receiver: [" + pm.getReceiver() + "], " + "Subject: [" + StringUtils.left(pm.getMessageSubject(), 10) + "], " + "Content: [" + StringUtils.left(pm.getMessageContent(), 10) + "]"); } info("Success. PM exists in drafts folder."); }
From source file:org.jtalks.tests.jcommune.webdriver.action.PrivateMessages.java
@Step public static void assertPmNotExistInInbox(PrivateMessage pm) { info("Asserting that PM doesn't exist in inbox folder"); mainPage.openPrivateMessages();//from ww w . j a va2 s .co m if (pmExists(pm)) { throw new AssertionFailedError("The PM is present in inbox folder. " + "Receiver: [" + pm.getReceiver() + "], " + "Subject: [" + StringUtils.left(pm.getMessageSubject(), 10) + "], " + "Content: [" + StringUtils.left(pm.getMessageContent(), 10) + "]"); } info("Success. PM doesn't exist in inbox folder."); }
From source file:org.jtalks.tests.jcommune.webdriver.action.PrivateMessages.java
@Step public static void assertPmNotExistInOutbox(PrivateMessage pm) { info("Asserting that PM doesn't exist in outbox folder"); mainPage.openPrivateMessages();//from w w w . ja va2 s .c om pmPage.clickOpenOutboxMessages(); if (pmExists(pm)) { throw new AssertionFailedError("The PM is present in outbox folder. " + "Receiver: [" + pm.getReceiver() + "], " + "Subject: [" + StringUtils.left(pm.getMessageSubject(), 10) + "], " + "Content: [" + StringUtils.left(pm.getMessageContent(), 10) + "]"); } info("Success. PM doesn't exist in outbox folder."); }