target stringlengths 20 113k | src_fm stringlengths 11 86.3k | src_fm_fc stringlengths 21 86.4k | src_fm_fc_co stringlengths 30 86.4k | src_fm_fc_ms stringlengths 42 86.8k | src_fm_fc_ms_ff stringlengths 43 86.8k |
|---|---|---|---|---|---|
@Test public void testMakeKey_KeyKindIdKey() { assertEquals( Key.newBuilder() .addPath(GRANDPARENT.getPath(0)) .addPath(Key.PathElement.newBuilder().setKind("Parent").setId(23L)) .addPath(CHILD.getPath(0)) .build(), makeKey(GRANDPARENT, "Parent", 23, CHILD).build()); } | public static Key.Builder makeKey(Object... elements) { Key.Builder key = Key.newBuilder(); PartitionId partitionId = null; for (int pathIndex = 0; pathIndex < elements.length; pathIndex += 2) { PathElement.Builder pathElement = PathElement.newBuilder(); Object element = elements[pathIndex]; if (element instanceof Key)... | DatastoreHelper { public static Key.Builder makeKey(Object... elements) { Key.Builder key = Key.newBuilder(); PartitionId partitionId = null; for (int pathIndex = 0; pathIndex < elements.length; pathIndex += 2) { PathElement.Builder pathElement = PathElement.newBuilder(); Object element = elements[pathIndex]; if (eleme... | DatastoreHelper { public static Key.Builder makeKey(Object... elements) { Key.Builder key = Key.newBuilder(); PartitionId partitionId = null; for (int pathIndex = 0; pathIndex < elements.length; pathIndex += 2) { PathElement.Builder pathElement = PathElement.newBuilder(); Object element = elements[pathIndex]; if (eleme... | DatastoreHelper { public static Key.Builder makeKey(Object... elements) { Key.Builder key = Key.newBuilder(); PartitionId partitionId = null; for (int pathIndex = 0; pathIndex < elements.length; pathIndex += 2) { PathElement.Builder pathElement = PathElement.newBuilder(); Object element = elements[pathIndex]; if (eleme... | DatastoreHelper { public static Key.Builder makeKey(Object... elements) { Key.Builder key = Key.newBuilder(); PartitionId partitionId = null; for (int pathIndex = 0; pathIndex < elements.length; pathIndex += 2) { PathElement.Builder pathElement = PathElement.newBuilder(); Object element = elements[pathIndex]; if (eleme... |
@Test public void testMakeKey_Key() { assertEquals( Key.newBuilder() .addPath(CHILD.getPath(0)) .build(), makeKey(CHILD).build()); } | public static Key.Builder makeKey(Object... elements) { Key.Builder key = Key.newBuilder(); PartitionId partitionId = null; for (int pathIndex = 0; pathIndex < elements.length; pathIndex += 2) { PathElement.Builder pathElement = PathElement.newBuilder(); Object element = elements[pathIndex]; if (element instanceof Key)... | DatastoreHelper { public static Key.Builder makeKey(Object... elements) { Key.Builder key = Key.newBuilder(); PartitionId partitionId = null; for (int pathIndex = 0; pathIndex < elements.length; pathIndex += 2) { PathElement.Builder pathElement = PathElement.newBuilder(); Object element = elements[pathIndex]; if (eleme... | DatastoreHelper { public static Key.Builder makeKey(Object... elements) { Key.Builder key = Key.newBuilder(); PartitionId partitionId = null; for (int pathIndex = 0; pathIndex < elements.length; pathIndex += 2) { PathElement.Builder pathElement = PathElement.newBuilder(); Object element = elements[pathIndex]; if (eleme... | DatastoreHelper { public static Key.Builder makeKey(Object... elements) { Key.Builder key = Key.newBuilder(); PartitionId partitionId = null; for (int pathIndex = 0; pathIndex < elements.length; pathIndex += 2) { PathElement.Builder pathElement = PathElement.newBuilder(); Object element = elements[pathIndex]; if (eleme... | DatastoreHelper { public static Key.Builder makeKey(Object... elements) { Key.Builder key = Key.newBuilder(); PartitionId partitionId = null; for (int pathIndex = 0; pathIndex < elements.length; pathIndex += 2) { PathElement.Builder pathElement = PathElement.newBuilder(); Object element = elements[pathIndex]; if (eleme... |
@Test public void testMakeKey_KeyKey() { assertEquals( Key.newBuilder() .addPath(PARENT.getPath(0)) .addPath(CHILD.getPath(0)) .build(), makeKey(PARENT, CHILD).build()); } | public static Key.Builder makeKey(Object... elements) { Key.Builder key = Key.newBuilder(); PartitionId partitionId = null; for (int pathIndex = 0; pathIndex < elements.length; pathIndex += 2) { PathElement.Builder pathElement = PathElement.newBuilder(); Object element = elements[pathIndex]; if (element instanceof Key)... | DatastoreHelper { public static Key.Builder makeKey(Object... elements) { Key.Builder key = Key.newBuilder(); PartitionId partitionId = null; for (int pathIndex = 0; pathIndex < elements.length; pathIndex += 2) { PathElement.Builder pathElement = PathElement.newBuilder(); Object element = elements[pathIndex]; if (eleme... | DatastoreHelper { public static Key.Builder makeKey(Object... elements) { Key.Builder key = Key.newBuilder(); PartitionId partitionId = null; for (int pathIndex = 0; pathIndex < elements.length; pathIndex += 2) { PathElement.Builder pathElement = PathElement.newBuilder(); Object element = elements[pathIndex]; if (eleme... | DatastoreHelper { public static Key.Builder makeKey(Object... elements) { Key.Builder key = Key.newBuilder(); PartitionId partitionId = null; for (int pathIndex = 0; pathIndex < elements.length; pathIndex += 2) { PathElement.Builder pathElement = PathElement.newBuilder(); Object element = elements[pathIndex]; if (eleme... | DatastoreHelper { public static Key.Builder makeKey(Object... elements) { Key.Builder key = Key.newBuilder(); PartitionId partitionId = null; for (int pathIndex = 0; pathIndex < elements.length; pathIndex += 2) { PathElement.Builder pathElement = PathElement.newBuilder(); Object element = elements[pathIndex]; if (eleme... |
@Test public void testMakeKey_KeyKeyKey() { assertEquals( Key.newBuilder() .addPath(GRANDPARENT.getPath(0)) .addPath(PARENT.getPath(0)) .addPath(CHILD.getPath(0)) .build(), makeKey(GRANDPARENT, PARENT, CHILD).build()); } | public static Key.Builder makeKey(Object... elements) { Key.Builder key = Key.newBuilder(); PartitionId partitionId = null; for (int pathIndex = 0; pathIndex < elements.length; pathIndex += 2) { PathElement.Builder pathElement = PathElement.newBuilder(); Object element = elements[pathIndex]; if (element instanceof Key)... | DatastoreHelper { public static Key.Builder makeKey(Object... elements) { Key.Builder key = Key.newBuilder(); PartitionId partitionId = null; for (int pathIndex = 0; pathIndex < elements.length; pathIndex += 2) { PathElement.Builder pathElement = PathElement.newBuilder(); Object element = elements[pathIndex]; if (eleme... | DatastoreHelper { public static Key.Builder makeKey(Object... elements) { Key.Builder key = Key.newBuilder(); PartitionId partitionId = null; for (int pathIndex = 0; pathIndex < elements.length; pathIndex += 2) { PathElement.Builder pathElement = PathElement.newBuilder(); Object element = elements[pathIndex]; if (eleme... | DatastoreHelper { public static Key.Builder makeKey(Object... elements) { Key.Builder key = Key.newBuilder(); PartitionId partitionId = null; for (int pathIndex = 0; pathIndex < elements.length; pathIndex += 2) { PathElement.Builder pathElement = PathElement.newBuilder(); Object element = elements[pathIndex]; if (eleme... | DatastoreHelper { public static Key.Builder makeKey(Object... elements) { Key.Builder key = Key.newBuilder(); PartitionId partitionId = null; for (int pathIndex = 0; pathIndex < elements.length; pathIndex += 2) { PathElement.Builder pathElement = PathElement.newBuilder(); Object element = elements[pathIndex]; if (eleme... |
@Test public void testMakeKey_KeyMultiLevelKey() { assertEquals( Key.newBuilder() .addPath(GRANDPARENT.getPath(0)) .addPath(PARENT.getPath(0)) .addPath(CHILD.getPath(0)) .build(), makeKey(GRANDPARENT, makeKey(PARENT, CHILD).build()).build()); } | public static Key.Builder makeKey(Object... elements) { Key.Builder key = Key.newBuilder(); PartitionId partitionId = null; for (int pathIndex = 0; pathIndex < elements.length; pathIndex += 2) { PathElement.Builder pathElement = PathElement.newBuilder(); Object element = elements[pathIndex]; if (element instanceof Key)... | DatastoreHelper { public static Key.Builder makeKey(Object... elements) { Key.Builder key = Key.newBuilder(); PartitionId partitionId = null; for (int pathIndex = 0; pathIndex < elements.length; pathIndex += 2) { PathElement.Builder pathElement = PathElement.newBuilder(); Object element = elements[pathIndex]; if (eleme... | DatastoreHelper { public static Key.Builder makeKey(Object... elements) { Key.Builder key = Key.newBuilder(); PartitionId partitionId = null; for (int pathIndex = 0; pathIndex < elements.length; pathIndex += 2) { PathElement.Builder pathElement = PathElement.newBuilder(); Object element = elements[pathIndex]; if (eleme... | DatastoreHelper { public static Key.Builder makeKey(Object... elements) { Key.Builder key = Key.newBuilder(); PartitionId partitionId = null; for (int pathIndex = 0; pathIndex < elements.length; pathIndex += 2) { PathElement.Builder pathElement = PathElement.newBuilder(); Object element = elements[pathIndex]; if (eleme... | DatastoreHelper { public static Key.Builder makeKey(Object... elements) { Key.Builder key = Key.newBuilder(); PartitionId partitionId = null; for (int pathIndex = 0; pathIndex < elements.length; pathIndex += 2) { PathElement.Builder pathElement = PathElement.newBuilder(); Object element = elements[pathIndex]; if (eleme... |
@Test public void testMakeKey_MultiLevelKeyKey() { assertEquals( Key.newBuilder() .addPath(GRANDPARENT.getPath(0)) .addPath(PARENT.getPath(0)) .addPath(CHILD.getPath(0)) .build(), makeKey(makeKey(GRANDPARENT, PARENT).build(), CHILD).build()); } | public static Key.Builder makeKey(Object... elements) { Key.Builder key = Key.newBuilder(); PartitionId partitionId = null; for (int pathIndex = 0; pathIndex < elements.length; pathIndex += 2) { PathElement.Builder pathElement = PathElement.newBuilder(); Object element = elements[pathIndex]; if (element instanceof Key)... | DatastoreHelper { public static Key.Builder makeKey(Object... elements) { Key.Builder key = Key.newBuilder(); PartitionId partitionId = null; for (int pathIndex = 0; pathIndex < elements.length; pathIndex += 2) { PathElement.Builder pathElement = PathElement.newBuilder(); Object element = elements[pathIndex]; if (eleme... | DatastoreHelper { public static Key.Builder makeKey(Object... elements) { Key.Builder key = Key.newBuilder(); PartitionId partitionId = null; for (int pathIndex = 0; pathIndex < elements.length; pathIndex += 2) { PathElement.Builder pathElement = PathElement.newBuilder(); Object element = elements[pathIndex]; if (eleme... | DatastoreHelper { public static Key.Builder makeKey(Object... elements) { Key.Builder key = Key.newBuilder(); PartitionId partitionId = null; for (int pathIndex = 0; pathIndex < elements.length; pathIndex += 2) { PathElement.Builder pathElement = PathElement.newBuilder(); Object element = elements[pathIndex]; if (eleme... | DatastoreHelper { public static Key.Builder makeKey(Object... elements) { Key.Builder key = Key.newBuilder(); PartitionId partitionId = null; for (int pathIndex = 0; pathIndex < elements.length; pathIndex += 2) { PathElement.Builder pathElement = PathElement.newBuilder(); Object element = elements[pathIndex]; if (eleme... |
@Test public void testMakeKey_MultiLevelKey() { assertEquals( Key.newBuilder() .addPath(GRANDPARENT.getPath(0)) .addPath(PARENT.getPath(0)) .addPath(CHILD.getPath(0)) .build(), makeKey(makeKey(GRANDPARENT, PARENT, CHILD).build()).build()); } | public static Key.Builder makeKey(Object... elements) { Key.Builder key = Key.newBuilder(); PartitionId partitionId = null; for (int pathIndex = 0; pathIndex < elements.length; pathIndex += 2) { PathElement.Builder pathElement = PathElement.newBuilder(); Object element = elements[pathIndex]; if (element instanceof Key)... | DatastoreHelper { public static Key.Builder makeKey(Object... elements) { Key.Builder key = Key.newBuilder(); PartitionId partitionId = null; for (int pathIndex = 0; pathIndex < elements.length; pathIndex += 2) { PathElement.Builder pathElement = PathElement.newBuilder(); Object element = elements[pathIndex]; if (eleme... | DatastoreHelper { public static Key.Builder makeKey(Object... elements) { Key.Builder key = Key.newBuilder(); PartitionId partitionId = null; for (int pathIndex = 0; pathIndex < elements.length; pathIndex += 2) { PathElement.Builder pathElement = PathElement.newBuilder(); Object element = elements[pathIndex]; if (eleme... | DatastoreHelper { public static Key.Builder makeKey(Object... elements) { Key.Builder key = Key.newBuilder(); PartitionId partitionId = null; for (int pathIndex = 0; pathIndex < elements.length; pathIndex += 2) { PathElement.Builder pathElement = PathElement.newBuilder(); Object element = elements[pathIndex]; if (eleme... | DatastoreHelper { public static Key.Builder makeKey(Object... elements) { Key.Builder key = Key.newBuilder(); PartitionId partitionId = null; for (int pathIndex = 0; pathIndex < elements.length; pathIndex += 2) { PathElement.Builder pathElement = PathElement.newBuilder(); Object element = elements[pathIndex]; if (eleme... |
@Test public void testMakeKey_PartitionId() { PartitionId partitionId = PartitionId.newBuilder() .setNamespaceId("namespace-id") .build(); Key parent = PARENT.toBuilder() .setPartitionId(partitionId) .build(); assertEquals( Key.newBuilder() .setPartitionId(partitionId) .addPath(PARENT.getPath(0)) .addPath(Key.PathEleme... | public static Key.Builder makeKey(Object... elements) { Key.Builder key = Key.newBuilder(); PartitionId partitionId = null; for (int pathIndex = 0; pathIndex < elements.length; pathIndex += 2) { PathElement.Builder pathElement = PathElement.newBuilder(); Object element = elements[pathIndex]; if (element instanceof Key)... | DatastoreHelper { public static Key.Builder makeKey(Object... elements) { Key.Builder key = Key.newBuilder(); PartitionId partitionId = null; for (int pathIndex = 0; pathIndex < elements.length; pathIndex += 2) { PathElement.Builder pathElement = PathElement.newBuilder(); Object element = elements[pathIndex]; if (eleme... | DatastoreHelper { public static Key.Builder makeKey(Object... elements) { Key.Builder key = Key.newBuilder(); PartitionId partitionId = null; for (int pathIndex = 0; pathIndex < elements.length; pathIndex += 2) { PathElement.Builder pathElement = PathElement.newBuilder(); Object element = elements[pathIndex]; if (eleme... | DatastoreHelper { public static Key.Builder makeKey(Object... elements) { Key.Builder key = Key.newBuilder(); PartitionId partitionId = null; for (int pathIndex = 0; pathIndex < elements.length; pathIndex += 2) { PathElement.Builder pathElement = PathElement.newBuilder(); Object element = elements[pathIndex]; if (eleme... | DatastoreHelper { public static Key.Builder makeKey(Object... elements) { Key.Builder key = Key.newBuilder(); PartitionId partitionId = null; for (int pathIndex = 0; pathIndex < elements.length; pathIndex += 2) { PathElement.Builder pathElement = PathElement.newBuilder(); Object element = elements[pathIndex]; if (eleme... |
@Test public void testMakeKey_NonMatchingPartitionId2() { PartitionId partitionId1 = PartitionId.newBuilder() .setNamespaceId("namespace-id") .build(); PartitionId partitionId2 = PartitionId.newBuilder() .setNamespaceId("another-namespace-id") .build(); try { makeKey( PARENT.toBuilder().setPartitionId(partitionId1).bui... | public static Key.Builder makeKey(Object... elements) { Key.Builder key = Key.newBuilder(); PartitionId partitionId = null; for (int pathIndex = 0; pathIndex < elements.length; pathIndex += 2) { PathElement.Builder pathElement = PathElement.newBuilder(); Object element = elements[pathIndex]; if (element instanceof Key)... | DatastoreHelper { public static Key.Builder makeKey(Object... elements) { Key.Builder key = Key.newBuilder(); PartitionId partitionId = null; for (int pathIndex = 0; pathIndex < elements.length; pathIndex += 2) { PathElement.Builder pathElement = PathElement.newBuilder(); Object element = elements[pathIndex]; if (eleme... | DatastoreHelper { public static Key.Builder makeKey(Object... elements) { Key.Builder key = Key.newBuilder(); PartitionId partitionId = null; for (int pathIndex = 0; pathIndex < elements.length; pathIndex += 2) { PathElement.Builder pathElement = PathElement.newBuilder(); Object element = elements[pathIndex]; if (eleme... | DatastoreHelper { public static Key.Builder makeKey(Object... elements) { Key.Builder key = Key.newBuilder(); PartitionId partitionId = null; for (int pathIndex = 0; pathIndex < elements.length; pathIndex += 2) { PathElement.Builder pathElement = PathElement.newBuilder(); Object element = elements[pathIndex]; if (eleme... | DatastoreHelper { public static Key.Builder makeKey(Object... elements) { Key.Builder key = Key.newBuilder(); PartitionId partitionId = null; for (int pathIndex = 0; pathIndex < elements.length; pathIndex += 2) { PathElement.Builder pathElement = PathElement.newBuilder(); Object element = elements[pathIndex]; if (eleme... |
@Test public void makeClient_WithCredentialTransport() { NetHttpTransport credTransport = new NetHttpTransport(); NetHttpTransport transport = new NetHttpTransport(); GoogleCredential credential = new GoogleCredential.Builder() .setTransport(credTransport) .build(); DatastoreOptions options = new DatastoreOptions.Build... | public HttpRequestFactory makeClient(DatastoreOptions options) { Credential credential = options.getCredential(); HttpTransport transport = options.getTransport(); if (transport == null) { transport = credential == null ? new NetHttpTransport() : credential.getTransport(); transport = transport == null ? new NetHttpTra... | DatastoreFactory { public HttpRequestFactory makeClient(DatastoreOptions options) { Credential credential = options.getCredential(); HttpTransport transport = options.getTransport(); if (transport == null) { transport = credential == null ? new NetHttpTransport() : credential.getTransport(); transport = transport == nu... | DatastoreFactory { public HttpRequestFactory makeClient(DatastoreOptions options) { Credential credential = options.getCredential(); HttpTransport transport = options.getTransport(); if (transport == null) { transport = credential == null ? new NetHttpTransport() : credential.getTransport(); transport = transport == nu... | DatastoreFactory { public HttpRequestFactory makeClient(DatastoreOptions options) { Credential credential = options.getCredential(); HttpTransport transport = options.getTransport(); if (transport == null) { transport = credential == null ? new NetHttpTransport() : credential.getTransport(); transport = transport == nu... | DatastoreFactory { public HttpRequestFactory makeClient(DatastoreOptions options) { Credential credential = options.getCredential(); HttpTransport transport = options.getTransport(); if (transport == null) { transport = credential == null ? new NetHttpTransport() : credential.getTransport(); transport = transport == nu... |
@Test public void testException() { Status statusProto = Status.newBuilder() .setCode(Code.UNAUTHENTICATED_VALUE) .setMessage("The request does not have valid authentication credentials.") .build(); DatastoreException exception = RemoteRpc.makeException("url", METHOD_NAME, new ByteArrayInputStream(statusProto.toByteArr... | public static DatastoreException makeException(String url, String methodName, Code code, String message, Throwable cause) { logger.fine("remote datastore call " + methodName + " against " + url + " failed: " + message); return new DatastoreException(methodName, code, message, cause); } | RemoteRpc { public static DatastoreException makeException(String url, String methodName, Code code, String message, Throwable cause) { logger.fine("remote datastore call " + methodName + " against " + url + " failed: " + message); return new DatastoreException(methodName, code, message, cause); } } | RemoteRpc { public static DatastoreException makeException(String url, String methodName, Code code, String message, Throwable cause) { logger.fine("remote datastore call " + methodName + " against " + url + " failed: " + message); return new DatastoreException(methodName, code, message, cause); } RemoteRpc(HttpRequest... | RemoteRpc { public static DatastoreException makeException(String url, String methodName, Code code, String message, Throwable cause) { logger.fine("remote datastore call " + methodName + " against " + url + " failed: " + message); return new DatastoreException(methodName, code, message, cause); } RemoteRpc(HttpRequest... | RemoteRpc { public static DatastoreException makeException(String url, String methodName, Code code, String message, Throwable cause) { logger.fine("remote datastore call " + methodName + " against " + url + " failed: " + message); return new DatastoreException(methodName, code, message, cause); } RemoteRpc(HttpRequest... |
@Test public void testInvalidProtoException() { DatastoreException exception = RemoteRpc.makeException("url", METHOD_NAME, new ByteArrayInputStream("<invalid proto>".getBytes()), "application/x-protobuf", Charsets.UTF_8, new RuntimeException(), 401); assertEquals(Code.INTERNAL, exception.getCode()); assertEquals("Unabl... | public static DatastoreException makeException(String url, String methodName, Code code, String message, Throwable cause) { logger.fine("remote datastore call " + methodName + " against " + url + " failed: " + message); return new DatastoreException(methodName, code, message, cause); } | RemoteRpc { public static DatastoreException makeException(String url, String methodName, Code code, String message, Throwable cause) { logger.fine("remote datastore call " + methodName + " against " + url + " failed: " + message); return new DatastoreException(methodName, code, message, cause); } } | RemoteRpc { public static DatastoreException makeException(String url, String methodName, Code code, String message, Throwable cause) { logger.fine("remote datastore call " + methodName + " against " + url + " failed: " + message); return new DatastoreException(methodName, code, message, cause); } RemoteRpc(HttpRequest... | RemoteRpc { public static DatastoreException makeException(String url, String methodName, Code code, String message, Throwable cause) { logger.fine("remote datastore call " + methodName + " against " + url + " failed: " + message); return new DatastoreException(methodName, code, message, cause); } RemoteRpc(HttpRequest... | RemoteRpc { public static DatastoreException makeException(String url, String methodName, Code code, String message, Throwable cause) { logger.fine("remote datastore call " + methodName + " against " + url + " failed: " + message); return new DatastoreException(methodName, code, message, cause); } RemoteRpc(HttpRequest... |
@Test public void testEmptyProtoException() { Status statusProto = Status.newBuilder().build(); DatastoreException exception = RemoteRpc.makeException( "url", METHOD_NAME, new ByteArrayInputStream(statusProto.toByteArray()), "application/x-protobuf", Charsets.UTF_8, new RuntimeException(), 404); assertEquals(Code.INTER... | public static DatastoreException makeException(String url, String methodName, Code code, String message, Throwable cause) { logger.fine("remote datastore call " + methodName + " against " + url + " failed: " + message); return new DatastoreException(methodName, code, message, cause); } | RemoteRpc { public static DatastoreException makeException(String url, String methodName, Code code, String message, Throwable cause) { logger.fine("remote datastore call " + methodName + " against " + url + " failed: " + message); return new DatastoreException(methodName, code, message, cause); } } | RemoteRpc { public static DatastoreException makeException(String url, String methodName, Code code, String message, Throwable cause) { logger.fine("remote datastore call " + methodName + " against " + url + " failed: " + message); return new DatastoreException(methodName, code, message, cause); } RemoteRpc(HttpRequest... | RemoteRpc { public static DatastoreException makeException(String url, String methodName, Code code, String message, Throwable cause) { logger.fine("remote datastore call " + methodName + " against " + url + " failed: " + message); return new DatastoreException(methodName, code, message, cause); } RemoteRpc(HttpRequest... | RemoteRpc { public static DatastoreException makeException(String url, String methodName, Code code, String message, Throwable cause) { logger.fine("remote datastore call " + methodName + " against " + url + " failed: " + message); return new DatastoreException(methodName, code, message, cause); } RemoteRpc(HttpRequest... |
@Test public void testEmptyProtoExceptionUnauthenticated() { Status statusProto = Status.newBuilder().build(); DatastoreException exception = RemoteRpc.makeException( "url", METHOD_NAME, new ByteArrayInputStream(statusProto.toByteArray()), "application/x-protobuf", Charsets.UTF_8, new RuntimeException(), 401); assertEq... | public static DatastoreException makeException(String url, String methodName, Code code, String message, Throwable cause) { logger.fine("remote datastore call " + methodName + " against " + url + " failed: " + message); return new DatastoreException(methodName, code, message, cause); } | RemoteRpc { public static DatastoreException makeException(String url, String methodName, Code code, String message, Throwable cause) { logger.fine("remote datastore call " + methodName + " against " + url + " failed: " + message); return new DatastoreException(methodName, code, message, cause); } } | RemoteRpc { public static DatastoreException makeException(String url, String methodName, Code code, String message, Throwable cause) { logger.fine("remote datastore call " + methodName + " against " + url + " failed: " + message); return new DatastoreException(methodName, code, message, cause); } RemoteRpc(HttpRequest... | RemoteRpc { public static DatastoreException makeException(String url, String methodName, Code code, String message, Throwable cause) { logger.fine("remote datastore call " + methodName + " against " + url + " failed: " + message); return new DatastoreException(methodName, code, message, cause); } RemoteRpc(HttpRequest... | RemoteRpc { public static DatastoreException makeException(String url, String methodName, Code code, String message, Throwable cause) { logger.fine("remote datastore call " + methodName + " against " + url + " failed: " + message); return new DatastoreException(methodName, code, message, cause); } RemoteRpc(HttpRequest... |
@Test public void testPlainTextException() { DatastoreException exception = RemoteRpc.makeException("url", METHOD_NAME, new ByteArrayInputStream("Text Error".getBytes()), "text/plain", Charsets.UTF_8, new RuntimeException(), 401); assertEquals(Code.INTERNAL, exception.getCode()); assertEquals( "Non-protobuf error: Text... | public static DatastoreException makeException(String url, String methodName, Code code, String message, Throwable cause) { logger.fine("remote datastore call " + methodName + " against " + url + " failed: " + message); return new DatastoreException(methodName, code, message, cause); } | RemoteRpc { public static DatastoreException makeException(String url, String methodName, Code code, String message, Throwable cause) { logger.fine("remote datastore call " + methodName + " against " + url + " failed: " + message); return new DatastoreException(methodName, code, message, cause); } } | RemoteRpc { public static DatastoreException makeException(String url, String methodName, Code code, String message, Throwable cause) { logger.fine("remote datastore call " + methodName + " against " + url + " failed: " + message); return new DatastoreException(methodName, code, message, cause); } RemoteRpc(HttpRequest... | RemoteRpc { public static DatastoreException makeException(String url, String methodName, Code code, String message, Throwable cause) { logger.fine("remote datastore call " + methodName + " against " + url + " failed: " + message); return new DatastoreException(methodName, code, message, cause); } RemoteRpc(HttpRequest... | RemoteRpc { public static DatastoreException makeException(String url, String methodName, Code code, String message, Throwable cause) { logger.fine("remote datastore call " + methodName + " against " + url + " failed: " + message); return new DatastoreException(methodName, code, message, cause); } RemoteRpc(HttpRequest... |
@Test public void testGzip() throws IOException, DatastoreException { BeginTransactionResponse response = newBeginTransactionResponse(); InjectedTestValues injectedTestValues = new InjectedTestValues(gzip(response), new byte[1], true); RemoteRpc rpc = newRemoteRpc(injectedTestValues); InputStream is = rpc.call("beginTr... | public InputStream call(String methodName, MessageLite request) throws DatastoreException { logger.fine("remote datastore call " + methodName); long startTime = System.currentTimeMillis(); try { HttpResponse httpResponse; try { rpcCount.incrementAndGet(); ProtoHttpContent payload = new ProtoHttpContent(request); HttpRe... | RemoteRpc { public InputStream call(String methodName, MessageLite request) throws DatastoreException { logger.fine("remote datastore call " + methodName); long startTime = System.currentTimeMillis(); try { HttpResponse httpResponse; try { rpcCount.incrementAndGet(); ProtoHttpContent payload = new ProtoHttpContent(requ... | RemoteRpc { public InputStream call(String methodName, MessageLite request) throws DatastoreException { logger.fine("remote datastore call " + methodName); long startTime = System.currentTimeMillis(); try { HttpResponse httpResponse; try { rpcCount.incrementAndGet(); ProtoHttpContent payload = new ProtoHttpContent(requ... | RemoteRpc { public InputStream call(String methodName, MessageLite request) throws DatastoreException { logger.fine("remote datastore call " + methodName); long startTime = System.currentTimeMillis(); try { HttpResponse httpResponse; try { rpcCount.incrementAndGet(); ProtoHttpContent payload = new ProtoHttpContent(requ... | RemoteRpc { public InputStream call(String methodName, MessageLite request) throws DatastoreException { logger.fine("remote datastore call " + methodName); long startTime = System.currentTimeMillis(); try { HttpResponse httpResponse; try { rpcCount.incrementAndGet(); ProtoHttpContent payload = new ProtoHttpContent(requ... |
@Test public void testMustacheTagPattern() { String text = "{{foo }} and {{#bar}}...{{/bar}}"; Pattern tagPattern = Patterns .newMustacheTagPattern(MustacheEngineBuilder.newBuilder() .build().getConfiguration()); Matcher matcher = tagPattern.matcher(text); StringBuffer result = new StringBuffer(); int occurences = 0; w... | public static Pattern newMustacheTagPattern(Configuration configuration) { StringBuilder regex = new StringBuilder(); regex.append(Pattern.quote(configuration .getStringPropertyValue(EngineConfigurationKey.START_DELIMITER))); regex.append(".*?"); regex.append(Pattern.quote(configuration .getStringPropertyValue(EngineCo... | Patterns { public static Pattern newMustacheTagPattern(Configuration configuration) { StringBuilder regex = new StringBuilder(); regex.append(Pattern.quote(configuration .getStringPropertyValue(EngineConfigurationKey.START_DELIMITER))); regex.append(".*?"); regex.append(Pattern.quote(configuration .getStringPropertyVal... | Patterns { public static Pattern newMustacheTagPattern(Configuration configuration) { StringBuilder regex = new StringBuilder(); regex.append(Pattern.quote(configuration .getStringPropertyValue(EngineConfigurationKey.START_DELIMITER))); regex.append(".*?"); regex.append(Pattern.quote(configuration .getStringPropertyVal... | Patterns { public static Pattern newMustacheTagPattern(Configuration configuration) { StringBuilder regex = new StringBuilder(); regex.append(Pattern.quote(configuration .getStringPropertyValue(EngineConfigurationKey.START_DELIMITER))); regex.append(".*?"); regex.append(Pattern.quote(configuration .getStringPropertyVal... | Patterns { public static Pattern newMustacheTagPattern(Configuration configuration) { StringBuilder regex = new StringBuilder(); regex.append(Pattern.quote(configuration .getStringPropertyValue(EngineConfigurationKey.START_DELIMITER))); regex.append(".*?"); regex.append(Pattern.quote(configuration .getStringPropertyVal... |
@Test public void testToString() throws IOException { assertEquals("foo", IOUtils.toString(new StringReader("foo"))); assertEquals("foo", IOUtils.toString(new StringReader("foo"), 1)); } | public static String toString(Reader input) throws IOException { return toString(input, DEFAULT_BUFFER_SIZE); } | IOUtils { public static String toString(Reader input) throws IOException { return toString(input, DEFAULT_BUFFER_SIZE); } } | IOUtils { public static String toString(Reader input) throws IOException { return toString(input, DEFAULT_BUFFER_SIZE); } private IOUtils(); } | IOUtils { public static String toString(Reader input) throws IOException { return toString(input, DEFAULT_BUFFER_SIZE); } private IOUtils(); static String toString(Reader input); static String toString(Reader input, int bufferSize); static String toString(Reader input, int bufferSize, boolean close); static void copy(... | IOUtils { public static String toString(Reader input) throws IOException { return toString(input, DEFAULT_BUFFER_SIZE); } private IOUtils(); static String toString(Reader input); static String toString(Reader input, int bufferSize); static String toString(Reader input, int bufferSize, boolean close); static void copy(... |
@Test public void testIsFalsy() { assertTrue(Checker.isFalsy(null)); assertTrue(Checker.isFalsy(false)); assertTrue(Checker.isFalsy(new String[] {})); assertTrue(Checker.isFalsy(Collections.emptyList())); assertTrue(Checker.isFalsy("")); assertTrue(Checker.isFalsy(new StringBuilder())); assertTrue(Checker.isFalsy(0)); ... | @SuppressWarnings("rawtypes") public static boolean isFalsy(Object value) { if (value == null) { return true; } else if (value instanceof Boolean) { return !(Boolean) value; } else if (value instanceof Collection) { return ((Collection) value).isEmpty(); } else if (value instanceof Iterable) { return !((Iterable) value... | Checker { @SuppressWarnings("rawtypes") public static boolean isFalsy(Object value) { if (value == null) { return true; } else if (value instanceof Boolean) { return !(Boolean) value; } else if (value instanceof Collection) { return ((Collection) value).isEmpty(); } else if (value instanceof Iterable) { return !((Itera... | Checker { @SuppressWarnings("rawtypes") public static boolean isFalsy(Object value) { if (value == null) { return true; } else if (value instanceof Boolean) { return !(Boolean) value; } else if (value instanceof Collection) { return ((Collection) value).isEmpty(); } else if (value instanceof Iterable) { return !((Itera... | Checker { @SuppressWarnings("rawtypes") public static boolean isFalsy(Object value) { if (value == null) { return true; } else if (value instanceof Boolean) { return !(Boolean) value; } else if (value instanceof Collection) { return ((Collection) value).isEmpty(); } else if (value instanceof Iterable) { return !((Itera... | Checker { @SuppressWarnings("rawtypes") public static boolean isFalsy(Object value) { if (value == null) { return true; } else if (value instanceof Boolean) { return !(Boolean) value; } else if (value instanceof Collection) { return ((Collection) value).isEmpty(); } else if (value instanceof Iterable) { return !((Itera... |
@Test public void testResolution() { ReflectionResolver resolver = new ReflectionResolver(); MustacheEngineBuilder.newBuilder().omitServiceLoaderConfigurationExtensions().addResolver(resolver).build(); Hammer hammer = new Hammer(); assertNull(resolver.resolve(null, "whatever", null)); assertNotNull(resolver.resolve(ham... | @Override public Object resolve(Object contextObject, String name, ResolutionContext context) { if (contextObject == null) { return null; } MemberWrapper wrapper; MemberKey key = MemberKey.newInstance(contextObject, name); if (memberCache != null) { wrapper = memberCache.get(key).orElse(null); } else { wrapper = findWr... | ReflectionResolver extends AbstractResolver { @Override public Object resolve(Object contextObject, String name, ResolutionContext context) { if (contextObject == null) { return null; } MemberWrapper wrapper; MemberKey key = MemberKey.newInstance(contextObject, name); if (memberCache != null) { wrapper = memberCache.ge... | ReflectionResolver extends AbstractResolver { @Override public Object resolve(Object contextObject, String name, ResolutionContext context) { if (contextObject == null) { return null; } MemberWrapper wrapper; MemberKey key = MemberKey.newInstance(contextObject, name); if (memberCache != null) { wrapper = memberCache.ge... | ReflectionResolver extends AbstractResolver { @Override public Object resolve(Object contextObject, String name, ResolutionContext context) { if (contextObject == null) { return null; } MemberWrapper wrapper; MemberKey key = MemberKey.newInstance(contextObject, name); if (memberCache != null) { wrapper = memberCache.ge... | ReflectionResolver extends AbstractResolver { @Override public Object resolve(Object contextObject, String name, ResolutionContext context) { if (contextObject == null) { return null; } MemberWrapper wrapper; MemberKey key = MemberKey.newInstance(contextObject, name); if (memberCache != null) { wrapper = memberCache.ge... |
@Test(expected = IllegalStateException.class) public void testMultipleInit() { ReflectionResolver resolver = new ReflectionResolver(); MustacheEngineBuilder.newBuilder().omitServiceLoaderConfigurationExtensions().addResolver(resolver).build(); resolver.init(null); } | @Override public void init() { long memberCacheMaxSize = configuration .getLongPropertyValue(MEMBER_CACHE_MAX_SIZE_KEY); LOGGER.debug("Initialized [memberCacheMaxSize: {}]", memberCacheMaxSize); if (memberCacheMaxSize > 0) { memberCache = configuration.getComputingCacheFactory().create( COMPUTING_CACHE_CONSUMER_ID, Ref... | ReflectionResolver extends AbstractResolver { @Override public void init() { long memberCacheMaxSize = configuration .getLongPropertyValue(MEMBER_CACHE_MAX_SIZE_KEY); LOGGER.debug("Initialized [memberCacheMaxSize: {}]", memberCacheMaxSize); if (memberCacheMaxSize > 0) { memberCache = configuration.getComputingCacheFact... | ReflectionResolver extends AbstractResolver { @Override public void init() { long memberCacheMaxSize = configuration .getLongPropertyValue(MEMBER_CACHE_MAX_SIZE_KEY); LOGGER.debug("Initialized [memberCacheMaxSize: {}]", memberCacheMaxSize); if (memberCacheMaxSize > 0) { memberCache = configuration.getComputingCacheFact... | ReflectionResolver extends AbstractResolver { @Override public void init() { long memberCacheMaxSize = configuration .getLongPropertyValue(MEMBER_CACHE_MAX_SIZE_KEY); LOGGER.debug("Initialized [memberCacheMaxSize: {}]", memberCacheMaxSize); if (memberCacheMaxSize > 0) { memberCache = configuration.getComputingCacheFact... | ReflectionResolver extends AbstractResolver { @Override public void init() { long memberCacheMaxSize = configuration .getLongPropertyValue(MEMBER_CACHE_MAX_SIZE_KEY); LOGGER.debug("Initialized [memberCacheMaxSize: {}]", memberCacheMaxSize); if (memberCacheMaxSize > 0) { memberCache = configuration.getComputingCacheFact... |
@Test(expected = IllegalStateException.class) public void testMultipleInit() { DateTimeFormatResolver resolver = new DateTimeFormatResolver(); MustacheEngineBuilder.newBuilder() .omitServiceLoaderConfigurationExtensions() .addResolver(resolver).build(); resolver.init(null); } | @Override public void init() { super.init(); customPattern = configuration .getStringPropertyValue(CUSTOM_PATTERN_KEY); LOGGER.info("Initialized [customPattern: {}]", customPattern); } | DateTimeFormatResolver extends TransformResolver { @Override public void init() { super.init(); customPattern = configuration .getStringPropertyValue(CUSTOM_PATTERN_KEY); LOGGER.info("Initialized [customPattern: {}]", customPattern); } } | DateTimeFormatResolver extends TransformResolver { @Override public void init() { super.init(); customPattern = configuration .getStringPropertyValue(CUSTOM_PATTERN_KEY); LOGGER.info("Initialized [customPattern: {}]", customPattern); } DateTimeFormatResolver(); DateTimeFormatResolver(int priority); } | DateTimeFormatResolver extends TransformResolver { @Override public void init() { super.init(); customPattern = configuration .getStringPropertyValue(CUSTOM_PATTERN_KEY); LOGGER.info("Initialized [customPattern: {}]", customPattern); } DateTimeFormatResolver(); DateTimeFormatResolver(int priority); @Override Object tr... | DateTimeFormatResolver extends TransformResolver { @Override public void init() { super.init(); customPattern = configuration .getStringPropertyValue(CUSTOM_PATTERN_KEY); LOGGER.info("Initialized [customPattern: {}]", customPattern); } DateTimeFormatResolver(); DateTimeFormatResolver(int priority); @Override Object tr... |
@Test public void testNotAnIndex() { IndexResolver indexResolver = new IndexResolver(0) { @Override public Object resolve(Object contextObject, String name, ResolutionContext context) { return null; } }; assertTrue(indexResolver.notAnIndex("-1")); assertTrue(indexResolver.notAnIndex("size")); assertTrue(indexResolver.n... | protected boolean notAnIndex(String name) { return !isAnIndex(name); } | IndexResolver extends AbstractResolver { protected boolean notAnIndex(String name) { return !isAnIndex(name); } } | IndexResolver extends AbstractResolver { protected boolean notAnIndex(String name) { return !isAnIndex(name); } IndexResolver(int priority); } | IndexResolver extends AbstractResolver { protected boolean notAnIndex(String name) { return !isAnIndex(name); } IndexResolver(int priority); } | IndexResolver extends AbstractResolver { protected boolean notAnIndex(String name) { return !isAnIndex(name); } IndexResolver(int priority); } |
@Test public void testResolution() { MustacheEngineBuilder.newBuilder() .omitServiceLoaderConfigurationExtensions() .addResolver(resolver).build(); assertNull(resolver.resolve(null, "whatever", null)); Object marker = resolver.resolve(null, "ng", null); assertNotNull(marker); assertEquals("{{FOO}}", resolver.resolve(ma... | @Override public Object resolve(Object contextObject, String name, ResolutionContext context) { if (contextObject == null && matches(name)) { return marker; } else if (contextObject != null && contextObject.equals(marker)) { return performTransformation(contextObject, name, context); } return null; } | DummyTransformResolver extends TransformResolver { @Override public Object resolve(Object contextObject, String name, ResolutionContext context) { if (contextObject == null && matches(name)) { return marker; } else if (contextObject != null && contextObject.equals(marker)) { return performTransformation(contextObject, ... | DummyTransformResolver extends TransformResolver { @Override public Object resolve(Object contextObject, String name, ResolutionContext context) { if (contextObject == null && matches(name)) { return marker; } else if (contextObject != null && contextObject.equals(marker)) { return performTransformation(contextObject, ... | DummyTransformResolver extends TransformResolver { @Override public Object resolve(Object contextObject, String name, ResolutionContext context) { if (contextObject == null && matches(name)) { return marker; } else if (contextObject != null && contextObject.equals(marker)) { return performTransformation(contextObject, ... | DummyTransformResolver extends TransformResolver { @Override public Object resolve(Object contextObject, String name, ResolutionContext context) { if (contextObject == null && matches(name)) { return marker; } else if (contextObject != null && contextObject.equals(marker)) { return performTransformation(contextObject, ... |
@Test public void testGetDelegate() { Hammer hammer = new Hammer(); assertEquals("EDGAR vs Edgar", engine.compileMustache("{{name}} vs {{delegate.name}}") .render(decorate(hammer).compute("name", h -> h.getName().toUpperCase()).build(engine))); assertEquals("EDGAR vs Edgar", engine.compileMustache("{{name}} vs {{foo.na... | public static <T> Builder<T> decorate(T delegate) { return new Builder<T>(delegate); } | Decorator implements Mapper { public static <T> Builder<T> decorate(T delegate) { return new Builder<T>(delegate); } } | Decorator implements Mapper { public static <T> Builder<T> decorate(T delegate) { return new Builder<T>(delegate); } private Decorator(T delegate, Map<String, Function<T, Object>> mappings, String delegateKey,
Configuration configuration); } | Decorator implements Mapper { public static <T> Builder<T> decorate(T delegate) { return new Builder<T>(delegate); } private Decorator(T delegate, Map<String, Function<T, Object>> mappings, String delegateKey,
Configuration configuration); static Builder<T> decorate(T delegate); static Decorator<T> decorat... | Decorator implements Mapper { public static <T> Builder<T> decorate(T delegate) { return new Builder<T>(delegate); } private Decorator(T delegate, Map<String, Function<T, Object>> mappings, String delegateKey,
Configuration configuration); static Builder<T> decorate(T delegate); static Decorator<T> decorat... |
@Test public void testNestedDecorator() { Hammer hammer = new Hammer(5); assertEquals("5:Edgar:bar", engine.compileMustache("{{age}}:{{foo}}:{{bar}}") .render(decorate(decorate(hammer).compute("foo", h -> h.getName()).build(engine)) .put("bar", "bar").build(engine))); } | public static <T> Builder<T> decorate(T delegate) { return new Builder<T>(delegate); } | Decorator implements Mapper { public static <T> Builder<T> decorate(T delegate) { return new Builder<T>(delegate); } } | Decorator implements Mapper { public static <T> Builder<T> decorate(T delegate) { return new Builder<T>(delegate); } private Decorator(T delegate, Map<String, Function<T, Object>> mappings, String delegateKey,
Configuration configuration); } | Decorator implements Mapper { public static <T> Builder<T> decorate(T delegate) { return new Builder<T>(delegate); } private Decorator(T delegate, Map<String, Function<T, Object>> mappings, String delegateKey,
Configuration configuration); static Builder<T> decorate(T delegate); static Decorator<T> decorat... | Decorator implements Mapper { public static <T> Builder<T> decorate(T delegate) { return new Builder<T>(delegate); } private Decorator(T delegate, Map<String, Function<T, Object>> mappings, String delegateKey,
Configuration configuration); static Builder<T> decorate(T delegate); static Decorator<T> decorat... |
@Test public void testResolution() { MapResolver resolver = new MapResolver(); assertNull(resolver.resolve(null, "foo", null)); assertNotNull( resolver.resolve(ImmutableMap.of("bar", "baz"), "bar", null)); assertNull( resolver.resolve(ImmutableMap.of("bar", "baz"), "qux", null)); } | @SuppressWarnings("rawtypes") @Override public Object resolve(Object contextObject, String name, ResolutionContext context) { if (contextObject == null) { return null; } if (contextObject instanceof Map) { Map map = (Map) contextObject; return map.get(name); } if (contextObject instanceof Mapper) { Mapper mapper = (Map... | MapResolver extends AbstractResolver { @SuppressWarnings("rawtypes") @Override public Object resolve(Object contextObject, String name, ResolutionContext context) { if (contextObject == null) { return null; } if (contextObject instanceof Map) { Map map = (Map) contextObject; return map.get(name); } if (contextObject in... | MapResolver extends AbstractResolver { @SuppressWarnings("rawtypes") @Override public Object resolve(Object contextObject, String name, ResolutionContext context) { if (contextObject == null) { return null; } if (contextObject instanceof Map) { Map map = (Map) contextObject; return map.get(name); } if (contextObject in... | MapResolver extends AbstractResolver { @SuppressWarnings("rawtypes") @Override public Object resolve(Object contextObject, String name, ResolutionContext context) { if (contextObject == null) { return null; } if (contextObject instanceof Map) { Map map = (Map) contextObject; return map.get(name); } if (contextObject in... | MapResolver extends AbstractResolver { @SuppressWarnings("rawtypes") @Override public Object resolve(Object contextObject, String name, ResolutionContext context) { if (contextObject == null) { return null; } if (contextObject instanceof Map) { Map map = (Map) contextObject; return map.get(name); } if (contextObject in... |
@Test public void testSetDelimitersPattern() { String set1 = "<% %>"; String set2 = "[ ]"; String set3 = "= ="; Pattern setDelimitersPattern = Patterns .newSetDelimitersContentPattern(); Matcher set1Matcher = setDelimitersPattern.matcher(set1); assertEquals(true, set1Matcher.find()); assertEquals("<%", set1Matcher.grou... | public static Pattern newSetDelimitersContentPattern() { return Pattern.compile("(\\S+)(\\s+)(\\S+)"); } | Patterns { public static Pattern newSetDelimitersContentPattern() { return Pattern.compile("(\\S+)(\\s+)(\\S+)"); } } | Patterns { public static Pattern newSetDelimitersContentPattern() { return Pattern.compile("(\\S+)(\\s+)(\\S+)"); } private Patterns(); } | Patterns { public static Pattern newSetDelimitersContentPattern() { return Pattern.compile("(\\S+)(\\s+)(\\S+)"); } private Patterns(); static Pattern newMustacheTagPattern(Configuration configuration); static Pattern newSetDelimitersContentPattern(); static Pattern newHelperIntegerLiteralPattern(); static Pattern new... | Patterns { public static Pattern newSetDelimitersContentPattern() { return Pattern.compile("(\\S+)(\\s+)(\\S+)"); } private Patterns(); static Pattern newMustacheTagPattern(Configuration configuration); static Pattern newSetDelimitersContentPattern(); static Pattern newHelperIntegerLiteralPattern(); static Pattern new... |
@Test public void testSplitHelperName() { assertHelperNameParts("name foo.bar", "name", "foo.bar"); assertHelperNameParts("name hash1=\"DD-MM-yyyy HH:mm\"", "name", "hash1=\"DD-MM-yyyy HH:mm\""); assertHelperNameParts("name key='value'", "name", "key='value'"); assertHelperNameParts("name key=''value''", "name", "key='... | static Iterator<String> splitHelperName(String name, Segment segment) { Character stringLiteral = null; boolean arrayLiteral = false; boolean space = false; List<String> parts = new ArrayList<>(); StringBuilder buffer = new StringBuilder(); for (int i = 0; i < name.length(); i++) { char character = name.charAt(i); if (... | HelperExecutionHandler { static Iterator<String> splitHelperName(String name, Segment segment) { Character stringLiteral = null; boolean arrayLiteral = false; boolean space = false; List<String> parts = new ArrayList<>(); StringBuilder buffer = new StringBuilder(); for (int i = 0; i < name.length(); i++) { char charact... | HelperExecutionHandler { static Iterator<String> splitHelperName(String name, Segment segment) { Character stringLiteral = null; boolean arrayLiteral = false; boolean space = false; List<String> parts = new ArrayList<>(); StringBuilder buffer = new StringBuilder(); for (int i = 0; i < name.length(); i++) { char charact... | HelperExecutionHandler { static Iterator<String> splitHelperName(String name, Segment segment) { Character stringLiteral = null; boolean arrayLiteral = false; boolean space = false; List<String> parts = new ArrayList<>(); StringBuilder buffer = new StringBuilder(); for (int i = 0; i < name.length(); i++) { char charact... | HelperExecutionHandler { static Iterator<String> splitHelperName(String name, Segment segment) { Character stringLiteral = null; boolean arrayLiteral = false; boolean space = false; List<String> parts = new ArrayList<>(); StringBuilder buffer = new StringBuilder(); for (int i = 0; i < name.length(); i++) { char charact... |
@Test public void testGetFirstDeterminingEqualsCharPosition() { assertEquals(3, HelperExecutionHandler .getFirstDeterminingEqualsCharPosition("foo=bar")); assertEquals(3, HelperExecutionHandler .getFirstDeterminingEqualsCharPosition("foo='bar='")); assertEquals(1, HelperExecutionHandler .getFirstDeterminingEqualsCharPo... | static int getFirstDeterminingEqualsCharPosition(String part) { boolean stringLiteral = false; for (int i = 0; i < part.length(); i++) { if (Strings.isStringLiteralSeparator(part.charAt(i))) { if (i == 0) { return -1; } stringLiteral = !stringLiteral; } else { if (!stringLiteral && part.charAt(i) == '=') { return i; } ... | HelperExecutionHandler { static int getFirstDeterminingEqualsCharPosition(String part) { boolean stringLiteral = false; for (int i = 0; i < part.length(); i++) { if (Strings.isStringLiteralSeparator(part.charAt(i))) { if (i == 0) { return -1; } stringLiteral = !stringLiteral; } else { if (!stringLiteral && part.charAt(... | HelperExecutionHandler { static int getFirstDeterminingEqualsCharPosition(String part) { boolean stringLiteral = false; for (int i = 0; i < part.length(); i++) { if (Strings.isStringLiteralSeparator(part.charAt(i))) { if (i == 0) { return -1; } stringLiteral = !stringLiteral; } else { if (!stringLiteral && part.charAt(... | HelperExecutionHandler { static int getFirstDeterminingEqualsCharPosition(String part) { boolean stringLiteral = false; for (int i = 0; i < part.length(); i++) { if (Strings.isStringLiteralSeparator(part.charAt(i))) { if (i == 0) { return -1; } stringLiteral = !stringLiteral; } else { if (!stringLiteral && part.charAt(... | HelperExecutionHandler { static int getFirstDeterminingEqualsCharPosition(String part) { boolean stringLiteral = false; for (int i = 0; i < part.length(); i++) { if (Strings.isStringLiteralSeparator(part.charAt(i))) { if (i == 0) { return -1; } stringLiteral = !stringLiteral; } else { if (!stringLiteral && part.charAt(... |
@Test public void testBuildPropertyKey() { assertEquals("org.trimou.engine.config.myPropertyName", ConfigurationProperties.buildPropertyKey("MY_PROPERTY_NAME", new String[] { ConfigurationPropertiesTest.class .getPackage().getName() })); assertEquals("org.trimou.engine.config.myPropertyName", ConfigurationProperties.bu... | static String buildPropertyKey(String propertyName, String[] prefixParts) { return buildPropertyKey(propertyName, Strings.UNDERSCORE, prefixParts); } | ConfigurationProperties { static String buildPropertyKey(String propertyName, String[] prefixParts) { return buildPropertyKey(propertyName, Strings.UNDERSCORE, prefixParts); } } | ConfigurationProperties { static String buildPropertyKey(String propertyName, String[] prefixParts) { return buildPropertyKey(propertyName, Strings.UNDERSCORE, prefixParts); } private ConfigurationProperties(); } | ConfigurationProperties { static String buildPropertyKey(String propertyName, String[] prefixParts) { return buildPropertyKey(propertyName, Strings.UNDERSCORE, prefixParts); } private ConfigurationProperties(); } | ConfigurationProperties { static String buildPropertyKey(String propertyName, String[] prefixParts) { return buildPropertyKey(propertyName, Strings.UNDERSCORE, prefixParts); } private ConfigurationProperties(); } |
@Test public void testConvertConfigValue() { assertEquals(10, ConfigurationProperties .convertConfigValue(Integer.class, "10")); assertEquals(10L, ConfigurationProperties.convertConfigValue(Long.class, "10")); assertEquals(Boolean.FALSE, ConfigurationProperties .convertConfigValue(Boolean.class, "10")); } | static Object convertConfigValue(Class<?> defaultValueType, Object value) { if (defaultValueType.equals(String.class)) { return value.toString(); } else if (defaultValueType.equals(Boolean.class)) { return Boolean.valueOf(value.toString()); } else if (defaultValueType.equals(Long.class)) { return Long.valueOf(value.toS... | ConfigurationProperties { static Object convertConfigValue(Class<?> defaultValueType, Object value) { if (defaultValueType.equals(String.class)) { return value.toString(); } else if (defaultValueType.equals(Boolean.class)) { return Boolean.valueOf(value.toString()); } else if (defaultValueType.equals(Long.class)) { ret... | ConfigurationProperties { static Object convertConfigValue(Class<?> defaultValueType, Object value) { if (defaultValueType.equals(String.class)) { return value.toString(); } else if (defaultValueType.equals(Boolean.class)) { return Boolean.valueOf(value.toString()); } else if (defaultValueType.equals(Long.class)) { ret... | ConfigurationProperties { static Object convertConfigValue(Class<?> defaultValueType, Object value) { if (defaultValueType.equals(String.class)) { return value.toString(); } else if (defaultValueType.equals(Boolean.class)) { return Boolean.valueOf(value.toString()); } else if (defaultValueType.equals(Long.class)) { ret... | ConfigurationProperties { static Object convertConfigValue(Class<?> defaultValueType, Object value) { if (defaultValueType.equals(String.class)) { return value.toString(); } else if (defaultValueType.equals(Boolean.class)) { return Boolean.valueOf(value.toString()); } else if (defaultValueType.equals(Long.class)) { ret... |
@Test(expected = IllegalStateException.class) public void testConvertConfigValueFails() { ConfigurationProperties.convertConfigValue(BigDecimal.class, "10"); } | static Object convertConfigValue(Class<?> defaultValueType, Object value) { if (defaultValueType.equals(String.class)) { return value.toString(); } else if (defaultValueType.equals(Boolean.class)) { return Boolean.valueOf(value.toString()); } else if (defaultValueType.equals(Long.class)) { return Long.valueOf(value.toS... | ConfigurationProperties { static Object convertConfigValue(Class<?> defaultValueType, Object value) { if (defaultValueType.equals(String.class)) { return value.toString(); } else if (defaultValueType.equals(Boolean.class)) { return Boolean.valueOf(value.toString()); } else if (defaultValueType.equals(Long.class)) { ret... | ConfigurationProperties { static Object convertConfigValue(Class<?> defaultValueType, Object value) { if (defaultValueType.equals(String.class)) { return value.toString(); } else if (defaultValueType.equals(Boolean.class)) { return Boolean.valueOf(value.toString()); } else if (defaultValueType.equals(Long.class)) { ret... | ConfigurationProperties { static Object convertConfigValue(Class<?> defaultValueType, Object value) { if (defaultValueType.equals(String.class)) { return value.toString(); } else if (defaultValueType.equals(Boolean.class)) { return Boolean.valueOf(value.toString()); } else if (defaultValueType.equals(Long.class)) { ret... | ConfigurationProperties { static Object convertConfigValue(Class<?> defaultValueType, Object value) { if (defaultValueType.equals(String.class)) { return value.toString(); } else if (defaultValueType.equals(Boolean.class)) { return Boolean.valueOf(value.toString()); } else if (defaultValueType.equals(Long.class)) { ret... |
@Test public void testGetKey() { final AtomicReference<String> key = new AtomicReference<>(); MustacheEngineBuilder .newBuilder() .omitServiceLoaderConfigurationExtensions() .addResolver( new AbstractResolver( 1) { @Override public Object resolve(Object contextObject, String name, ResolutionContext context) { key.set(c... | @Override public String getKey() { return key; } | ValueWrapper extends AbstractReleaseCallbackContainer implements ResolutionContext { @Override public String getKey() { return key; } } | ValueWrapper extends AbstractReleaseCallbackContainer implements ResolutionContext { @Override public String getKey() { return key; } ValueWrapper(String key); } | ValueWrapper extends AbstractReleaseCallbackContainer implements ResolutionContext { @Override public String getKey() { return key; } ValueWrapper(String key); Object get(); boolean isNull(); @Override String getKey(); @Override int getKeyPartIndex(); Hint getHint(); } | ValueWrapper extends AbstractReleaseCallbackContainer implements ResolutionContext { @Override public String getKey() { return key; } ValueWrapper(String key); Object get(); boolean isNull(); @Override String getKey(); @Override int getKeyPartIndex(); Hint getHint(); } |
@Test public void testGetKeyPartIndex() { final List<Integer> indexes = new ArrayList<>(); MustacheEngineBuilder .newBuilder() .omitServiceLoaderConfigurationExtensions() .addResolver(new AbstractResolver(1) { @Override public Object resolve(Object contextObject, String name, ResolutionContext context) { indexes.add(co... | @Override public int getKeyPartIndex() { return keyPartIndex; } | ValueWrapper extends AbstractReleaseCallbackContainer implements ResolutionContext { @Override public int getKeyPartIndex() { return keyPartIndex; } } | ValueWrapper extends AbstractReleaseCallbackContainer implements ResolutionContext { @Override public int getKeyPartIndex() { return keyPartIndex; } ValueWrapper(String key); } | ValueWrapper extends AbstractReleaseCallbackContainer implements ResolutionContext { @Override public int getKeyPartIndex() { return keyPartIndex; } ValueWrapper(String key); Object get(); boolean isNull(); @Override String getKey(); @Override int getKeyPartIndex(); Hint getHint(); } | ValueWrapper extends AbstractReleaseCallbackContainer implements ResolutionContext { @Override public int getKeyPartIndex() { return keyPartIndex; } ValueWrapper(String key); Object get(); boolean isNull(); @Override String getKey(); @Override int getKeyPartIndex(); Hint getHint(); } |
@Test public void testGetLiteral() { LiteralSupport literalSupport = new DefaultLiteralSupport(); assertNull(literalSupport.getLiteral("foo", null)); assertNull(literalSupport.getLiteral("1.0", null)); assertEquals(10, literalSupport.getLiteral("+10", null)); assertEquals(-2010, literalSupport.getLiteral("-2010", null)... | @Override public Object getLiteral(String value, MustacheTagInfo tagInfo) { if (Strings.isEmpty(value)) { return null; } Object literal = null; if (Strings.isStringLiteralSeparator(value.charAt(0))) { literal = value.substring(1, value.length() - 1); } else if (value.equals("true")) { literal = Boolean.TRUE; } else if ... | DefaultLiteralSupport extends AbstractConfigurationAware implements LiteralSupport { @Override public Object getLiteral(String value, MustacheTagInfo tagInfo) { if (Strings.isEmpty(value)) { return null; } Object literal = null; if (Strings.isStringLiteralSeparator(value.charAt(0))) { literal = value.substring(1, value... | DefaultLiteralSupport extends AbstractConfigurationAware implements LiteralSupport { @Override public Object getLiteral(String value, MustacheTagInfo tagInfo) { if (Strings.isEmpty(value)) { return null; } Object literal = null; if (Strings.isStringLiteralSeparator(value.charAt(0))) { literal = value.substring(1, value... | DefaultLiteralSupport extends AbstractConfigurationAware implements LiteralSupport { @Override public Object getLiteral(String value, MustacheTagInfo tagInfo) { if (Strings.isEmpty(value)) { return null; } Object literal = null; if (Strings.isStringLiteralSeparator(value.charAt(0))) { literal = value.substring(1, value... | DefaultLiteralSupport extends AbstractConfigurationAware implements LiteralSupport { @Override public Object getLiteral(String value, MustacheTagInfo tagInfo) { if (Strings.isEmpty(value)) { return null; } Object literal = null; if (Strings.isStringLiteralSeparator(value.charAt(0))) { literal = value.substring(1, value... |
@Test public void testSplit() { BracketDotKeySplitter splitter = new BracketDotKeySplitter(); assertIterator(splitter.split("a..bar:.c"), "a", "bar:", "c"); assertIterator(splitter.split(". "), " "); assertIterator(splitter.split("."), "."); assertIterator(splitter.split("foo"), "foo"); assertIterator(splitter.split("f... | @Override public Iterator<String> split(String key) { if (key.equals(Strings.DOT) || key.equals(Strings.THIS)) { return Iterables.singletonIterator(key); } boolean stringLiteral = false; boolean separator = false; List<String> parts = new ArrayList<>(); StringBuilder buffer = new StringBuilder(); for (int i = 0; i < ke... | BracketDotKeySplitter extends AbstractConfigurationAware implements KeySplitter { @Override public Iterator<String> split(String key) { if (key.equals(Strings.DOT) || key.equals(Strings.THIS)) { return Iterables.singletonIterator(key); } boolean stringLiteral = false; boolean separator = false; List<String> parts = new... | BracketDotKeySplitter extends AbstractConfigurationAware implements KeySplitter { @Override public Iterator<String> split(String key) { if (key.equals(Strings.DOT) || key.equals(Strings.THIS)) { return Iterables.singletonIterator(key); } boolean stringLiteral = false; boolean separator = false; List<String> parts = new... | BracketDotKeySplitter extends AbstractConfigurationAware implements KeySplitter { @Override public Iterator<String> split(String key) { if (key.equals(Strings.DOT) || key.equals(Strings.THIS)) { return Iterables.singletonIterator(key); } boolean stringLiteral = false; boolean separator = false; List<String> parts = new... | BracketDotKeySplitter extends AbstractConfigurationAware implements KeySplitter { @Override public Iterator<String> split(String key) { if (key.equals(Strings.DOT) || key.equals(Strings.THIS)) { return Iterables.singletonIterator(key); } boolean stringLiteral = false; boolean separator = false; List<String> parts = new... |
@Test public void testSplit() { DotKeySplitter splitter = new DotKeySplitter(); assertIterator(splitter.split("a..bar:.c"), "a", "bar:", "c"); assertIterator(splitter.split(". "), " "); assertIterator(splitter.split("."), "."); assertIterator(splitter.split("foo"), "foo"); } | @Override public Iterator<String> split(String key) { if (key.equals(Strings.DOT) || key.equals(Strings.THIS) || !key.contains(Strings.DOT)) { return Iterables.singletonIterator(key); } boolean separator = false; List<String> parts = new ArrayList<>(); StringBuilder buffer = new StringBuilder(); for (int i = 0; i < key... | DotKeySplitter extends AbstractConfigurationAware implements KeySplitter { @Override public Iterator<String> split(String key) { if (key.equals(Strings.DOT) || key.equals(Strings.THIS) || !key.contains(Strings.DOT)) { return Iterables.singletonIterator(key); } boolean separator = false; List<String> parts = new ArrayLi... | DotKeySplitter extends AbstractConfigurationAware implements KeySplitter { @Override public Iterator<String> split(String key) { if (key.equals(Strings.DOT) || key.equals(Strings.THIS) || !key.contains(Strings.DOT)) { return Iterables.singletonIterator(key); } boolean separator = false; List<String> parts = new ArrayLi... | DotKeySplitter extends AbstractConfigurationAware implements KeySplitter { @Override public Iterator<String> split(String key) { if (key.equals(Strings.DOT) || key.equals(Strings.THIS) || !key.contains(Strings.DOT)) { return Iterables.singletonIterator(key); } boolean separator = false; List<String> parts = new ArrayLi... | DotKeySplitter extends AbstractConfigurationAware implements KeySplitter { @Override public Iterator<String> split(String key) { if (key.equals(Strings.DOT) || key.equals(Strings.THIS) || !key.contains(Strings.DOT)) { return Iterables.singletonIterator(key); } boolean separator = false; List<String> parts = new ArrayLi... |
@Test public void testHelperIntOrLongLiteralPattern() { assertFalse(Patterns.newHelperIntegerLiteralPattern() .matcher("\"foo\"").matches()); assertTrue(Patterns.newHelperIntegerLiteralPattern().matcher("1") .matches()); assertTrue(Patterns.newHelperIntegerLiteralPattern().matcher("+12") .matches()); assertTrue(Pattern... | public static Pattern newHelperIntegerLiteralPattern() { return Pattern.compile("(\\+|-)?\\d{1,10}"); } | Patterns { public static Pattern newHelperIntegerLiteralPattern() { return Pattern.compile("(\\+|-)?\\d{1,10}"); } } | Patterns { public static Pattern newHelperIntegerLiteralPattern() { return Pattern.compile("(\\+|-)?\\d{1,10}"); } private Patterns(); } | Patterns { public static Pattern newHelperIntegerLiteralPattern() { return Pattern.compile("(\\+|-)?\\d{1,10}"); } private Patterns(); static Pattern newMustacheTagPattern(Configuration configuration); static Pattern newSetDelimitersContentPattern(); static Pattern newHelperIntegerLiteralPattern(); static Pattern newH... | Patterns { public static Pattern newHelperIntegerLiteralPattern() { return Pattern.compile("(\\+|-)?\\d{1,10}"); } private Patterns(); static Pattern newMustacheTagPattern(Configuration configuration); static Pattern newSetDelimitersContentPattern(); static Pattern newHelperIntegerLiteralPattern(); static Pattern newH... |
@Test public void testLocatorNoSuffix() throws IOException { TemplateLocator locator = FileSystemTemplateLocator.builder() .setRootPath("src/test/resources/locator/file").build(); MustacheEngineBuilder.newBuilder().addTemplateLocator(locator).build(); Set<String> ids = locator.getAllIdentifiers(); assertEquals(7, ids.s... | public static Builder builder() { return new Builder(); } | FileSystemTemplateLocator extends FilePathTemplateLocator { public static Builder builder() { return new Builder(); } } | FileSystemTemplateLocator extends FilePathTemplateLocator { public static Builder builder() { return new Builder(); } FileSystemTemplateLocator(int priority, String rootPath); FileSystemTemplateLocator(int priority, String rootPath,
String suffix); } | FileSystemTemplateLocator extends FilePathTemplateLocator { public static Builder builder() { return new Builder(); } FileSystemTemplateLocator(int priority, String rootPath); FileSystemTemplateLocator(int priority, String rootPath,
String suffix); @Override Reader locateRealPath(String realPath); static B... | FileSystemTemplateLocator extends FilePathTemplateLocator { public static Builder builder() { return new Builder(); } FileSystemTemplateLocator(int priority, String rootPath); FileSystemTemplateLocator(int priority, String rootPath,
String suffix); @Override Reader locateRealPath(String realPath); static B... |
@Test public void testCustomVirtualPathSeparator() throws IOException { TemplateLocator locator = FileSystemTemplateLocator.builder() .setPriority(1).setRootPath("src/test/resources/locator/file") .setSuffix("foo").build(); MustacheEngineBuilder.newBuilder().addTemplateLocator(locator) .setProperty(PathTemplateLocator.... | public static Builder builder() { return new Builder(); } | FileSystemTemplateLocator extends FilePathTemplateLocator { public static Builder builder() { return new Builder(); } } | FileSystemTemplateLocator extends FilePathTemplateLocator { public static Builder builder() { return new Builder(); } FileSystemTemplateLocator(int priority, String rootPath); FileSystemTemplateLocator(int priority, String rootPath,
String suffix); } | FileSystemTemplateLocator extends FilePathTemplateLocator { public static Builder builder() { return new Builder(); } FileSystemTemplateLocator(int priority, String rootPath); FileSystemTemplateLocator(int priority, String rootPath,
String suffix); @Override Reader locateRealPath(String realPath); static B... | FileSystemTemplateLocator extends FilePathTemplateLocator { public static Builder builder() { return new Builder(); } FileSystemTemplateLocator(int priority, String rootPath); FileSystemTemplateLocator(int priority, String rootPath,
String suffix); @Override Reader locateRealPath(String realPath); static B... |
@Test public void testIsStandaloneLine() { assertTrue(SegmentBases.isStandaloneLine(ImmutableList.of( new SegmentBase(SegmentType.LINE_SEPARATOR, Strings.LINE_SEPARATOR_LF, 0, 0), new SegmentBase(SegmentType.TEXT, " ", 0, 0), new ContainerSegmentBase(SegmentType.SECTION, "test", 0, 0)))); assertFalse(SegmentBases.isSta... | static boolean isStandaloneLine(List<SegmentBase> line) { boolean standaloneCandidate = false; for (SegmentBase segment : line) { if (SegmentType.VALUE.equals(segment.getType())) { return false; } else if (SegmentType.TEXT.equals(segment.getType())) { if (!Strings.containsOnlyWhitespace(segment.getContent())) { return ... | SegmentBases { static boolean isStandaloneLine(List<SegmentBase> line) { boolean standaloneCandidate = false; for (SegmentBase segment : line) { if (SegmentType.VALUE.equals(segment.getType())) { return false; } else if (SegmentType.TEXT.equals(segment.getType())) { if (!Strings.containsOnlyWhitespace(segment.getConten... | SegmentBases { static boolean isStandaloneLine(List<SegmentBase> line) { boolean standaloneCandidate = false; for (SegmentBase segment : line) { if (SegmentType.VALUE.equals(segment.getType())) { return false; } else if (SegmentType.TEXT.equals(segment.getType())) { if (!Strings.containsOnlyWhitespace(segment.getConten... | SegmentBases { static boolean isStandaloneLine(List<SegmentBase> line) { boolean standaloneCandidate = false; for (SegmentBase segment : line) { if (SegmentType.VALUE.equals(segment.getType())) { return false; } else if (SegmentType.TEXT.equals(segment.getType())) { if (!Strings.containsOnlyWhitespace(segment.getConten... | SegmentBases { static boolean isStandaloneLine(List<SegmentBase> line) { boolean standaloneCandidate = false; for (SegmentBase segment : line) { if (SegmentType.VALUE.equals(segment.getType())) { return false; } else if (SegmentType.TEXT.equals(segment.getType())) { if (!Strings.containsOnlyWhitespace(segment.getConten... |
@Test public void testClearData() { EnhancedStatsCollector collector = new EnhancedStatsCollector(); Mustache mustache = MustacheEngineBuilder.newBuilder() .addMustacheListener(collector).build() .compileMustache("bar", "BAR"); mustache.render(null); assertEquals(1, collector.getStats(mustache).getFinished()); collecto... | public void clearData() { data.clear(); } | EnhancedStatsCollector extends AbstractStatsCollector { public void clearData() { data.clear(); } } | EnhancedStatsCollector extends AbstractStatsCollector { public void clearData() { data.clear(); } EnhancedStatsCollector(); EnhancedStatsCollector(Predicate<String> templatePredicate,
TimeUnit timeUnit); } | EnhancedStatsCollector extends AbstractStatsCollector { public void clearData() { data.clear(); } EnhancedStatsCollector(); EnhancedStatsCollector(Predicate<String> templatePredicate,
TimeUnit timeUnit); @Override void renderingStarted(MustacheRenderingEvent event); @Override void renderingFinished(Mustach... | EnhancedStatsCollector extends AbstractStatsCollector { public void clearData() { data.clear(); } EnhancedStatsCollector(); EnhancedStatsCollector(Predicate<String> templatePredicate,
TimeUnit timeUnit); @Override void renderingStarted(MustacheRenderingEvent event); @Override void renderingFinished(Mustach... |
@Test public void testCustomPredicate() { EnhancedStatsCollector collector = new EnhancedStatsCollector( (t) -> false, TimeUnit.DAYS); Mustache mustache = MustacheEngineBuilder.newBuilder() .addMustacheListener(collector).build() .compileMustache("qux", "Oops"); mustache.render(null); assertNull(collector.getStats(must... | public Stats getStats(Mustache mustache) { Checker.checkArgumentNotNull(mustache); ConcurrentMap<Long, ExecutionData> times = data.getIfPresent(mustache .getGeneratedId()); if (times != null) { return parseData(mustache.getName(), mustache.getGeneratedId(), times.values()); } return null; } | EnhancedStatsCollector extends AbstractStatsCollector { public Stats getStats(Mustache mustache) { Checker.checkArgumentNotNull(mustache); ConcurrentMap<Long, ExecutionData> times = data.getIfPresent(mustache .getGeneratedId()); if (times != null) { return parseData(mustache.getName(), mustache.getGeneratedId(), times.... | EnhancedStatsCollector extends AbstractStatsCollector { public Stats getStats(Mustache mustache) { Checker.checkArgumentNotNull(mustache); ConcurrentMap<Long, ExecutionData> times = data.getIfPresent(mustache .getGeneratedId()); if (times != null) { return parseData(mustache.getName(), mustache.getGeneratedId(), times.... | EnhancedStatsCollector extends AbstractStatsCollector { public Stats getStats(Mustache mustache) { Checker.checkArgumentNotNull(mustache); ConcurrentMap<Long, ExecutionData> times = data.getIfPresent(mustache .getGeneratedId()); if (times != null) { return parseData(mustache.getName(), mustache.getGeneratedId(), times.... | EnhancedStatsCollector extends AbstractStatsCollector { public Stats getStats(Mustache mustache) { Checker.checkArgumentNotNull(mustache); ConcurrentMap<Long, ExecutionData> times = data.getIfPresent(mustache .getGeneratedId()); if (times != null) { return parseData(mustache.getName(), mustache.getGeneratedId(), times.... |
@Test public void testClearData() { SimpleStatsCollector collector = new SimpleStatsCollector(); Mustache mustache = MustacheEngineBuilder.newBuilder() .addMustacheListener(collector).build() .compileMustache("bar", "BAR"); mustache.render(null); assertEquals(1, collector.getSimpleStats("bar").getExecutions()); collect... | public void clearData() { data.clear(); } | SimpleStatsCollector extends AbstractStatsCollector { public void clearData() { data.clear(); } } | SimpleStatsCollector extends AbstractStatsCollector { public void clearData() { data.clear(); } SimpleStatsCollector(); SimpleStatsCollector(Predicate<String> templatePredicate,
TimeUnit timeUnit); } | SimpleStatsCollector extends AbstractStatsCollector { public void clearData() { data.clear(); } SimpleStatsCollector(); SimpleStatsCollector(Predicate<String> templatePredicate,
TimeUnit timeUnit); @Override void init(); @Override void renderingStarted(final MustacheRenderingEvent event); void clearData();... | SimpleStatsCollector extends AbstractStatsCollector { public void clearData() { data.clear(); } SimpleStatsCollector(); SimpleStatsCollector(Predicate<String> templatePredicate,
TimeUnit timeUnit); @Override void init(); @Override void renderingStarted(final MustacheRenderingEvent event); void clearData();... |
@Test public void testCustomPredicate() { SimpleStatsCollector collector = new SimpleStatsCollector((t) -> false, TimeUnit.DAYS); Mustache mustache = MustacheEngineBuilder.newBuilder() .addMustacheListener(collector).build() .compileMustache("qux", "Oops"); mustache.render(null); assertNull(collector.getSimpleStats("qu... | public SimpleStats getSimpleStats(String templateId) { ComputingCache<Long, AtomicLong> entry = data.getIfPresent(templateId); if (entry != null) { return new SimpleStats(templateId, entry.getAllPresent()); } return null; } | SimpleStatsCollector extends AbstractStatsCollector { public SimpleStats getSimpleStats(String templateId) { ComputingCache<Long, AtomicLong> entry = data.getIfPresent(templateId); if (entry != null) { return new SimpleStats(templateId, entry.getAllPresent()); } return null; } } | SimpleStatsCollector extends AbstractStatsCollector { public SimpleStats getSimpleStats(String templateId) { ComputingCache<Long, AtomicLong> entry = data.getIfPresent(templateId); if (entry != null) { return new SimpleStats(templateId, entry.getAllPresent()); } return null; } SimpleStatsCollector(); SimpleStatsCollec... | SimpleStatsCollector extends AbstractStatsCollector { public SimpleStats getSimpleStats(String templateId) { ComputingCache<Long, AtomicLong> entry = data.getIfPresent(templateId); if (entry != null) { return new SimpleStats(templateId, entry.getAllPresent()); } return null; } SimpleStatsCollector(); SimpleStatsCollec... | SimpleStatsCollector extends AbstractStatsCollector { public SimpleStats getSimpleStats(String templateId) { ComputingCache<Long, AtomicLong> entry = data.getIfPresent(templateId); if (entry != null) { return new SimpleStats(templateId, entry.getAllPresent()); } return null; } SimpleStatsCollector(); SimpleStatsCollec... |
@Test public void testConverter() { String pattern = "yyyy.MM.dd HH:mm:ss.SSS"; SimpleDateFormat format = new SimpleDateFormat(pattern); ObjectToDateConverter converter = new ObjectToDateConverter(pattern); Date now = new Date(); Calendar cal = Calendar.getInstance(); Calendar midnight = Calendar.getInstance(); midnigh... | @Override public Date convert(Object value) { Date converted = null; if (value instanceof Date) { converted = (Date) value; } else if (value instanceof Calendar) { converted = ((Calendar) value).getTime(); } else if (value instanceof LocalDateTime) { converted = Date.from(((LocalDateTime) value) .atZone(ZoneId.systemDe... | ObjectToDateConverter implements Converter<Object, Date> { @Override public Date convert(Object value) { Date converted = null; if (value instanceof Date) { converted = (Date) value; } else if (value instanceof Calendar) { converted = ((Calendar) value).getTime(); } else if (value instanceof LocalDateTime) { converted ... | ObjectToDateConverter implements Converter<Object, Date> { @Override public Date convert(Object value) { Date converted = null; if (value instanceof Date) { converted = (Date) value; } else if (value instanceof Calendar) { converted = ((Calendar) value).getTime(); } else if (value instanceof LocalDateTime) { converted ... | ObjectToDateConverter implements Converter<Object, Date> { @Override public Date convert(Object value) { Date converted = null; if (value instanceof Date) { converted = (Date) value; } else if (value instanceof Calendar) { converted = ((Calendar) value).getTime(); } else if (value instanceof LocalDateTime) { converted ... | ObjectToDateConverter implements Converter<Object, Date> { @Override public Date convert(Object value) { Date converted = null; if (value instanceof Date) { converted = (Date) value; } else if (value instanceof Calendar) { converted = ((Calendar) value).getTime(); } else if (value instanceof LocalDateTime) { converted ... |
@SuppressWarnings("unchecked") @Test public void testInterpolation() { MustacheEngine engine = MustacheEngineBuilder.newBuilder() .addContextConverter(decorate(String.class) .compute("reverse", string -> new StringBuilder(string).reverse().toString()).build()) .addContextConverter(decorate(Hammer.class).put("translate"... | public static <T> Builder<T> decorate(Class<T> delegateType) { return decorate(o -> (delegateType.isAssignableFrom(Decorator.unwrap(o).getClass()))); } | DecoratorConverter extends AbstractConfigurationAware implements ContextConverter { public static <T> Builder<T> decorate(Class<T> delegateType) { return decorate(o -> (delegateType.isAssignableFrom(Decorator.unwrap(o).getClass()))); } } | DecoratorConverter extends AbstractConfigurationAware implements ContextConverter { public static <T> Builder<T> decorate(Class<T> delegateType) { return decorate(o -> (delegateType.isAssignableFrom(Decorator.unwrap(o).getClass()))); } private DecoratorConverter(Predicate<Object> test, String delegateKey, Map<String, ... | DecoratorConverter extends AbstractConfigurationAware implements ContextConverter { public static <T> Builder<T> decorate(Class<T> delegateType) { return decorate(o -> (delegateType.isAssignableFrom(Decorator.unwrap(o).getClass()))); } private DecoratorConverter(Predicate<Object> test, String delegateKey, Map<String, ... | DecoratorConverter extends AbstractConfigurationAware implements ContextConverter { public static <T> Builder<T> decorate(Class<T> delegateType) { return decorate(o -> (delegateType.isAssignableFrom(Decorator.unwrap(o).getClass()))); } private DecoratorConverter(Predicate<Object> test, String delegateKey, Map<String, ... |
@Test public void testGetDelegate() { MustacheEngine engine = MustacheEngineBuilder.newBuilder() .addContextConverter(decorate(Hammer.class).compute("name", h -> h.getName().toUpperCase()).build()) .build(); Hammer hammer = new Hammer(); assertEquals("EDGAR vs Edgar", engine.compileMustache("{{name}} vs {{delegate.name... | public static <T> Builder<T> decorate(Class<T> delegateType) { return decorate(o -> (delegateType.isAssignableFrom(Decorator.unwrap(o).getClass()))); } | DecoratorConverter extends AbstractConfigurationAware implements ContextConverter { public static <T> Builder<T> decorate(Class<T> delegateType) { return decorate(o -> (delegateType.isAssignableFrom(Decorator.unwrap(o).getClass()))); } } | DecoratorConverter extends AbstractConfigurationAware implements ContextConverter { public static <T> Builder<T> decorate(Class<T> delegateType) { return decorate(o -> (delegateType.isAssignableFrom(Decorator.unwrap(o).getClass()))); } private DecoratorConverter(Predicate<Object> test, String delegateKey, Map<String, ... | DecoratorConverter extends AbstractConfigurationAware implements ContextConverter { public static <T> Builder<T> decorate(Class<T> delegateType) { return decorate(o -> (delegateType.isAssignableFrom(Decorator.unwrap(o).getClass()))); } private DecoratorConverter(Predicate<Object> test, String delegateKey, Map<String, ... | DecoratorConverter extends AbstractConfigurationAware implements ContextConverter { public static <T> Builder<T> decorate(Class<T> delegateType) { return decorate(o -> (delegateType.isAssignableFrom(Decorator.unwrap(o).getClass()))); } private DecoratorConverter(Predicate<Object> test, String delegateKey, Map<String, ... |
@Test public void testReplace() { assertEquals("foobar", Strings.replace("foo:bar", ":", "")); } | public static String replace(String text, String search, String replacement) { if (isEmpty(text) || isEmpty(search) || replacement == null) { return text; } int start = 0; int end = text.indexOf(search, start); if (end == -1) { return text; } StringBuilder builder = new StringBuilder(); while (end != -1) { builder.appe... | Strings { public static String replace(String text, String search, String replacement) { if (isEmpty(text) || isEmpty(search) || replacement == null) { return text; } int start = 0; int end = text.indexOf(search, start); if (end == -1) { return text; } StringBuilder builder = new StringBuilder(); while (end != -1) { bu... | Strings { public static String replace(String text, String search, String replacement) { if (isEmpty(text) || isEmpty(search) || replacement == null) { return text; } int start = 0; int end = text.indexOf(search, start); if (end == -1) { return text; } StringBuilder builder = new StringBuilder(); while (end != -1) { bu... | Strings { public static String replace(String text, String search, String replacement) { if (isEmpty(text) || isEmpty(search) || replacement == null) { return text; } int start = 0; int end = text.indexOf(search, start); if (end == -1) { return text; } StringBuilder builder = new StringBuilder(); while (end != -1) { bu... | Strings { public static String replace(String text, String search, String replacement) { if (isEmpty(text) || isEmpty(search) || replacement == null) { return text; } int start = 0; int end = text.indexOf(search, start); if (end == -1) { return text; } StringBuilder builder = new StringBuilder(); while (end != -1) { bu... |
@Test public void testLogHelper() { String name = "MyLogger"; TestLoggerAdapter adapter = new TestLoggerAdapter(name); MustacheEngine engine = MustacheEngineBuilder.newBuilder() .registerHelpers(HelpersBuilder.empty() .add("log", LogHelper.builder().setDefaultLevel(Level.INFO) .setLoggerAdapter(adapter).build()) .build... | public LogHelper(LoggerAdapter adapter, Level defaultLevel, boolean appendTemplateInfo) { Checker.checkArgumentsNotNull(adapter, defaultLevel); this.defaultLevel = defaultLevel; this.adapter = adapter; this.appendTemplateInfo = appendTemplateInfo; } | LogHelper extends BasicValueHelper { public LogHelper(LoggerAdapter adapter, Level defaultLevel, boolean appendTemplateInfo) { Checker.checkArgumentsNotNull(adapter, defaultLevel); this.defaultLevel = defaultLevel; this.adapter = adapter; this.appendTemplateInfo = appendTemplateInfo; } } | LogHelper extends BasicValueHelper { public LogHelper(LoggerAdapter adapter, Level defaultLevel, boolean appendTemplateInfo) { Checker.checkArgumentsNotNull(adapter, defaultLevel); this.defaultLevel = defaultLevel; this.adapter = adapter; this.appendTemplateInfo = appendTemplateInfo; } LogHelper(LoggerAdapter adapter, ... | LogHelper extends BasicValueHelper { public LogHelper(LoggerAdapter adapter, Level defaultLevel, boolean appendTemplateInfo) { Checker.checkArgumentsNotNull(adapter, defaultLevel); this.defaultLevel = defaultLevel; this.adapter = adapter; this.appendTemplateInfo = appendTemplateInfo; } LogHelper(LoggerAdapter adapter, ... | LogHelper extends BasicValueHelper { public LogHelper(LoggerAdapter adapter, Level defaultLevel, boolean appendTemplateInfo) { Checker.checkArgumentsNotNull(adapter, defaultLevel); this.defaultLevel = defaultLevel; this.adapter = adapter; this.appendTemplateInfo = appendTemplateInfo; } LogHelper(LoggerAdapter adapter, ... |
@Test public void testLogHelperValidation() { final MustacheEngine engine = MustacheEngineBuilder.newBuilder() .registerHelpers(HelpersBuilder.empty() .add("log", LogHelper.builder().build()).build()) .build(); MustacheExceptionAssert .expect(MustacheProblem.COMPILE_HELPER_VALIDATION_FAILURE) .check(() -> engine.compil... | public static Builder builder() { return new Builder(); } | LogHelper extends BasicValueHelper { public static Builder builder() { return new Builder(); } } | LogHelper extends BasicValueHelper { public static Builder builder() { return new Builder(); } LogHelper(LoggerAdapter adapter, Level defaultLevel,
boolean appendTemplateInfo); } | LogHelper extends BasicValueHelper { public static Builder builder() { return new Builder(); } LogHelper(LoggerAdapter adapter, Level defaultLevel,
boolean appendTemplateInfo); @Override void execute(Options options); static Builder builder(); } | LogHelper extends BasicValueHelper { public static Builder builder() { return new Builder(); } LogHelper(LoggerAdapter adapter, Level defaultLevel,
boolean appendTemplateInfo); @Override void execute(Options options); static Builder builder(); } |
@SuppressWarnings("unchecked") @Test public void testHelper() { final MustacheEngine engine = MustacheEngineBuilder.newBuilder() .registerHelper("decorateCat", decorate(Cat.class).put("const", "Cat") .compute("name", cat -> cat.getName().toUpperCase()) .compute("overweight", (cat) -> cat.getWeight() > 4500 ? cat.getWei... | public static <T> Builder<T> decorate(Class<T> delegateType) { return new Builder<>(o -> delegateType.isAssignableFrom(o.getClass())); } | DecoratorHelper extends BasicSectionHelper { public static <T> Builder<T> decorate(Class<T> delegateType) { return new Builder<>(o -> delegateType.isAssignableFrom(o.getClass())); } } | DecoratorHelper extends BasicSectionHelper { public static <T> Builder<T> decorate(Class<T> delegateType) { return new Builder<>(o -> delegateType.isAssignableFrom(o.getClass())); } private DecoratorHelper(Predicate<Object> test, Map<String, Function<T, Object>> mappings, String delegateKey); } | DecoratorHelper extends BasicSectionHelper { public static <T> Builder<T> decorate(Class<T> delegateType) { return new Builder<>(o -> delegateType.isAssignableFrom(o.getClass())); } private DecoratorHelper(Predicate<Object> test, Map<String, Function<T, Object>> mappings, String delegateKey); static Builder<T> decorat... | DecoratorHelper extends BasicSectionHelper { public static <T> Builder<T> decorate(Class<T> delegateType) { return new Builder<>(o -> delegateType.isAssignableFrom(o.getClass())); } private DecoratorHelper(Predicate<Object> test, Map<String, Function<T, Object>> mappings, String delegateKey); static Builder<T> decorat... |
@Test public void testEqualsHelper() { MustacheEngine engine = MustacheEngineBuilder.newBuilder() .addGlobalData("archiveType", ArchiveType.class) .registerHelpers(HelpersBuilder.empty().addIsEqual() .addIsNotEqual().build()) .build(); assertEquals("EQUALS", engine.compileMustache("equals_helper1", "{{#isEq this.age th... | public EqualsHelper() { this(false); } | EqualsHelper extends BasicSectionHelper { public EqualsHelper() { this(false); } } | EqualsHelper extends BasicSectionHelper { public EqualsHelper() { this(false); } EqualsHelper(); EqualsHelper(boolean testInequality); } | EqualsHelper extends BasicSectionHelper { public EqualsHelper() { this(false); } EqualsHelper(); EqualsHelper(boolean testInequality); @Override void execute(Options options); } | EqualsHelper extends BasicSectionHelper { public EqualsHelper() { this(false); } EqualsHelper(); EqualsHelper(boolean testInequality); @Override void execute(Options options); } |
@Test public void testHelper() { final MustacheEngine engine = MustacheEngineBuilder.newBuilder() .registerHelpers(HelpersBuilder.empty().addInvoke().build()) .build(); List<String> list = ImmutableList.of("foo", "bar", "baz"); Map<String, Object> data = ImmutableMap.of("string", "foo", "list", list); assertEquals("oo"... | public static InvokeHelper of(String defaultMethodName) { return new InvokeHelper(null, defaultMethodName); } | InvokeHelper extends BasicHelper { public static InvokeHelper of(String defaultMethodName) { return new InvokeHelper(null, defaultMethodName); } } | InvokeHelper extends BasicHelper { public static InvokeHelper of(String defaultMethodName) { return new InvokeHelper(null, defaultMethodName); } InvokeHelper(); InvokeHelper(ClassLoader classLoader); InvokeHelper(ClassLoader classLoader, String defaultMethodName); } | InvokeHelper extends BasicHelper { public static InvokeHelper of(String defaultMethodName) { return new InvokeHelper(null, defaultMethodName); } InvokeHelper(); InvokeHelper(ClassLoader classLoader); InvokeHelper(ClassLoader classLoader, String defaultMethodName); static InvokeHelper of(String defaultMethodName); @Ov... | InvokeHelper extends BasicHelper { public static InvokeHelper of(String defaultMethodName) { return new InvokeHelper(null, defaultMethodName); } InvokeHelper(); InvokeHelper(ClassLoader classLoader); InvokeHelper(ClassLoader classLoader, String defaultMethodName); static InvokeHelper of(String defaultMethodName); @Ov... |
@Test public void testDefaultMethodName() { MustacheEngine engine = MustacheEngineBuilder.newBuilder() .registerHelpers(HelpersBuilder.empty() .add("substring", InvokeHelper.of("substring")) .build()) .build(); assertEquals("345", engine .compileMustache("invoke_defmethodname_01", "{{substring 3}}") .render("012345"));... | public static InvokeHelper of(String defaultMethodName) { return new InvokeHelper(null, defaultMethodName); } | InvokeHelper extends BasicHelper { public static InvokeHelper of(String defaultMethodName) { return new InvokeHelper(null, defaultMethodName); } } | InvokeHelper extends BasicHelper { public static InvokeHelper of(String defaultMethodName) { return new InvokeHelper(null, defaultMethodName); } InvokeHelper(); InvokeHelper(ClassLoader classLoader); InvokeHelper(ClassLoader classLoader, String defaultMethodName); } | InvokeHelper extends BasicHelper { public static InvokeHelper of(String defaultMethodName) { return new InvokeHelper(null, defaultMethodName); } InvokeHelper(); InvokeHelper(ClassLoader classLoader); InvokeHelper(ClassLoader classLoader, String defaultMethodName); static InvokeHelper of(String defaultMethodName); @Ov... | InvokeHelper extends BasicHelper { public static InvokeHelper of(String defaultMethodName) { return new InvokeHelper(null, defaultMethodName); } InvokeHelper(); InvokeHelper(ClassLoader classLoader); InvokeHelper(ClassLoader classLoader, String defaultMethodName); static InvokeHelper of(String defaultMethodName); @Ov... |
@Test public void testNullCheckHelper() { MustacheEngine engine = MustacheEngineBuilder .newBuilder() .registerHelpers( HelpersBuilder.empty() .addIsNull() .addIsNotNull() .build()).build(); assertEquals( "NULL|NOTNULL", engine.compileMustache( "nullcheck_helper1", "{{#isNull this.getNull}}NULL{{/isNull}}|{{#isNotNull ... | public NullCheckHelper() { this(false); } | NullCheckHelper extends MatchingSectionHelper { public NullCheckHelper() { this(false); } } | NullCheckHelper extends MatchingSectionHelper { public NullCheckHelper() { this(false); } NullCheckHelper(); NullCheckHelper(boolean testNotNull); } | NullCheckHelper extends MatchingSectionHelper { public NullCheckHelper() { this(false); } NullCheckHelper(); NullCheckHelper(boolean testNotNull); } | NullCheckHelper extends MatchingSectionHelper { public NullCheckHelper() { this(false); } NullCheckHelper(); NullCheckHelper(boolean testNotNull); } |
@Test public void testHelper() throws InterruptedException { final MustacheEngine engine = MustacheEngineBuilder.newBuilder() .registerHelpers(HelpersBuilder.empty().addCache().build()) .build(); CacheHelper cacheHelper = (CacheHelper) engine.getConfiguration() .getHelpers().get(HelpersBuilder.CACHE); final AtomicInteg... | public void invalidateFragments() { if (fragments == null) { return; } fragments.clear(); } | CacheHelper extends BasicSectionHelper { public void invalidateFragments() { if (fragments == null) { return; } fragments.clear(); } } | CacheHelper extends BasicSectionHelper { public void invalidateFragments() { if (fragments == null) { return; } fragments.clear(); } } | CacheHelper extends BasicSectionHelper { public void invalidateFragments() { if (fragments == null) { return; } fragments.clear(); } @Override void execute(Options options); void init(); @Override Set<ConfigurationKey> getConfigurationKeys(); @Override void validate(HelperDefinition definition); void invalidateFragmen... | CacheHelper extends BasicSectionHelper { public void invalidateFragments() { if (fragments == null) { return; } fragments.clear(); } @Override void execute(Options options); void init(); @Override Set<ConfigurationKey> getConfigurationKeys(); @Override void validate(HelperDefinition definition); void invalidateFragmen... |
@Test public void testBuiltin() { Map<String, Helper> helpers = HelpersBuilder.builtin().build(); assertEquals(5, helpers.size()); assertTrue(helpers.containsKey(HelpersBuilder.EACH)); assertTrue(helpers.containsKey(HelpersBuilder.IF)); assertTrue(helpers.containsKey(HelpersBuilder.IS)); assertTrue(helpers.containsKey(... | public static HelpersBuilder builtin() { return empty().addBuiltin(); } | HelpersBuilder { public static HelpersBuilder builtin() { return empty().addBuiltin(); } } | HelpersBuilder { public static HelpersBuilder builtin() { return empty().addBuiltin(); } private HelpersBuilder(); } | HelpersBuilder { public static HelpersBuilder builtin() { return empty().addBuiltin(); } private HelpersBuilder(); HelpersBuilder add(String name, Helper helper); HelpersBuilder addEach(); HelpersBuilder addIf(); HelpersBuilder addIf(String elseStartDelimiter, String elseEndDelimiter); HelpersBuilder addUnless(); Help... | HelpersBuilder { public static HelpersBuilder builtin() { return empty().addBuiltin(); } private HelpersBuilder(); HelpersBuilder add(String name, Helper helper); HelpersBuilder addEach(); HelpersBuilder addIf(); HelpersBuilder addIf(String elseStartDelimiter, String elseEndDelimiter); HelpersBuilder addUnless(); Help... |
@Test public void testExtra() { Map<String, Helper> helpers = HelpersBuilder.extra().build(); assertEquals(27, helpers.size()); assertTrue(helpers.containsKey(HelpersBuilder.EMBED)); assertTrue(helpers.containsKey(HelpersBuilder.INCLUDE)); assertTrue(helpers.containsKey(HelpersBuilder.IS_EQUAL)); assertTrue(helpers.con... | public static HelpersBuilder extra() { return empty().addExtra(); } | HelpersBuilder { public static HelpersBuilder extra() { return empty().addExtra(); } } | HelpersBuilder { public static HelpersBuilder extra() { return empty().addExtra(); } private HelpersBuilder(); } | HelpersBuilder { public static HelpersBuilder extra() { return empty().addExtra(); } private HelpersBuilder(); HelpersBuilder add(String name, Helper helper); HelpersBuilder addEach(); HelpersBuilder addIf(); HelpersBuilder addIf(String elseStartDelimiter, String elseEndDelimiter); HelpersBuilder addUnless(); HelpersB... | HelpersBuilder { public static HelpersBuilder extra() { return empty().addExtra(); } private HelpersBuilder(); HelpersBuilder add(String name, Helper helper); HelpersBuilder addEach(); HelpersBuilder addIf(); HelpersBuilder addIf(String elseStartDelimiter, String elseEndDelimiter); HelpersBuilder addUnless(); HelpersB... |
@Test public void testContainsWhitespace() { assertTrue(Strings.containsWhitespace("foo bar")); assertTrue(Strings .containsWhitespace(System.getProperty("line.separator"))); assertFalse(Strings.containsWhitespace("foobar")); } | public static boolean containsWhitespace(String text) { if (isEmpty(text)) { return false; } for (int i = 0; i < text.length(); i++) { if (Character.isWhitespace(text.charAt(i))) { return true; } } return false; } | Strings { public static boolean containsWhitespace(String text) { if (isEmpty(text)) { return false; } for (int i = 0; i < text.length(); i++) { if (Character.isWhitespace(text.charAt(i))) { return true; } } return false; } } | Strings { public static boolean containsWhitespace(String text) { if (isEmpty(text)) { return false; } for (int i = 0; i < text.length(); i++) { if (Character.isWhitespace(text.charAt(i))) { return true; } } return false; } private Strings(); } | Strings { public static boolean containsWhitespace(String text) { if (isEmpty(text)) { return false; } for (int i = 0; i < text.length(); i++) { if (Character.isWhitespace(text.charAt(i))) { return true; } } return false; } private Strings(); static boolean isStringLiteralSeparator(char character); static boolean isEm... | Strings { public static boolean containsWhitespace(String text) { if (isEmpty(text)) { return false; } for (int i = 0; i < text.length(); i++) { if (Character.isWhitespace(text.charAt(i))) { return true; } } return false; } private Strings(); static boolean isStringLiteralSeparator(char character); static boolean isEm... |
@Test public void testCustomConverter() { final Calendar day = Calendar.getInstance(); day.set(Calendar.YEAR, day.get(Calendar.YEAR) - 1); day.set(Calendar.MONTH, day.get(Calendar.MONTH) - 1); MustacheEngine engine = MustacheEngineBuilder.newBuilder() .omitServiceLoaderConfigurationExtensions() .setLocaleSupport(FixedL... | public static Builder builder() { return new Builder(); } | PrettyTimeHelper extends LocaleAwareValueHelper { public static Builder builder() { return new Builder(); } } | PrettyTimeHelper extends LocaleAwareValueHelper { public static Builder builder() { return new Builder(); } PrettyTimeHelper(); PrettyTimeHelper(PrettyTimeFactory prettyTimeFactory); PrettyTimeHelper(PrettyTimeFactory factory,
Converter<Object, Date> converter); } | PrettyTimeHelper extends LocaleAwareValueHelper { public static Builder builder() { return new Builder(); } PrettyTimeHelper(); PrettyTimeHelper(PrettyTimeFactory prettyTimeFactory); PrettyTimeHelper(PrettyTimeFactory factory,
Converter<Object, Date> converter); @Override void init(Configuration configura... | PrettyTimeHelper extends LocaleAwareValueHelper { public static Builder builder() { return new Builder(); } PrettyTimeHelper(); PrettyTimeHelper(PrettyTimeFactory prettyTimeFactory); PrettyTimeHelper(PrettyTimeFactory factory,
Converter<Object, Date> converter); @Override void init(Configuration configura... |
@Test public void availabilityOfTemplateInDefaultLocation() throws Exception { assertThat(provider.isTemplateAvailable("home", environment, getClass().getClassLoader(), resourceLoader), is(true)); assertThat(provider.isTemplateAvailable("prefix/prefixed", environment, getClass().getClassLoader(), resourceLoader), is(tr... | public boolean isTemplateAvailable(final String view, final Environment environment, final ClassLoader classLoader, final ResourceLoader resourceLoader) { if (ClassUtils.isPresent("org.trimou.Mustache", classLoader)) { final PropertyResolver resolver = new RelaxedPropertyResolver(environment, TrimouProperties.PROPERTY_... | TrimouTemplateAvailabilityProvider implements TemplateAvailabilityProvider { public boolean isTemplateAvailable(final String view, final Environment environment, final ClassLoader classLoader, final ResourceLoader resourceLoader) { if (ClassUtils.isPresent("org.trimou.Mustache", classLoader)) { final PropertyResolver r... | TrimouTemplateAvailabilityProvider implements TemplateAvailabilityProvider { public boolean isTemplateAvailable(final String view, final Environment environment, final ClassLoader classLoader, final ResourceLoader resourceLoader) { if (ClassUtils.isPresent("org.trimou.Mustache", classLoader)) { final PropertyResolver r... | TrimouTemplateAvailabilityProvider implements TemplateAvailabilityProvider { public boolean isTemplateAvailable(final String view, final Environment environment, final ClassLoader classLoader, final ResourceLoader resourceLoader) { if (ClassUtils.isPresent("org.trimou.Mustache", classLoader)) { final PropertyResolver r... | TrimouTemplateAvailabilityProvider implements TemplateAvailabilityProvider { public boolean isTemplateAvailable(final String view, final Environment environment, final ClassLoader classLoader, final ResourceLoader resourceLoader) { if (ClassUtils.isPresent("org.trimou.Mustache", classLoader)) { final PropertyResolver r... |
@Test public void availabilityOfTemplateThatDoesNotExist() throws Exception { assertThat(provider.isTemplateAvailable("unknown", environment, getClass().getClassLoader(), resourceLoader), is(false)); } | public boolean isTemplateAvailable(final String view, final Environment environment, final ClassLoader classLoader, final ResourceLoader resourceLoader) { if (ClassUtils.isPresent("org.trimou.Mustache", classLoader)) { final PropertyResolver resolver = new RelaxedPropertyResolver(environment, TrimouProperties.PROPERTY_... | TrimouTemplateAvailabilityProvider implements TemplateAvailabilityProvider { public boolean isTemplateAvailable(final String view, final Environment environment, final ClassLoader classLoader, final ResourceLoader resourceLoader) { if (ClassUtils.isPresent("org.trimou.Mustache", classLoader)) { final PropertyResolver r... | TrimouTemplateAvailabilityProvider implements TemplateAvailabilityProvider { public boolean isTemplateAvailable(final String view, final Environment environment, final ClassLoader classLoader, final ResourceLoader resourceLoader) { if (ClassUtils.isPresent("org.trimou.Mustache", classLoader)) { final PropertyResolver r... | TrimouTemplateAvailabilityProvider implements TemplateAvailabilityProvider { public boolean isTemplateAvailable(final String view, final Environment environment, final ClassLoader classLoader, final ResourceLoader resourceLoader) { if (ClassUtils.isPresent("org.trimou.Mustache", classLoader)) { final PropertyResolver r... | TrimouTemplateAvailabilityProvider implements TemplateAvailabilityProvider { public boolean isTemplateAvailable(final String view, final Environment environment, final ClassLoader classLoader, final ResourceLoader resourceLoader) { if (ClassUtils.isPresent("org.trimou.Mustache", classLoader)) { final PropertyResolver r... |
@Test public void availabilityOfTemplateWithCustomPrefix() throws Exception { environment.setProperty("trimou.prefix", "classpath:/custom-templates/"); assertThat(provider.isTemplateAvailable("custom", environment, getClass().getClassLoader(), resourceLoader), is(true)); } | public boolean isTemplateAvailable(final String view, final Environment environment, final ClassLoader classLoader, final ResourceLoader resourceLoader) { if (ClassUtils.isPresent("org.trimou.Mustache", classLoader)) { final PropertyResolver resolver = new RelaxedPropertyResolver(environment, TrimouProperties.PROPERTY_... | TrimouTemplateAvailabilityProvider implements TemplateAvailabilityProvider { public boolean isTemplateAvailable(final String view, final Environment environment, final ClassLoader classLoader, final ResourceLoader resourceLoader) { if (ClassUtils.isPresent("org.trimou.Mustache", classLoader)) { final PropertyResolver r... | TrimouTemplateAvailabilityProvider implements TemplateAvailabilityProvider { public boolean isTemplateAvailable(final String view, final Environment environment, final ClassLoader classLoader, final ResourceLoader resourceLoader) { if (ClassUtils.isPresent("org.trimou.Mustache", classLoader)) { final PropertyResolver r... | TrimouTemplateAvailabilityProvider implements TemplateAvailabilityProvider { public boolean isTemplateAvailable(final String view, final Environment environment, final ClassLoader classLoader, final ResourceLoader resourceLoader) { if (ClassUtils.isPresent("org.trimou.Mustache", classLoader)) { final PropertyResolver r... | TrimouTemplateAvailabilityProvider implements TemplateAvailabilityProvider { public boolean isTemplateAvailable(final String view, final Environment environment, final ClassLoader classLoader, final ResourceLoader resourceLoader) { if (ClassUtils.isPresent("org.trimou.Mustache", classLoader)) { final PropertyResolver r... |
@Test public void availabilityOfTemplateWithCustomSuffix() throws Exception { environment.setProperty("trimou.suffix", ".html"); assertThat(provider.isTemplateAvailable("suffixed", environment, getClass().getClassLoader(), resourceLoader), is(true)); } | public boolean isTemplateAvailable(final String view, final Environment environment, final ClassLoader classLoader, final ResourceLoader resourceLoader) { if (ClassUtils.isPresent("org.trimou.Mustache", classLoader)) { final PropertyResolver resolver = new RelaxedPropertyResolver(environment, TrimouProperties.PROPERTY_... | TrimouTemplateAvailabilityProvider implements TemplateAvailabilityProvider { public boolean isTemplateAvailable(final String view, final Environment environment, final ClassLoader classLoader, final ResourceLoader resourceLoader) { if (ClassUtils.isPresent("org.trimou.Mustache", classLoader)) { final PropertyResolver r... | TrimouTemplateAvailabilityProvider implements TemplateAvailabilityProvider { public boolean isTemplateAvailable(final String view, final Environment environment, final ClassLoader classLoader, final ResourceLoader resourceLoader) { if (ClassUtils.isPresent("org.trimou.Mustache", classLoader)) { final PropertyResolver r... | TrimouTemplateAvailabilityProvider implements TemplateAvailabilityProvider { public boolean isTemplateAvailable(final String view, final Environment environment, final ClassLoader classLoader, final ResourceLoader resourceLoader) { if (ClassUtils.isPresent("org.trimou.Mustache", classLoader)) { final PropertyResolver r... | TrimouTemplateAvailabilityProvider implements TemplateAvailabilityProvider { public boolean isTemplateAvailable(final String view, final Environment environment, final ClassLoader classLoader, final ResourceLoader resourceLoader) { if (ClassUtils.isPresent("org.trimou.Mustache", classLoader)) { final PropertyResolver r... |
@Test public void testNulltIsResolved() { HttpServletRequestResolver resolver = new HttpServletRequestResolver(); assertNull(resolver.resolve("whatever", "request", null)); assertNull(resolver.resolve(null, "foo", null)); } | @Override public Object resolve(Object contextObject, String name, ResolutionContext context) { if (contextObject != null) { return null; } if (NAME_REQUEST.equals(name)) { HttpServletRequestWrapper wrapper = REQUEST_WRAPPER.get(); if (wrapper == null) { HttpServletRequest request = RequestHolder.getCurrentRequest(); i... | HttpServletRequestResolver extends AbstractResolver implements MustacheListener, Validateable { @Override public Object resolve(Object contextObject, String name, ResolutionContext context) { if (contextObject != null) { return null; } if (NAME_REQUEST.equals(name)) { HttpServletRequestWrapper wrapper = REQUEST_WRAPPER... | HttpServletRequestResolver extends AbstractResolver implements MustacheListener, Validateable { @Override public Object resolve(Object contextObject, String name, ResolutionContext context) { if (contextObject != null) { return null; } if (NAME_REQUEST.equals(name)) { HttpServletRequestWrapper wrapper = REQUEST_WRAPPER... | HttpServletRequestResolver extends AbstractResolver implements MustacheListener, Validateable { @Override public Object resolve(Object contextObject, String name, ResolutionContext context) { if (contextObject != null) { return null; } if (NAME_REQUEST.equals(name)) { HttpServletRequestWrapper wrapper = REQUEST_WRAPPER... | HttpServletRequestResolver extends AbstractResolver implements MustacheListener, Validateable { @Override public Object resolve(Object contextObject, String name, ResolutionContext context) { if (contextObject != null) { return null; } if (NAME_REQUEST.equals(name)) { HttpServletRequestWrapper wrapper = REQUEST_WRAPPER... |
@Test public void testResolution() { JsonElementResolver resolver = new JsonElementResolver(); ResolutionContext ctx = new DummyResolutionContext(); MustacheEngineBuilder.newBuilder() .omitServiceLoaderConfigurationExtensions() .setProperty(JsonElementResolver.UNWRAP_JSON_PRIMITIVE_KEY, true) .setProperty(GsonValueConv... | @Override public Object resolve(Object contextObject, String name, ResolutionContext context) { if (contextObject == null || !(contextObject instanceof JsonElement)) { return null; } JsonElement element = (JsonElement) contextObject; if (element.isJsonArray() && isAnIndex(name)) { JsonArray jsonArray = (JsonArray) elem... | JsonElementResolver extends IndexResolver { @Override public Object resolve(Object contextObject, String name, ResolutionContext context) { if (contextObject == null || !(contextObject instanceof JsonElement)) { return null; } JsonElement element = (JsonElement) contextObject; if (element.isJsonArray() && isAnIndex(nam... | JsonElementResolver extends IndexResolver { @Override public Object resolve(Object contextObject, String name, ResolutionContext context) { if (contextObject == null || !(contextObject instanceof JsonElement)) { return null; } JsonElement element = (JsonElement) contextObject; if (element.isJsonArray() && isAnIndex(nam... | JsonElementResolver extends IndexResolver { @Override public Object resolve(Object contextObject, String name, ResolutionContext context) { if (contextObject == null || !(contextObject instanceof JsonElement)) { return null; } JsonElement element = (JsonElement) contextObject; if (element.isJsonArray() && isAnIndex(nam... | JsonElementResolver extends IndexResolver { @Override public Object resolve(Object contextObject, String name, ResolutionContext context) { if (contextObject == null || !(contextObject instanceof JsonElement)) { return null; } JsonElement element = (JsonElement) contextObject; if (element.isJsonArray() && isAnIndex(nam... |
@Test public void testResolution() { JsonValueResolver resolver = new JsonValueResolver(); ResolutionContext ctx = new DummyResolutionContext(); MustacheEngineBuilder.newBuilder() .omitServiceLoaderConfigurationExtensions() .addResolver(resolver) .setProperty(JsonValueResolver.ENABLED_KEY, true).build(); assertNull(res... | @Override public Object resolve(Object contextObject, String name, ResolutionContext context) { if (contextObject == null || !(contextObject instanceof JsonValue)) { return null; } JsonValue jsonValue = (JsonValue) contextObject; if (ValueType.ARRAY.equals(jsonValue.getValueType()) && isAnIndex(name)) { JsonArray jsonA... | JsonValueResolver extends IndexResolver implements Validateable { @Override public Object resolve(Object contextObject, String name, ResolutionContext context) { if (contextObject == null || !(contextObject instanceof JsonValue)) { return null; } JsonValue jsonValue = (JsonValue) contextObject; if (ValueType.ARRAY.equa... | JsonValueResolver extends IndexResolver implements Validateable { @Override public Object resolve(Object contextObject, String name, ResolutionContext context) { if (contextObject == null || !(contextObject instanceof JsonValue)) { return null; } JsonValue jsonValue = (JsonValue) contextObject; if (ValueType.ARRAY.equa... | JsonValueResolver extends IndexResolver implements Validateable { @Override public Object resolve(Object contextObject, String name, ResolutionContext context) { if (contextObject == null || !(contextObject instanceof JsonValue)) { return null; } JsonValue jsonValue = (JsonValue) contextObject; if (ValueType.ARRAY.equa... | JsonValueResolver extends IndexResolver implements Validateable { @Override public Object resolve(Object contextObject, String name, ResolutionContext context) { if (contextObject == null || !(contextObject instanceof JsonValue)) { return null; } JsonValue jsonValue = (JsonValue) contextObject; if (ValueType.ARRAY.equa... |
@Test public void availabilityOfTemplateInDefaultLocation() throws Exception { final SpringResourceTemplateLocator loader = new SpringResourceTemplateLocator(); final Reader r1 = loader.locate("home"); assertThat(readContent(r1), is("home")); final Reader r2 = loader.locate("prefix/prefixed"); assertThat(readContent(r2... | public Reader locate(final String name) { final String resourceLocation = prefix + name + suffix; try { if (Strings.isEmpty(charset)) { return new InputStreamReader(resourceLoader.getResource(resourceLocation).getInputStream()); } return new InputStreamReader(resourceLoader.getResource(resourceLocation).getInputStream(... | SpringResourceTemplateLocator extends AbstractTemplateLocator implements ResourceLoaderAware { public Reader locate(final String name) { final String resourceLocation = prefix + name + suffix; try { if (Strings.isEmpty(charset)) { return new InputStreamReader(resourceLoader.getResource(resourceLocation).getInputStream(... | SpringResourceTemplateLocator extends AbstractTemplateLocator implements ResourceLoaderAware { public Reader locate(final String name) { final String resourceLocation = prefix + name + suffix; try { if (Strings.isEmpty(charset)) { return new InputStreamReader(resourceLoader.getResource(resourceLocation).getInputStream(... | SpringResourceTemplateLocator extends AbstractTemplateLocator implements ResourceLoaderAware { public Reader locate(final String name) { final String resourceLocation = prefix + name + suffix; try { if (Strings.isEmpty(charset)) { return new InputStreamReader(resourceLoader.getResource(resourceLocation).getInputStream(... | SpringResourceTemplateLocator extends AbstractTemplateLocator implements ResourceLoaderAware { public Reader locate(final String name) { final String resourceLocation = prefix + name + suffix; try { if (Strings.isEmpty(charset)) { return new InputStreamReader(resourceLoader.getResource(resourceLocation).getInputStream(... |
@Test public void availabilityOfTemplateThatDoesNotExist() throws Exception { final SpringResourceTemplateLocator loader = new SpringResourceTemplateLocator(); assertThat(loader.locate("unknown"), is(nullValue())); } | public Reader locate(final String name) { final String resourceLocation = prefix + name + suffix; try { if (Strings.isEmpty(charset)) { return new InputStreamReader(resourceLoader.getResource(resourceLocation).getInputStream()); } return new InputStreamReader(resourceLoader.getResource(resourceLocation).getInputStream(... | SpringResourceTemplateLocator extends AbstractTemplateLocator implements ResourceLoaderAware { public Reader locate(final String name) { final String resourceLocation = prefix + name + suffix; try { if (Strings.isEmpty(charset)) { return new InputStreamReader(resourceLoader.getResource(resourceLocation).getInputStream(... | SpringResourceTemplateLocator extends AbstractTemplateLocator implements ResourceLoaderAware { public Reader locate(final String name) { final String resourceLocation = prefix + name + suffix; try { if (Strings.isEmpty(charset)) { return new InputStreamReader(resourceLoader.getResource(resourceLocation).getInputStream(... | SpringResourceTemplateLocator extends AbstractTemplateLocator implements ResourceLoaderAware { public Reader locate(final String name) { final String resourceLocation = prefix + name + suffix; try { if (Strings.isEmpty(charset)) { return new InputStreamReader(resourceLoader.getResource(resourceLocation).getInputStream(... | SpringResourceTemplateLocator extends AbstractTemplateLocator implements ResourceLoaderAware { public Reader locate(final String name) { final String resourceLocation = prefix + name + suffix; try { if (Strings.isEmpty(charset)) { return new InputStreamReader(resourceLoader.getResource(resourceLocation).getInputStream(... |
@Test public void testContainsOnlyWhitespace() { assertTrue(Strings.containsOnlyWhitespace(" ")); assertTrue(Strings.containsOnlyWhitespace( " " + System.getProperty("line.separator"))); assertFalse(Strings.containsOnlyWhitespace(" !")); } | public static boolean containsOnlyWhitespace(String text) { if (isEmpty(text)) { return false; } for (int i = 0; i < text.length(); i++) { if (!Character.isWhitespace(text.charAt(i))) { return false; } } return true; } | Strings { public static boolean containsOnlyWhitespace(String text) { if (isEmpty(text)) { return false; } for (int i = 0; i < text.length(); i++) { if (!Character.isWhitespace(text.charAt(i))) { return false; } } return true; } } | Strings { public static boolean containsOnlyWhitespace(String text) { if (isEmpty(text)) { return false; } for (int i = 0; i < text.length(); i++) { if (!Character.isWhitespace(text.charAt(i))) { return false; } } return true; } private Strings(); } | Strings { public static boolean containsOnlyWhitespace(String text) { if (isEmpty(text)) { return false; } for (int i = 0; i < text.length(); i++) { if (!Character.isWhitespace(text.charAt(i))) { return false; } } return true; } private Strings(); static boolean isStringLiteralSeparator(char character); static boolean... | Strings { public static boolean containsOnlyWhitespace(String text) { if (isEmpty(text)) { return false; } for (int i = 0; i < text.length(); i++) { if (!Character.isWhitespace(text.charAt(i))) { return false; } } return true; } private Strings(); static boolean isStringLiteralSeparator(char character); static boolean... |
@Test public void availabilityOfTemplateWithCustomPrefix() throws Exception { final SpringResourceTemplateLocator loader = new SpringResourceTemplateLocator(1, "classpath:/custom-templates/", SpringResourceTemplateLocator.DEFAULT_SUFFIX); final Reader reader = loader.locate("custom"); assertThat(readContent(reader), is... | public Reader locate(final String name) { final String resourceLocation = prefix + name + suffix; try { if (Strings.isEmpty(charset)) { return new InputStreamReader(resourceLoader.getResource(resourceLocation).getInputStream()); } return new InputStreamReader(resourceLoader.getResource(resourceLocation).getInputStream(... | SpringResourceTemplateLocator extends AbstractTemplateLocator implements ResourceLoaderAware { public Reader locate(final String name) { final String resourceLocation = prefix + name + suffix; try { if (Strings.isEmpty(charset)) { return new InputStreamReader(resourceLoader.getResource(resourceLocation).getInputStream(... | SpringResourceTemplateLocator extends AbstractTemplateLocator implements ResourceLoaderAware { public Reader locate(final String name) { final String resourceLocation = prefix + name + suffix; try { if (Strings.isEmpty(charset)) { return new InputStreamReader(resourceLoader.getResource(resourceLocation).getInputStream(... | SpringResourceTemplateLocator extends AbstractTemplateLocator implements ResourceLoaderAware { public Reader locate(final String name) { final String resourceLocation = prefix + name + suffix; try { if (Strings.isEmpty(charset)) { return new InputStreamReader(resourceLoader.getResource(resourceLocation).getInputStream(... | SpringResourceTemplateLocator extends AbstractTemplateLocator implements ResourceLoaderAware { public Reader locate(final String name) { final String resourceLocation = prefix + name + suffix; try { if (Strings.isEmpty(charset)) { return new InputStreamReader(resourceLoader.getResource(resourceLocation).getInputStream(... |
@Test public void availabilityOfTemplateWithCustomSuffix() throws Exception { final SpringResourceTemplateLocator loader = new SpringResourceTemplateLocator(1, SpringResourceTemplateLocator.DEFAULT_PREFIX, ".html"); final Reader reader = loader.locate("suffixed"); assertThat(readContent(reader), is("suffixed")); } | public Reader locate(final String name) { final String resourceLocation = prefix + name + suffix; try { if (Strings.isEmpty(charset)) { return new InputStreamReader(resourceLoader.getResource(resourceLocation).getInputStream()); } return new InputStreamReader(resourceLoader.getResource(resourceLocation).getInputStream(... | SpringResourceTemplateLocator extends AbstractTemplateLocator implements ResourceLoaderAware { public Reader locate(final String name) { final String resourceLocation = prefix + name + suffix; try { if (Strings.isEmpty(charset)) { return new InputStreamReader(resourceLoader.getResource(resourceLocation).getInputStream(... | SpringResourceTemplateLocator extends AbstractTemplateLocator implements ResourceLoaderAware { public Reader locate(final String name) { final String resourceLocation = prefix + name + suffix; try { if (Strings.isEmpty(charset)) { return new InputStreamReader(resourceLoader.getResource(resourceLocation).getInputStream(... | SpringResourceTemplateLocator extends AbstractTemplateLocator implements ResourceLoaderAware { public Reader locate(final String name) { final String resourceLocation = prefix + name + suffix; try { if (Strings.isEmpty(charset)) { return new InputStreamReader(resourceLoader.getResource(resourceLocation).getInputStream(... | SpringResourceTemplateLocator extends AbstractTemplateLocator implements ResourceLoaderAware { public Reader locate(final String name) { final String resourceLocation = prefix + name + suffix; try { if (Strings.isEmpty(charset)) { return new InputStreamReader(resourceLoader.getResource(resourceLocation).getInputStream(... |
@Test public void cacheEnabled() throws Exception { assertThat(resolver.isCache(), is(true)); } | @Override public boolean isCache() { return engine.getConfiguration().getBooleanPropertyValue(EngineConfigurationKey.TEMPLATE_CACHE_ENABLED) && !engine.getConfiguration().getBooleanPropertyValue(EngineConfigurationKey.DEBUG_MODE) && super.isCache(); } | TrimouViewResolver extends AbstractTemplateViewResolver { @Override public boolean isCache() { return engine.getConfiguration().getBooleanPropertyValue(EngineConfigurationKey.TEMPLATE_CACHE_ENABLED) && !engine.getConfiguration().getBooleanPropertyValue(EngineConfigurationKey.DEBUG_MODE) && super.isCache(); } } | TrimouViewResolver extends AbstractTemplateViewResolver { @Override public boolean isCache() { return engine.getConfiguration().getBooleanPropertyValue(EngineConfigurationKey.TEMPLATE_CACHE_ENABLED) && !engine.getConfiguration().getBooleanPropertyValue(EngineConfigurationKey.DEBUG_MODE) && super.isCache(); } TrimouView... | TrimouViewResolver extends AbstractTemplateViewResolver { @Override public boolean isCache() { return engine.getConfiguration().getBooleanPropertyValue(EngineConfigurationKey.TEMPLATE_CACHE_ENABLED) && !engine.getConfiguration().getBooleanPropertyValue(EngineConfigurationKey.DEBUG_MODE) && super.isCache(); } TrimouView... | TrimouViewResolver extends AbstractTemplateViewResolver { @Override public boolean isCache() { return engine.getConfiguration().getBooleanPropertyValue(EngineConfigurationKey.TEMPLATE_CACHE_ENABLED) && !engine.getConfiguration().getBooleanPropertyValue(EngineConfigurationKey.DEBUG_MODE) && super.isCache(); } TrimouView... |
@Test public void testContainsOnlyDigits() { assertTrue(Strings.containsOnlyDigits("123")); assertFalse(Strings.containsOnlyDigits("5!")); } | public static boolean containsOnlyDigits(String text) { if (isEmpty(text)) { return false; } for (int i = 0; i < text.length(); i++) { if (!Character.isDigit(text.charAt(i))) { return false; } } return true; } | Strings { public static boolean containsOnlyDigits(String text) { if (isEmpty(text)) { return false; } for (int i = 0; i < text.length(); i++) { if (!Character.isDigit(text.charAt(i))) { return false; } } return true; } } | Strings { public static boolean containsOnlyDigits(String text) { if (isEmpty(text)) { return false; } for (int i = 0; i < text.length(); i++) { if (!Character.isDigit(text.charAt(i))) { return false; } } return true; } private Strings(); } | Strings { public static boolean containsOnlyDigits(String text) { if (isEmpty(text)) { return false; } for (int i = 0; i < text.length(); i++) { if (!Character.isDigit(text.charAt(i))) { return false; } } return true; } private Strings(); static boolean isStringLiteralSeparator(char character); static boolean isEmpty(... | Strings { public static boolean containsOnlyDigits(String text) { if (isEmpty(text)) { return false; } for (int i = 0; i < text.length(); i++) { if (!Character.isDigit(text.charAt(i))) { return false; } } return true; } private Strings(); static boolean isStringLiteralSeparator(char character); static boolean isEmpty(... |
@Test public void testRepeat() { assertEquals("foo,foo", Strings.repeat("foo", 2, ",")); assertEquals("ooo", Strings.repeat("o", 3, "")); assertEquals("o", Strings.repeat("o", -3, "")); assertEquals("", Strings.repeat("ouch", 0, "")); } | public static String repeat(String text, int times, String separator) { if (isEmpty(text) || times < 0) { return text; } if (times == 0) { return EMPTY; } StringBuilder builder = new StringBuilder(); for (int i = 0; i < times; i++) { builder.append(text); if (i + 1 < times) { builder.append(separator); } } return build... | Strings { public static String repeat(String text, int times, String separator) { if (isEmpty(text) || times < 0) { return text; } if (times == 0) { return EMPTY; } StringBuilder builder = new StringBuilder(); for (int i = 0; i < times; i++) { builder.append(text); if (i + 1 < times) { builder.append(separator); } } re... | Strings { public static String repeat(String text, int times, String separator) { if (isEmpty(text) || times < 0) { return text; } if (times == 0) { return EMPTY; } StringBuilder builder = new StringBuilder(); for (int i = 0; i < times; i++) { builder.append(text); if (i + 1 < times) { builder.append(separator); } } re... | Strings { public static String repeat(String text, int times, String separator) { if (isEmpty(text) || times < 0) { return text; } if (times == 0) { return EMPTY; } StringBuilder builder = new StringBuilder(); for (int i = 0; i < times; i++) { builder.append(text); if (i + 1 < times) { builder.append(separator); } } re... | Strings { public static String repeat(String text, int times, String separator) { if (isEmpty(text) || times < 0) { return text; } if (times == 0) { return EMPTY; } StringBuilder builder = new StringBuilder(); for (int i = 0; i < times; i++) { builder.append(text); if (i + 1 < times) { builder.append(separator); } } re... |
@Test public void testSubstringAfter() { assertEquals("o", Strings.substringAfter("foo", "o")); assertEquals("", Strings.substringAfter("foo", "a")); } | public static String substringAfter(String text, String delimiter) { Checker.checkArgumentsNotNull(text, delimiter); int index = text.indexOf(delimiter); if (index == -1) { return EMPTY; } return text.substring(index + delimiter.length()); } | Strings { public static String substringAfter(String text, String delimiter) { Checker.checkArgumentsNotNull(text, delimiter); int index = text.indexOf(delimiter); if (index == -1) { return EMPTY; } return text.substring(index + delimiter.length()); } } | Strings { public static String substringAfter(String text, String delimiter) { Checker.checkArgumentsNotNull(text, delimiter); int index = text.indexOf(delimiter); if (index == -1) { return EMPTY; } return text.substring(index + delimiter.length()); } private Strings(); } | Strings { public static String substringAfter(String text, String delimiter) { Checker.checkArgumentsNotNull(text, delimiter); int index = text.indexOf(delimiter); if (index == -1) { return EMPTY; } return text.substring(index + delimiter.length()); } private Strings(); static boolean isStringLiteralSeparator(char cha... | Strings { public static String substringAfter(String text, String delimiter) { Checker.checkArgumentsNotNull(text, delimiter); int index = text.indexOf(delimiter); if (index == -1) { return EMPTY; } return text.substring(index + delimiter.length()); } private Strings(); static boolean isStringLiteralSeparator(char cha... |
@Test public void testContains() { assertTrue(Arrays.contains(new Character[] { 'v', 'o', 'j', 't', 'a' }, 'a')); assertFalse( Arrays.contains(new Character[] { 'j', 'a', 's', 'a' }, null)); assertTrue(Arrays.contains(new Character[] { 'l', null }, null)); } | public static boolean contains(Object[] array, Object object) { if (array == null) { return false; } for (final Object element : array) { if ((object != null && object.equals(element)) || (object == null && element == null)) { return true; } } return false; } | Arrays { public static boolean contains(Object[] array, Object object) { if (array == null) { return false; } for (final Object element : array) { if ((object != null && object.equals(element)) || (object == null && element == null)) { return true; } } return false; } } | Arrays { public static boolean contains(Object[] array, Object object) { if (array == null) { return false; } for (final Object element : array) { if ((object != null && object.equals(element)) || (object == null && element == null)) { return true; } } return false; } } | Arrays { public static boolean contains(Object[] array, Object object) { if (array == null) { return false; } for (final Object element : array) { if ((object != null && object.equals(element)) || (object == null && element == null)) { return true; } } return false; } static boolean contains(Object[] array, Object obj... | Arrays { public static boolean contains(Object[] array, Object object) { if (array == null) { return false; } for (final Object element : array) { if ((object != null && object.equals(element)) || (object == null && element == null)) { return true; } } return false; } static boolean contains(Object[] array, Object obj... |
@Test public void testHelloWorld(){ HelloWorld helloWorld = new HelloWorld(); FlowContext context = new FlowContext(); context.put("name", "John"); try { int result = helloWorld.execute(context); context.get("message"); assertEquals(ActionBlock.NEXT, result); assertEquals("Hello World! John", context.get("message")); }... | public int execute(FlowContext ctx) throws FlowExecutionException { String name = (String) ctx.get(IN_NAME); String message = "Hello World! "; if (name != null) { message += name; } logger.debug("Message: {}", message); ctx.put(OUT_MESSAGE, message); return NEXT; } | HelloWorld implements ActionBlock { public int execute(FlowContext ctx) throws FlowExecutionException { String name = (String) ctx.get(IN_NAME); String message = "Hello World! "; if (name != null) { message += name; } logger.debug("Message: {}", message); ctx.put(OUT_MESSAGE, message); return NEXT; } } | HelloWorld implements ActionBlock { public int execute(FlowContext ctx) throws FlowExecutionException { String name = (String) ctx.get(IN_NAME); String message = "Hello World! "; if (name != null) { message += name; } logger.debug("Message: {}", message); ctx.put(OUT_MESSAGE, message); return NEXT; } } | HelloWorld implements ActionBlock { public int execute(FlowContext ctx) throws FlowExecutionException { String name = (String) ctx.get(IN_NAME); String message = "Hello World! "; if (name != null) { message += name; } logger.debug("Message: {}", message); ctx.put(OUT_MESSAGE, message); return NEXT; } int execute(FlowC... | HelloWorld implements ActionBlock { public int execute(FlowContext ctx) throws FlowExecutionException { String name = (String) ctx.get(IN_NAME); String message = "Hello World! "; if (name != null) { message += name; } logger.debug("Message: {}", message); ctx.put(OUT_MESSAGE, message); return NEXT; } int execute(FlowC... |
@Test public void testGetSpeedMph(){ double timeSec = 10.0; int engineHorsePower = 246; int vehicleWeightPounds = 4000; Engine engine = new Engine(); engine.setHorsePower(engineHorsePower); Vehicle vehicle = new Vehicle(vehicleWeightPounds, engine); double speed = vehicle.getSpeedMph(timeSec); assertEquals("Assert vehi... | protected double getSpeedMph(double timeSec){ double v = 2.0*this.engine.getHorsePower()*746; v = v*timeSec*32.174/this.weightPounds; return Math.round(Math.sqrt(v)*0.68); } | Vehicle { protected double getSpeedMph(double timeSec){ double v = 2.0*this.engine.getHorsePower()*746; v = v*timeSec*32.174/this.weightPounds; return Math.round(Math.sqrt(v)*0.68); } } | Vehicle { protected double getSpeedMph(double timeSec){ double v = 2.0*this.engine.getHorsePower()*746; v = v*timeSec*32.174/this.weightPounds; return Math.round(Math.sqrt(v)*0.68); } Vehicle(int weightPounds, Engine engine); } | Vehicle { protected double getSpeedMph(double timeSec){ double v = 2.0*this.engine.getHorsePower()*746; v = v*timeSec*32.174/this.weightPounds; return Math.round(Math.sqrt(v)*0.68); } Vehicle(int weightPounds, Engine engine); int getWeightPounds(); Engine getEngine(); } | Vehicle { protected double getSpeedMph(double timeSec){ double v = 2.0*this.engine.getHorsePower()*746; v = v*timeSec*32.174/this.weightPounds; return Math.round(Math.sqrt(v)*0.68); } Vehicle(int weightPounds, Engine engine); int getWeightPounds(); Engine getEngine(); } |
@Test public void testCalcSpeed(){ double timeSec = 10.0; TrafficDensity3 trafficDensity = new TrafficDensity3(); Vehicle vehicle = Mockito.mock(Vehicle.class); Mockito.when(vehicle.getSpeedMph(timeSec)).thenReturn(100d); double traction = 0.2; double speed = trafficDensity.calcSpeed(vehicle, traction, timeSec); assert... | protected double calcSpeed(Vehicle vehicle, double traction, double timeSec){ double speed = vehicle.getSpeedMph(timeSec); return Math.round(speed * traction); } | TrafficDensity3 { protected double calcSpeed(Vehicle vehicle, double traction, double timeSec){ double speed = vehicle.getSpeedMph(timeSec); return Math.round(speed * traction); } } | TrafficDensity3 { protected double calcSpeed(Vehicle vehicle, double traction, double timeSec){ double speed = vehicle.getSpeedMph(timeSec); return Math.round(speed * traction); } } | TrafficDensity3 { protected double calcSpeed(Vehicle vehicle, double traction, double timeSec){ double speed = vehicle.getSpeedMph(timeSec); return Math.round(speed * traction); } Integer[] trafficByLane(Stream<TrafficUnit> stream, int trafficUnitsNumber, double timeSec,
SpeedModel s... | TrafficDensity3 { protected double calcSpeed(Vehicle vehicle, double traction, double timeSec){ double speed = vehicle.getSpeedMph(timeSec); return Math.round(speed * traction); } Integer[] trafficByLane(Stream<TrafficUnit> stream, int trafficUnitsNumber, double timeSec,
SpeedModel s... |
@Test public void testCalcLaneNumber() { double[] speeds = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12}; double[] speedLimitByLane = {4.5, 8.5, 12.5}; int[] expectedLaneNumber = {1, 1, 1, 1, 2, 2, 2, 2, 3, 3, 3, 3}; TrafficDensityTestCalcLaneNumber trafficDensity = new TrafficDensityTestCalcLaneNumber(); for(int i = 0; i < ... | protected int calcLaneNumber(int lanesCount, double[] speedLimitByLane, double speed){ for(int i = 1; i <= lanesCount; i++){ if(speed <= speedLimitByLane[i - 1]){ return i; } } return lanesCount; } | TrafficDensity3 { protected int calcLaneNumber(int lanesCount, double[] speedLimitByLane, double speed){ for(int i = 1; i <= lanesCount; i++){ if(speed <= speedLimitByLane[i - 1]){ return i; } } return lanesCount; } } | TrafficDensity3 { protected int calcLaneNumber(int lanesCount, double[] speedLimitByLane, double speed){ for(int i = 1; i <= lanesCount; i++){ if(speed <= speedLimitByLane[i - 1]){ return i; } } return lanesCount; } } | TrafficDensity3 { protected int calcLaneNumber(int lanesCount, double[] speedLimitByLane, double speed){ for(int i = 1; i <= lanesCount; i++){ if(speed <= speedLimitByLane[i - 1]){ return i; } } return lanesCount; } Integer[] trafficByLane(Stream<TrafficUnit> stream, int trafficUnitsNumber, double timeSec,
... | TrafficDensity3 { protected int calcLaneNumber(int lanesCount, double[] speedLimitByLane, double speed){ for(int i = 1; i <= lanesCount; i++){ if(speed <= speedLimitByLane[i - 1]){ return i; } } return lanesCount; } Integer[] trafficByLane(Stream<TrafficUnit> stream, int trafficUnitsNumber, double timeSec,
... |
@Test public void testCalcLaneNumber2() { int[] count ={0}; double[] speeds = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12}; Integer[] expectedCountByLane = {4, 4, 4}; TrafficDensity3 trafficDensity = new TrafficDensity3(){ @Override protected double calcSpeed(Vehicle vehicle, double traction, double timeSec) { return speeds... | public Integer[] trafficByLane(Stream<TrafficUnit> stream, int trafficUnitsNumber, double timeSec, SpeedModel speedModel, double[] speedLimitByLane) { int lanesCount = speedLimitByLane.length; Map<Integer, Integer> trafficByLane = new HashMap<>(); for(int i = 1; i <= lanesCount; i++){ trafficByLane.put(i, 0); } stream.... | TrafficDensity3 { public Integer[] trafficByLane(Stream<TrafficUnit> stream, int trafficUnitsNumber, double timeSec, SpeedModel speedModel, double[] speedLimitByLane) { int lanesCount = speedLimitByLane.length; Map<Integer, Integer> trafficByLane = new HashMap<>(); for(int i = 1; i <= lanesCount; i++){ trafficByLane.pu... | TrafficDensity3 { public Integer[] trafficByLane(Stream<TrafficUnit> stream, int trafficUnitsNumber, double timeSec, SpeedModel speedModel, double[] speedLimitByLane) { int lanesCount = speedLimitByLane.length; Map<Integer, Integer> trafficByLane = new HashMap<>(); for(int i = 1; i <= lanesCount; i++){ trafficByLane.pu... | TrafficDensity3 { public Integer[] trafficByLane(Stream<TrafficUnit> stream, int trafficUnitsNumber, double timeSec, SpeedModel speedModel, double[] speedLimitByLane) { int lanesCount = speedLimitByLane.length; Map<Integer, Integer> trafficByLane = new HashMap<>(); for(int i = 1; i <= lanesCount; i++){ trafficByLane.pu... | TrafficDensity3 { public Integer[] trafficByLane(Stream<TrafficUnit> stream, int trafficUnitsNumber, double timeSec, SpeedModel speedModel, double[] speedLimitByLane) { int lanesCount = speedLimitByLane.length; Map<Integer, Integer> trafficByLane = new HashMap<>(); for(int i = 1; i <= lanesCount; i++){ trafficByLane.pu... |
@Test public void testCalcSpeed(){ double timeSec = 10.0; TrafficDensity2 trafficDensity = new TrafficDensity2(); Vehicle vehicle = Mockito.mock(Vehicle.class); Mockito.when(vehicle.getSpeedMph(timeSec)).thenReturn(100d); double traction = 0.2; double speed = trafficDensity.calcSpeed(vehicle, traction, timeSec); assert... | protected double calcSpeed(Vehicle vehicle, double traction, double timeSec){ double speed = vehicle.getSpeedMph(timeSec); return Math.round(speed * traction); } | TrafficDensity2 { protected double calcSpeed(Vehicle vehicle, double traction, double timeSec){ double speed = vehicle.getSpeedMph(timeSec); return Math.round(speed * traction); } } | TrafficDensity2 { protected double calcSpeed(Vehicle vehicle, double traction, double timeSec){ double speed = vehicle.getSpeedMph(timeSec); return Math.round(speed * traction); } } | TrafficDensity2 { protected double calcSpeed(Vehicle vehicle, double traction, double timeSec){ double speed = vehicle.getSpeedMph(timeSec); return Math.round(speed * traction); } Integer[] trafficByLane(Stream<TrafficUnit> stream, int trafficUnitsNumber, double timeSec,
SpeedModel s... | TrafficDensity2 { protected double calcSpeed(Vehicle vehicle, double traction, double timeSec){ double speed = vehicle.getSpeedMph(timeSec); return Math.round(speed * traction); } Integer[] trafficByLane(Stream<TrafficUnit> stream, int trafficUnitsNumber, double timeSec,
SpeedModel s... |
@Test public void testCountByLane() { int[] count ={0}; double[] speeds = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12}; TrafficDensity2 trafficDensity = new TrafficDensity2(){ @Override protected double calcSpeed(Vehicle vehicle, double traction, double timeSec) { return speeds[count[0]++]; } }; double timeSec = 10.0; int t... | private CountByLane countByLane(int lanesNumber, double[] speedLimit, double speed){ for(int i = 1; i <= lanesNumber; i++){ if(speed <= speedLimit[i - 1]){ return new CountByLane(1, i); } } return new CountByLane(1, lanesNumber); } | TrafficDensity2 { private CountByLane countByLane(int lanesNumber, double[] speedLimit, double speed){ for(int i = 1; i <= lanesNumber; i++){ if(speed <= speedLimit[i - 1]){ return new CountByLane(1, i); } } return new CountByLane(1, lanesNumber); } } | TrafficDensity2 { private CountByLane countByLane(int lanesNumber, double[] speedLimit, double speed){ for(int i = 1; i <= lanesNumber; i++){ if(speed <= speedLimit[i - 1]){ return new CountByLane(1, i); } } return new CountByLane(1, lanesNumber); } } | TrafficDensity2 { private CountByLane countByLane(int lanesNumber, double[] speedLimit, double speed){ for(int i = 1; i <= lanesNumber; i++){ if(speed <= speedLimit[i - 1]){ return new CountByLane(1, i); } } return new CountByLane(1, lanesNumber); } Integer[] trafficByLane(Stream<TrafficUnit> stream, int trafficUnitsN... | TrafficDensity2 { private CountByLane countByLane(int lanesNumber, double[] speedLimit, double speed){ for(int i = 1; i <= lanesNumber; i++){ if(speed <= speedLimit[i - 1]){ return new CountByLane(1, i); } } return new CountByLane(1, lanesNumber); } Integer[] trafficByLane(Stream<TrafficUnit> stream, int trafficUnitsN... |
@Test public void testTrafficByLane() { TrafficDensity1 trafficDensity = new TrafficDensity1(); double timeSec = 10.0; int trafficUnitsNumber = 120; double[] speedLimitByLane = {30, 50, 65}; Integer[] expectedCountByLane = {30, 30, 60}; Integer[] trafficByLane = trafficDensity.trafficByLane(getTrafficUnitStream2(traffi... | public Integer[] trafficByLane(Stream<TrafficUnit> stream, int trafficUnitsNumber, double timeSec, SpeedModel speedModel, double[] speedLimitByLane) { int lanesCount = speedLimitByLane.length; Map<Integer, Integer> trafficByLane = stream .limit(trafficUnitsNumber) .map(TrafficUnitWrapper::new) .map(tuw -> tuw.setSpeedM... | TrafficDensity1 { public Integer[] trafficByLane(Stream<TrafficUnit> stream, int trafficUnitsNumber, double timeSec, SpeedModel speedModel, double[] speedLimitByLane) { int lanesCount = speedLimitByLane.length; Map<Integer, Integer> trafficByLane = stream .limit(trafficUnitsNumber) .map(TrafficUnitWrapper::new) .map(tu... | TrafficDensity1 { public Integer[] trafficByLane(Stream<TrafficUnit> stream, int trafficUnitsNumber, double timeSec, SpeedModel speedModel, double[] speedLimitByLane) { int lanesCount = speedLimitByLane.length; Map<Integer, Integer> trafficByLane = stream .limit(trafficUnitsNumber) .map(TrafficUnitWrapper::new) .map(tu... | TrafficDensity1 { public Integer[] trafficByLane(Stream<TrafficUnit> stream, int trafficUnitsNumber, double timeSec, SpeedModel speedModel, double[] speedLimitByLane) { int lanesCount = speedLimitByLane.length; Map<Integer, Integer> trafficByLane = stream .limit(trafficUnitsNumber) .map(TrafficUnitWrapper::new) .map(tu... | TrafficDensity1 { public Integer[] trafficByLane(Stream<TrafficUnit> stream, int trafficUnitsNumber, double timeSec, SpeedModel speedModel, double[] speedLimitByLane) { int lanesCount = speedLimitByLane.length; Map<Integer, Integer> trafficByLane = stream .limit(trafficUnitsNumber) .map(TrafficUnitWrapper::new) .map(tu... |
@Test @Disabled public void testBytesPerf() { long t0 = System.currentTimeMillis(); for ( int j = 0; j < 1000; j++ ) { Asn1Buffer buffer = new Asn1Buffer(); for ( int i = 0; i < 409600; i++ ) { buffer.put( new byte[] { 0x01, ( byte ) i } ); } } long t1 = System.currentTimeMillis(); System.out.println( "Delta: " + ( t1 ... | public void put( byte b ) { if ( pos == buffer.length ) { extend( 1 ); } pos++; buffer[buffer.length - pos] = b; } | Asn1Buffer { public void put( byte b ) { if ( pos == buffer.length ) { extend( 1 ); } pos++; buffer[buffer.length - pos] = b; } } | Asn1Buffer { public void put( byte b ) { if ( pos == buffer.length ) { extend( 1 ); } pos++; buffer[buffer.length - pos] = b; } Asn1Buffer(); } | Asn1Buffer { public void put( byte b ) { if ( pos == buffer.length ) { extend( 1 ); } pos++; buffer[buffer.length - pos] = b; } Asn1Buffer(); int getPos(); void setPos( int pos ); void put( byte b ); void put( byte[] bytes ); ByteBuffer getBytes(); int getSize(); void clear(); @Override String toString(); } | Asn1Buffer { public void put( byte b ) { if ( pos == buffer.length ) { extend( 1 ); } pos++; buffer[buffer.length - pos] = b; } Asn1Buffer(); int getPos(); void setPos( int pos ); void put( byte b ); void put( byte[] bytes ); ByteBuffer getBytes(); int getSize(); void clear(); @Override String toString(); } |
@Test public void testNotEqualDiffValue() throws Exception { assertFalse( maxValueCountItemA.equals( maxValueCountItemC ) ); assertFalse( maxValueCountItemC.equals( maxValueCountItemA ) ); assertFalse( maxValueCountItemA.equals( maxValueCountItemD ) ); assertFalse( maxValueCountItemD.equals( maxValueCountItemA ) ); } | @Override public boolean equals( Object o ) { if ( this == o ) { return true; } if ( o instanceof MaxValueCountItem ) { MaxValueCountItem that = ( MaxValueCountItem ) o; return items.equals( that.items ); } return false; } | MaxValueCountItem extends ProtectedItem { @Override public boolean equals( Object o ) { if ( this == o ) { return true; } if ( o instanceof MaxValueCountItem ) { MaxValueCountItem that = ( MaxValueCountItem ) o; return items.equals( that.items ); } return false; } } | MaxValueCountItem extends ProtectedItem { @Override public boolean equals( Object o ) { if ( this == o ) { return true; } if ( o instanceof MaxValueCountItem ) { MaxValueCountItem that = ( MaxValueCountItem ) o; return items.equals( that.items ); } return false; } MaxValueCountItem( Set<MaxValueCountElem> items ); } | MaxValueCountItem extends ProtectedItem { @Override public boolean equals( Object o ) { if ( this == o ) { return true; } if ( o instanceof MaxValueCountItem ) { MaxValueCountItem that = ( MaxValueCountItem ) o; return items.equals( that.items ); } return false; } MaxValueCountItem( Set<MaxValueCountElem> items ); Iter... | MaxValueCountItem extends ProtectedItem { @Override public boolean equals( Object o ) { if ( this == o ) { return true; } if ( o instanceof MaxValueCountItem ) { MaxValueCountItem that = ( MaxValueCountItem ) o; return items.equals( that.items ); } return false; } MaxValueCountItem( Set<MaxValueCountElem> items ); Iter... |
@Test public void testEqualsNotInstanceOf() throws Exception { assertFalse( restrictedByItemA.equals( UndefinedNode.UNDEFINED_NODE ) ); } | @Override public boolean equals( Object o ) { if ( this == o ) { return true; } if ( o instanceof RestrictedByItem ) { RestrictedByItem that = ( RestrictedByItem ) o; if ( items != null ) { if ( that.items == null ) { return false; } if ( items.size() != that.items.size() ) { return false; } for ( RestrictedByElem item... | RestrictedByItem extends ProtectedItem { @Override public boolean equals( Object o ) { if ( this == o ) { return true; } if ( o instanceof RestrictedByItem ) { RestrictedByItem that = ( RestrictedByItem ) o; if ( items != null ) { if ( that.items == null ) { return false; } if ( items.size() != that.items.size() ) { re... | RestrictedByItem extends ProtectedItem { @Override public boolean equals( Object o ) { if ( this == o ) { return true; } if ( o instanceof RestrictedByItem ) { RestrictedByItem that = ( RestrictedByItem ) o; if ( items != null ) { if ( that.items == null ) { return false; } if ( items.size() != that.items.size() ) { re... | RestrictedByItem extends ProtectedItem { @Override public boolean equals( Object o ) { if ( this == o ) { return true; } if ( o instanceof RestrictedByItem ) { RestrictedByItem that = ( RestrictedByItem ) o; if ( items != null ) { if ( that.items == null ) { return false; } if ( items.size() != that.items.size() ) { re... | RestrictedByItem extends ProtectedItem { @Override public boolean equals( Object o ) { if ( this == o ) { return true; } if ( o instanceof RestrictedByItem ) { RestrictedByItem that = ( RestrictedByItem ) o; if ( items != null ) { if ( that.items == null ) { return false; } if ( items.size() != that.items.size() ) { re... |
@Test public void testEqualsNull() throws Exception { assertFalse( restrictedByItemA.equals( null ) ); } | @Override public boolean equals( Object o ) { if ( this == o ) { return true; } if ( o instanceof RestrictedByItem ) { RestrictedByItem that = ( RestrictedByItem ) o; if ( items != null ) { if ( that.items == null ) { return false; } if ( items.size() != that.items.size() ) { return false; } for ( RestrictedByElem item... | RestrictedByItem extends ProtectedItem { @Override public boolean equals( Object o ) { if ( this == o ) { return true; } if ( o instanceof RestrictedByItem ) { RestrictedByItem that = ( RestrictedByItem ) o; if ( items != null ) { if ( that.items == null ) { return false; } if ( items.size() != that.items.size() ) { re... | RestrictedByItem extends ProtectedItem { @Override public boolean equals( Object o ) { if ( this == o ) { return true; } if ( o instanceof RestrictedByItem ) { RestrictedByItem that = ( RestrictedByItem ) o; if ( items != null ) { if ( that.items == null ) { return false; } if ( items.size() != that.items.size() ) { re... | RestrictedByItem extends ProtectedItem { @Override public boolean equals( Object o ) { if ( this == o ) { return true; } if ( o instanceof RestrictedByItem ) { RestrictedByItem that = ( RestrictedByItem ) o; if ( items != null ) { if ( that.items == null ) { return false; } if ( items.size() != that.items.size() ) { re... | RestrictedByItem extends ProtectedItem { @Override public boolean equals( Object o ) { if ( this == o ) { return true; } if ( o instanceof RestrictedByItem ) { RestrictedByItem that = ( RestrictedByItem ) o; if ( items != null ) { if ( that.items == null ) { return false; } if ( items.size() != that.items.size() ) { re... |
@Test public void testHashCodeReflexive() throws Exception { assertEquals( restrictedByItemA.hashCode(), restrictedByItemA.hashCode() ); } | @Override public int hashCode() { int hash = 37; if ( items != null ) { for ( RestrictedByElem item : items ) { if ( item != null ) { hash = hash * item.hashCode(); } else { hash = hash * 37; } } } return hash; } | RestrictedByItem extends ProtectedItem { @Override public int hashCode() { int hash = 37; if ( items != null ) { for ( RestrictedByElem item : items ) { if ( item != null ) { hash = hash * item.hashCode(); } else { hash = hash * 37; } } } return hash; } } | RestrictedByItem extends ProtectedItem { @Override public int hashCode() { int hash = 37; if ( items != null ) { for ( RestrictedByElem item : items ) { if ( item != null ) { hash = hash * item.hashCode(); } else { hash = hash * 37; } } } return hash; } RestrictedByItem( Set<RestrictedByElem> items ); } | RestrictedByItem extends ProtectedItem { @Override public int hashCode() { int hash = 37; if ( items != null ) { for ( RestrictedByElem item : items ) { if ( item != null ) { hash = hash * item.hashCode(); } else { hash = hash * 37; } } } return hash; } RestrictedByItem( Set<RestrictedByElem> items ); Iterator<Restrict... | RestrictedByItem extends ProtectedItem { @Override public int hashCode() { int hash = 37; if ( items != null ) { for ( RestrictedByElem item : items ) { if ( item != null ) { hash = hash * item.hashCode(); } else { hash = hash * 37; } } } return hash; } RestrictedByItem( Set<RestrictedByElem> items ); Iterator<Restrict... |
@Test public void testHashCodeSymmetric() throws Exception { assertEquals( restrictedByItemA.hashCode(), restrictedByItemACopy.hashCode() ); assertEquals( restrictedByItemACopy.hashCode(), restrictedByItemA.hashCode() ); } | @Override public int hashCode() { int hash = 37; if ( items != null ) { for ( RestrictedByElem item : items ) { if ( item != null ) { hash = hash * item.hashCode(); } else { hash = hash * 37; } } } return hash; } | RestrictedByItem extends ProtectedItem { @Override public int hashCode() { int hash = 37; if ( items != null ) { for ( RestrictedByElem item : items ) { if ( item != null ) { hash = hash * item.hashCode(); } else { hash = hash * 37; } } } return hash; } } | RestrictedByItem extends ProtectedItem { @Override public int hashCode() { int hash = 37; if ( items != null ) { for ( RestrictedByElem item : items ) { if ( item != null ) { hash = hash * item.hashCode(); } else { hash = hash * 37; } } } return hash; } RestrictedByItem( Set<RestrictedByElem> items ); } | RestrictedByItem extends ProtectedItem { @Override public int hashCode() { int hash = 37; if ( items != null ) { for ( RestrictedByElem item : items ) { if ( item != null ) { hash = hash * item.hashCode(); } else { hash = hash * 37; } } } return hash; } RestrictedByItem( Set<RestrictedByElem> items ); Iterator<Restrict... | RestrictedByItem extends ProtectedItem { @Override public int hashCode() { int hash = 37; if ( items != null ) { for ( RestrictedByElem item : items ) { if ( item != null ) { hash = hash * item.hashCode(); } else { hash = hash * 37; } } } return hash; } RestrictedByItem( Set<RestrictedByElem> items ); Iterator<Restrict... |
@Test public void testHashCodeTransitive() throws Exception { assertEquals( restrictedByItemA.hashCode(), restrictedByItemACopy.hashCode() ); assertEquals( restrictedByItemACopy.hashCode(), restrictedByItemB.hashCode() ); assertEquals( restrictedByItemA.hashCode(), restrictedByItemB.hashCode() ); } | @Override public int hashCode() { int hash = 37; if ( items != null ) { for ( RestrictedByElem item : items ) { if ( item != null ) { hash = hash * item.hashCode(); } else { hash = hash * 37; } } } return hash; } | RestrictedByItem extends ProtectedItem { @Override public int hashCode() { int hash = 37; if ( items != null ) { for ( RestrictedByElem item : items ) { if ( item != null ) { hash = hash * item.hashCode(); } else { hash = hash * 37; } } } return hash; } } | RestrictedByItem extends ProtectedItem { @Override public int hashCode() { int hash = 37; if ( items != null ) { for ( RestrictedByElem item : items ) { if ( item != null ) { hash = hash * item.hashCode(); } else { hash = hash * 37; } } } return hash; } RestrictedByItem( Set<RestrictedByElem> items ); } | RestrictedByItem extends ProtectedItem { @Override public int hashCode() { int hash = 37; if ( items != null ) { for ( RestrictedByElem item : items ) { if ( item != null ) { hash = hash * item.hashCode(); } else { hash = hash * 37; } } } return hash; } RestrictedByItem( Set<RestrictedByElem> items ); Iterator<Restrict... | RestrictedByItem extends ProtectedItem { @Override public int hashCode() { int hash = 37; if ( items != null ) { for ( RestrictedByElem item : items ) { if ( item != null ) { hash = hash * item.hashCode(); } else { hash = hash * 37; } } } return hash; } RestrictedByItem( Set<RestrictedByElem> items ); Iterator<Restrict... |
@Test public void testNotEqualDiffValue() throws Exception { assertFalse( restrictedByItemA.equals( restrictedByItemC ) ); assertFalse( restrictedByItemC.equals( restrictedByItemA ) ); assertFalse( restrictedByItemA.equals( restrictedByItemD ) ); assertFalse( restrictedByItemD.equals( restrictedByItemA ) ); } | @Override public boolean equals( Object o ) { if ( this == o ) { return true; } if ( o instanceof RestrictedByItem ) { RestrictedByItem that = ( RestrictedByItem ) o; if ( items != null ) { if ( that.items == null ) { return false; } if ( items.size() != that.items.size() ) { return false; } for ( RestrictedByElem item... | RestrictedByItem extends ProtectedItem { @Override public boolean equals( Object o ) { if ( this == o ) { return true; } if ( o instanceof RestrictedByItem ) { RestrictedByItem that = ( RestrictedByItem ) o; if ( items != null ) { if ( that.items == null ) { return false; } if ( items.size() != that.items.size() ) { re... | RestrictedByItem extends ProtectedItem { @Override public boolean equals( Object o ) { if ( this == o ) { return true; } if ( o instanceof RestrictedByItem ) { RestrictedByItem that = ( RestrictedByItem ) o; if ( items != null ) { if ( that.items == null ) { return false; } if ( items.size() != that.items.size() ) { re... | RestrictedByItem extends ProtectedItem { @Override public boolean equals( Object o ) { if ( this == o ) { return true; } if ( o instanceof RestrictedByItem ) { RestrictedByItem that = ( RestrictedByItem ) o; if ( items != null ) { if ( that.items == null ) { return false; } if ( items.size() != that.items.size() ) { re... | RestrictedByItem extends ProtectedItem { @Override public boolean equals( Object o ) { if ( this == o ) { return true; } if ( o instanceof RestrictedByItem ) { RestrictedByItem that = ( RestrictedByItem ) o; if ( items != null ) { if ( that.items == null ) { return false; } if ( items.size() != that.items.size() ) { re... |
@Test public void testEqualsNotInstanceOf() throws Exception { assertFalse( attributeValueItemA.equals( UndefinedNode.UNDEFINED_NODE ) ); } | @Override public boolean equals( Object o ) { if ( this == o ) { return true; } if ( o instanceof AttributeValueItem ) { AttributeValueItem that = ( AttributeValueItem ) o; if ( attributes != null ) { if ( ( that.attributes == null ) || ( that.attributes.size() != attributes.size() ) ) { return false; } for ( Attribute... | AttributeValueItem extends ProtectedItem { @Override public boolean equals( Object o ) { if ( this == o ) { return true; } if ( o instanceof AttributeValueItem ) { AttributeValueItem that = ( AttributeValueItem ) o; if ( attributes != null ) { if ( ( that.attributes == null ) || ( that.attributes.size() != attributes.s... | AttributeValueItem extends ProtectedItem { @Override public boolean equals( Object o ) { if ( this == o ) { return true; } if ( o instanceof AttributeValueItem ) { AttributeValueItem that = ( AttributeValueItem ) o; if ( attributes != null ) { if ( ( that.attributes == null ) || ( that.attributes.size() != attributes.s... | AttributeValueItem extends ProtectedItem { @Override public boolean equals( Object o ) { if ( this == o ) { return true; } if ( o instanceof AttributeValueItem ) { AttributeValueItem that = ( AttributeValueItem ) o; if ( attributes != null ) { if ( ( that.attributes == null ) || ( that.attributes.size() != attributes.s... | AttributeValueItem extends ProtectedItem { @Override public boolean equals( Object o ) { if ( this == o ) { return true; } if ( o instanceof AttributeValueItem ) { AttributeValueItem that = ( AttributeValueItem ) o; if ( attributes != null ) { if ( ( that.attributes == null ) || ( that.attributes.size() != attributes.s... |
@Test public void testEqualsNull() throws Exception { assertFalse( attributeValueItemA.equals( null ) ); } | @Override public boolean equals( Object o ) { if ( this == o ) { return true; } if ( o instanceof AttributeValueItem ) { AttributeValueItem that = ( AttributeValueItem ) o; if ( attributes != null ) { if ( ( that.attributes == null ) || ( that.attributes.size() != attributes.size() ) ) { return false; } for ( Attribute... | AttributeValueItem extends ProtectedItem { @Override public boolean equals( Object o ) { if ( this == o ) { return true; } if ( o instanceof AttributeValueItem ) { AttributeValueItem that = ( AttributeValueItem ) o; if ( attributes != null ) { if ( ( that.attributes == null ) || ( that.attributes.size() != attributes.s... | AttributeValueItem extends ProtectedItem { @Override public boolean equals( Object o ) { if ( this == o ) { return true; } if ( o instanceof AttributeValueItem ) { AttributeValueItem that = ( AttributeValueItem ) o; if ( attributes != null ) { if ( ( that.attributes == null ) || ( that.attributes.size() != attributes.s... | AttributeValueItem extends ProtectedItem { @Override public boolean equals( Object o ) { if ( this == o ) { return true; } if ( o instanceof AttributeValueItem ) { AttributeValueItem that = ( AttributeValueItem ) o; if ( attributes != null ) { if ( ( that.attributes == null ) || ( that.attributes.size() != attributes.s... | AttributeValueItem extends ProtectedItem { @Override public boolean equals( Object o ) { if ( this == o ) { return true; } if ( o instanceof AttributeValueItem ) { AttributeValueItem that = ( AttributeValueItem ) o; if ( attributes != null ) { if ( ( that.attributes == null ) || ( that.attributes.size() != attributes.s... |
@Test public void testHashCodeReflexive() throws Exception { assertEquals( attributeValueItemA.hashCode(), attributeValueItemA.hashCode() ); } | @Override public int hashCode() { int hash = 37; if ( attributes != null ) { for ( Attribute attribute : attributes ) { hash = hash * 17 + attribute.hashCode(); } } return hash; } | AttributeValueItem extends ProtectedItem { @Override public int hashCode() { int hash = 37; if ( attributes != null ) { for ( Attribute attribute : attributes ) { hash = hash * 17 + attribute.hashCode(); } } return hash; } } | AttributeValueItem extends ProtectedItem { @Override public int hashCode() { int hash = 37; if ( attributes != null ) { for ( Attribute attribute : attributes ) { hash = hash * 17 + attribute.hashCode(); } } return hash; } AttributeValueItem( Set<Attribute> attributes ); } | AttributeValueItem extends ProtectedItem { @Override public int hashCode() { int hash = 37; if ( attributes != null ) { for ( Attribute attribute : attributes ) { hash = hash * 17 + attribute.hashCode(); } } return hash; } AttributeValueItem( Set<Attribute> attributes ); Iterator<Attribute> iterator(); @Override int ha... | AttributeValueItem extends ProtectedItem { @Override public int hashCode() { int hash = 37; if ( attributes != null ) { for ( Attribute attribute : attributes ) { hash = hash * 17 + attribute.hashCode(); } } return hash; } AttributeValueItem( Set<Attribute> attributes ); Iterator<Attribute> iterator(); @Override int ha... |
@Test public void testYearMonthDayHourMinSecMinusHourMin() throws ParseException { String gt = "20080102121314-1030"; GeneralizedTime generalizedTime = new GeneralizedTime( gt ); String result = generalizedTime.toGeneralizedTime(); assertEquals( gt, result ); } | public String toGeneralizedTime() { return toGeneralizedTime( upFormat, upFractionDelimiter, upFractionLength, upTimeZoneFormat ); } | GeneralizedTime implements Comparable<GeneralizedTime> { public String toGeneralizedTime() { return toGeneralizedTime( upFormat, upFractionDelimiter, upFractionLength, upTimeZoneFormat ); } } | GeneralizedTime implements Comparable<GeneralizedTime> { public String toGeneralizedTime() { return toGeneralizedTime( upFormat, upFractionDelimiter, upFractionLength, upTimeZoneFormat ); } GeneralizedTime( Date date ); GeneralizedTime( Calendar calendar ); GeneralizedTime( long timeInMillis ); GeneralizedTime( Stri... | GeneralizedTime implements Comparable<GeneralizedTime> { public String toGeneralizedTime() { return toGeneralizedTime( upFormat, upFractionDelimiter, upFractionLength, upTimeZoneFormat ); } GeneralizedTime( Date date ); GeneralizedTime( Calendar calendar ); GeneralizedTime( long timeInMillis ); GeneralizedTime( Stri... | GeneralizedTime implements Comparable<GeneralizedTime> { public String toGeneralizedTime() { return toGeneralizedTime( upFormat, upFractionDelimiter, upFractionLength, upTimeZoneFormat ); } GeneralizedTime( Date date ); GeneralizedTime( Calendar calendar ); GeneralizedTime( long timeInMillis ); GeneralizedTime( Stri... |
@Test public void testHashCodeSymmetric() throws Exception { assertEquals( attributeValueItemA.hashCode(), attributeValueItemACopy.hashCode() ); assertEquals( attributeValueItemACopy.hashCode(), attributeValueItemA.hashCode() ); } | @Override public int hashCode() { int hash = 37; if ( attributes != null ) { for ( Attribute attribute : attributes ) { hash = hash * 17 + attribute.hashCode(); } } return hash; } | AttributeValueItem extends ProtectedItem { @Override public int hashCode() { int hash = 37; if ( attributes != null ) { for ( Attribute attribute : attributes ) { hash = hash * 17 + attribute.hashCode(); } } return hash; } } | AttributeValueItem extends ProtectedItem { @Override public int hashCode() { int hash = 37; if ( attributes != null ) { for ( Attribute attribute : attributes ) { hash = hash * 17 + attribute.hashCode(); } } return hash; } AttributeValueItem( Set<Attribute> attributes ); } | AttributeValueItem extends ProtectedItem { @Override public int hashCode() { int hash = 37; if ( attributes != null ) { for ( Attribute attribute : attributes ) { hash = hash * 17 + attribute.hashCode(); } } return hash; } AttributeValueItem( Set<Attribute> attributes ); Iterator<Attribute> iterator(); @Override int ha... | AttributeValueItem extends ProtectedItem { @Override public int hashCode() { int hash = 37; if ( attributes != null ) { for ( Attribute attribute : attributes ) { hash = hash * 17 + attribute.hashCode(); } } return hash; } AttributeValueItem( Set<Attribute> attributes ); Iterator<Attribute> iterator(); @Override int ha... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.