From d537daf9b21e7557e577243c8983f42398527acc Mon Sep 17 00:00:00 2001 From: CaptainDaVinci Date: Wed, 6 Mar 2019 17:20:41 +0530 Subject: [PATCH 1/2] Adding "von" part from Author's last name when exporting to MS Office 2007 Fixes #4655 --- src/main/java/org/jabref/logic/msbib/MsBibAuthor.java | 2 +- src/test/java/org/jabref/logic/msbib/MsBibAuthorTest.java | 7 +++++++ 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/src/main/java/org/jabref/logic/msbib/MsBibAuthor.java b/src/main/java/org/jabref/logic/msbib/MsBibAuthor.java index caad384ec22..8da1d4e49ca 100644 --- a/src/main/java/org/jabref/logic/msbib/MsBibAuthor.java +++ b/src/main/java/org/jabref/logic/msbib/MsBibAuthor.java @@ -48,7 +48,7 @@ public String getMiddleName() { } public String getLastName() { - return author.getLast().orElse(null); + return author.getLastOnly(); } public String getFirstLast() { diff --git a/src/test/java/org/jabref/logic/msbib/MsBibAuthorTest.java b/src/test/java/org/jabref/logic/msbib/MsBibAuthorTest.java index cbb37c47408..8736b6542e1 100644 --- a/src/test/java/org/jabref/logic/msbib/MsBibAuthorTest.java +++ b/src/test/java/org/jabref/logic/msbib/MsBibAuthorTest.java @@ -44,4 +44,11 @@ public void testGetLastName() { MsBibAuthor msBibAuthor = new MsBibAuthor(author); assertEquals("Bach", msBibAuthor.getLastName()); } + + @Test + public void testGetVonAndLastName() { + Author author = new Author("John", null, "von", "Neumann", null); + MsBibAuthor msBibAuthor = new MsBibAuthor(author); + assertEquals("von Neumann", msBibAuthor.getLastName()); + } } From 957f5d48d47c16f1cd2d6f87ef9f8a908a9de59b Mon Sep 17 00:00:00 2001 From: CaptainDaVinci Date: Wed, 6 Mar 2019 17:20:41 +0530 Subject: [PATCH 2/2] Adding "von" to Author's last name when exporting to MS Office 2007 Fixes #4655 --- src/main/java/org/jabref/logic/msbib/MsBibAuthor.java | 2 +- src/test/java/org/jabref/logic/msbib/MsBibAuthorTest.java | 7 +++++++ 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/src/main/java/org/jabref/logic/msbib/MsBibAuthor.java b/src/main/java/org/jabref/logic/msbib/MsBibAuthor.java index caad384ec22..8da1d4e49ca 100644 --- a/src/main/java/org/jabref/logic/msbib/MsBibAuthor.java +++ b/src/main/java/org/jabref/logic/msbib/MsBibAuthor.java @@ -48,7 +48,7 @@ public String getMiddleName() { } public String getLastName() { - return author.getLast().orElse(null); + return author.getLastOnly(); } public String getFirstLast() { diff --git a/src/test/java/org/jabref/logic/msbib/MsBibAuthorTest.java b/src/test/java/org/jabref/logic/msbib/MsBibAuthorTest.java index cbb37c47408..8736b6542e1 100644 --- a/src/test/java/org/jabref/logic/msbib/MsBibAuthorTest.java +++ b/src/test/java/org/jabref/logic/msbib/MsBibAuthorTest.java @@ -44,4 +44,11 @@ public void testGetLastName() { MsBibAuthor msBibAuthor = new MsBibAuthor(author); assertEquals("Bach", msBibAuthor.getLastName()); } + + @Test + public void testGetVonAndLastName() { + Author author = new Author("John", null, "von", "Neumann", null); + MsBibAuthor msBibAuthor = new MsBibAuthor(author); + assertEquals("von Neumann", msBibAuthor.getLastName()); + } }