Skip to content

Commit

Permalink
fix coverage
Browse files Browse the repository at this point in the history
  • Loading branch information
bingoohuang committed May 29, 2018
1 parent dc33a8f commit 22f4f2a
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/main/java/com/github/bingoohuang/voucherno/Strs.java
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

import java.util.stream.IntStream;

public class Strs {
public abstract class Strs {
public static StringBuilder fixedLength(StringBuilder s, int len) {
int diff = len - s.length();
if (diff < 0) return s.delete(len, s.length());
Expand Down
15 changes: 15 additions & 0 deletions src/test/java/com/github/bingoohuang/voucherno/StrsTest.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
package com.github.bingoohuang.voucherno;


import org.junit.Test;

import static com.google.common.truth.Truth.assertThat;

public class StrsTest {
@Test
public void fixedLength() {
assertThat(Strs.fixedLength(new StringBuilder("a"), 2).toString()).isEqualTo("a0");
assertThat(Strs.fixedLength(new StringBuilder("ab"), 2).toString()).isEqualTo("ab");
assertThat(Strs.fixedLength(new StringBuilder("abc"), 2).toString()).isEqualTo("ab");
}
}

0 comments on commit 22f4f2a

Please sign in to comment.